I am using the Windows port of GNU Privacy Guard "light" release for version 1.0.9 installed on a windows 7 professional laptop. Installed in the default directory of : C:\Program Files (x86)\GNU\GnuPG . The trustdb and keyring files are here: C:\users\\AppData\Roaming\gnupg. Both of these folders are pathed in my environment variable PATH.

I have been following along using this tutorial: http://www.glump.net/howto/gpg_intro

and everything has worked smoothly up to 4.1 Using the GPG Encrypt Command

When i try this command to encrypt a simple text file with one line "This is a Test!", i get an error.

gpg --recipient "John Doe" --output "C:\data.txt.gpg" --encrypt "data.txt"

The error i receive is:

gpg: can't open 'data.txt': no error gpg: data.txt: encryption failed: file open error

Any ideas why i get this error? Anything do do with Win 7 rights? I checked the text files attributes and they are fine.

Does anyone know what folder the file will be created in? And, whether or not the folder needs special rights? As I stated above, i was able to do all the previous steps in the tutorial without an errors or issues.....including creating key pairs, and publishing a public key to file.

Thanks for any help you might be able to give me

  • Are you sure it's GnuPG 1.0.9? This version doesn't seem to have ever existed; and if it did, it would've been at least 10 years old. (The latest is 2.1.0 from Gpg4Win.) – user1686 Apr 25 '12 at 14:56
  • Hmmm, your right, there is a newer version. I was using what another expert told me to use. I took his link and downloaded it. files.gpg4win.org/gpg4win-light-1.0.9.exe. I will download the latest and give it a shot. – Johnny Holmes Apr 26 '12 at 13:06
  • Ah, I got confused a little -- 1.0.9 is the version of the "Gpg4Win" bundle, not of GnuPG itself. Regardless, it is from 2007 and should be avoided if possible. (Gpg4win 2.1.0 bundles GnuPG 2.0.17.) – user1686 Apr 26 '12 at 13:24
  • I uninstalled the old, rebooted, re-installed the new 2.1.0, and I tried it, i still get the same error. – Johnny Holmes Apr 26 '12 at 13:37
  • I have also tested this on a Windows Server 2008 machine and again, i could create keys, export keys, but could not use the ecrypt command. i received the same error as i did in my test on the Win 7 machine – Johnny Holmes Apr 30 '12 at 14:04

I cannot explain the error message; however, it might just go away after upgrading to the latest GnuPG (install using Gpg4Win bundle).

The rest:

Does anyone know what folder the file will be created in?

The one you specified in --output, of course. C:\data.txt.gpg means the file will be in C:\, or directly in the root of the C: drive.

If you hadn't specified a path, only the name (for example, --output data.txt.gpg), the file would go to the "current directory", which is shown in the console window's "prompt". For example, the following happens in the F:\Users\Mantas directory, and later changes to C:\WINDOWS:

F:\Users\Mantas> gpg --recipient grawity --output data.gpg --encrypt data.txt
F:\Users\Mantas> cd /d C:\WINDOWS

After writing this, I realized that I may be able to explain the error message. In your question, you haven't actually mentioned whether you are in the correct directory or not. It could just be that your data.txt is elsewhere... although it'd make this a weird error message. Still, check using dir.

And, whether or not the folder needs special rights?

Nothing "special", but you do need the permission to create new files in that folder.

sually users are limited to their own "profile" folders under C:\Users, and creating files directly in C:\ may require elevation.

  • Ive installed the new version, and i have even tried the encrypt from the users folder C:\Users\<mynamehere> as well as from the C:\users\<mynamehere>\AppData\Roaming\gnupg folder - still the same error – Johnny Holmes Apr 26 '12 at 14:24
  • I am able to manually create a file, be right clicking in the folder and creaing a new text file. NOTE: I have also tested it by psecifying the path of the file and where the encrypted file will be written too. Tried it in a number of locations - with no success - same error. – Johnny Holmes Apr 30 '12 at 14:05
  • +1 from where did you get the command line switches ? I want to execute with console , But I have many params to declare. from where do you have the list ? can you provide a link ? Thank you very much . – Royi Namir Dec 5 '12 at 9:04
  • @RoyiNamir: The most important ones are listed by gpg --help. If you want all possible options and commands, see the online docs or – on Unixes – the manual page, man gpg. – user1686 Dec 5 '12 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.