Hi.
I'm trying to creat a RSA Keypair of a public and private key. I tried
using the example from the bottom of the page of:
http://www.gnu.org/software/gnu-crypto/manual/api/gnu/crypto/key/package-summary.html
I compiled without any error using the binaries.
%javac -classpath .:/gnu-crypto.jar Test.java
But when I run it, I get the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
gnu/crypto/key/rsa/RSAKeyPairGenerator
at Test.main(Test.java:14)
Can anyone help me with this? I have no idea what the problem could be.
Is there a better way to create RSA KeyPairs? Thanks!!
Sandy
Test.java
--------------------------------------------------------------------------
import gnu.crypto.sig.rsa.RSA;
import gnu.crypto.key.rsa.RSAKeyPairGenerator;
import java.math.BigInteger;
import java.security.KeyPair;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPrivateCrtKey;
import java.security.interfaces.RSAPublicKey;
import java.util.HashMap;
import java.util.Random;
class Test {
public static void main(String[] args) {
RSAKeyPairGenerator kpg = new RSAKeyPairGenerator();
HashMap map = new HashMap();
map.put(RSAKeyPairGenerator.MODULUS_LENGTH, new Integer(1024));
kpg.setup(map);
KeyPair kp = kpg.generate();
BigInteger n1 = ((RSAPublicKey) kp.getPublic()).getModulus();
BigInteger e = ((RSAPublicKey) kp.getPublic()).getPublicExponent();
BigInteger n2 = ((RSAPrivateKey) kp.getPrivate()).getModulus();
BigInteger d = ((RSAPrivateKey) kp.getPrivate()).getPrivateExponent();
}
}
-----------------------------------------------------------------------
_______________________________________________
gnu-crypto-discuss mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnu-crypto-discuss