GnuPG with Java on Windows?
Mon Mar 24 14:16:02 2003
I have not looked at your code but the example in the text does not
work because the backslash is an escape character in Java.
(You need to double them to get a backslash in a strin literal.)
But that should not give you that kind of error. Have you tried using
the full filenames and quoting the string? I seem to remember that
working some years ago.
And unless things have changed since then you need to look-out for pipes
that block the sending process when they get filled. That was
"interesting" to find, sometimes the program stoped on a
On Mon, Mar 24, 2003 at 02:36:22PM +0900, Jean-Christian Imbeault wrote:
> I'm trying to write a small Java program that will decrypt content
> encrypted with GnuPG. I've scoured the archives and have found links and
> even some code examples.
> The problem I am running in to is that I can't get the code examples to
> run under Windows. GnuPg keeps giving an error.
> For example the following will work fine on the command line in windows:
> gpg --no-secmem-warning --passphrase-fd 0 --batch --decrypt
> But if run from Java as:
> String cmd, path;
> path = " C:\DOCUME~1\Jc1\LOCALS~1\Temp\AAA9691.tmp";
> cmd = "gpg --no-secmem-warning --passphrase-fd 0 --batch --decrypt";
> Runtime.getRuntime().exec(cmd + path);
> I get the following error:
> gpg error >> code: 2 >> gpg: can't open
> gpg: decrypt_message failed: file open error
> Why can't gpg open the file when run from Java but can open when run
> from the command line? What did I miss?
> Can anyone giver me some pointers on why I get this error and how I can
> fix my code to make it work? (code included at bottom)
> Or if anyone can point me to a simple implementation of decryption using
> gpg in Java (under windows?) that might prove useful also.
> PS The code I am using was shamelessly lifted from
> http://www.eurielec.etsit.upm.es/~jamc/work/jfreevote-1.0/ :)