gnu pg
Dutta, Pradipta
pradipta.dutta at citi.com
Wed May 2 17:05:41 CEST 2012
Hi
I will appreciate your help in understanding the encryption and decryption of
GNUPG by using Java in Windows environment.
Please let me know if you have any jar files or sample java code to accomplish the same.
My requirement is as follows:
We get one encrypted file from the user and using java in Windows environment we need to encrypt the file and store it
In one directory.
The below code when I try to run in windows I got the Error.
import com.freiheit.gnupg.GnuPGContext;
import com.freiheit.gnupg.GnuPGData;
import com.freiheit.gnupg.GnuPGKey;
public class TestMain {
/**
* @param args
*/
public static void main(String[] args) {
TestMain t = new TestMain();
t.encryp();
}
public void encryp()
{
GnuPGContext ctx = new GnuPGContext();
GnuPGKey[] recipient = new GnuPGKey[1];
recipient[0] = ctx.getKeyByFingerprint("gpg-fingerprint of recipient (must be from your keyring)");
GnuPGData plain = ctx.createDataObject("I am a secret message.");
GnuPGData cipher = ctx.createDataObject();//this will contain the cipher after encryption
ctx.encrypt(recipient, plain, cipher);
System.out.println("Plain text: " + plain);
System.out.println("Cipher text: " + cipher);
}
}
Exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\pd68403\AppData\Local\Temp\libjavagnupg15415.so: Can't load this .dll (machine code=0x101) on a IA 32-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647)
at java.lang.Runtime.load0(Runtime.java:769)
at java.lang.System.load(System.java:968)
at com.freiheit.gnupg.GnuPGContext.<clinit>(GnuPGContext.java:465)
at com.citi.encryp.TestMain.encryp(TestMain.java:20)
at com.citi.encryp.TestMain.main(TestMain.java:14)
Thanks and Regards
Pradipta Dutta
Desk no: 908 563 0274
mail id: pradipta.dutta at citi.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20120502/41833c5b/attachment-0001.htm>
More information about the Gnupg-users
mailing list