Calling GPG from Java (was: GnuPG Security Disaster?)

Bernd Eckenfels lists at lina.inka.de
Fri Jan 4 19:01:01 CET 2002


Hello Bernard,

thanks for answering back. I must have mit I have only experience in
wrapping gpg from Visual-C, not Java, but I had wrapped other .exe Programs
from within Java, before.

On Fri, Jan 04, 2002 at 10:12:40PM +1300, Bernard wrote:
> I have before our correspondence submitted to Sun a collection of test
> cases they can use to verify their new JDK 1.4 Process API fixes.

Would you care to send me them in private?

> InputStreamReader stdout = new InputStreamReader(new
> BufferedInputStream(process.getInputStream()));
> 
> InputStreamReader stderr = new InputStreamReader(new
> BufferedInputStream(process.getErrorStream()));
> 
> PrintStream stdin = new PrintStream(process.getOutputStream());

Can you try to use the OutputStream directly, without a Buffer and without a
Reader. As long as you do ASCII this should work.

BTW: when does it block, do you not get any Text on the FDs, or just not
all? Can you add verbose option to GPG and does it change anything?

BTW: if you sure the stdin does not block, then you do not need a thread for
it, of course.

BTW: can you try to do:

try {
process.exitValue();
System.out.println("ERROR: the GPG Process is already terminated! "+ v);
} catch (IllegalThreadStateException i) {
System.out.println("Fine! gpg.exe is still running");
}

in various places, not sure if reading from your streams will throw an
excpetion in all cases.

Greetings
Bernd




More information about the Gnupg-devel mailing list