GnuPG class throwing null pointer exception

winifred quartey-papafio winniepuul at yahoo.co.uk
Tue May 27 11:26:34 CEST 2014


Hello
I'm having a problem encrypting a String text using the GnuPG class. I'm using the encrypt and decrypt class from http://www.macnews.co.il/mageworks/java/gnupg/sample-code.shtml which is based on the GnuPG class from http://lists.gnupg.org/pipermail/gnupg-devel/2002-February/018098.html. However I keep getting a null pointer exception. I don't know what I'm doing wrong. I'd appreciate your help with this


this is my code:
GnuPG pgp = new GnuPG (); result = pgp.encrypt (text, keyID);and this is what throws the null pointer exception in the GnuPG class:public void encrypt(String str, String rcpt) { System.out.print("Encrypting... "); try {
p= Runtime.getRuntime().exec(("gpg --armor --batch --encrypt -r "+ rcpt).split("\\s+")); } catch (IOException io) { System.out.println("Error creating process."); } ProcessStreamReader psr_stdout = new ProcessStreamReader("STDIN", p.getInputStream()); ProcessStreamReader psr_stderr = new ProcessStreamReader("STDERR", p.getErrorStream()); 
....
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20140527/48764bb8/attachment.html>


More information about the Gnupg-users mailing list