Hi everybody, i'm facing a strange error when i try to generate Key-Pair to be used for encryption purposes. I try to run the following code on Ubuntu:
KeyPairGenerator myPriPubKeys;
myPriPubKeys = KeyPairGenerator.getInstance("RSA");
SecureRandom myRandom = SecureRandom.getInstance("SHA1PRNG");
myPriPubKeys.initialize(1024, myRandom);
myKeyPair = myPriPubKeys.genKeyPair();
The error showing is:
genKeyPair failed: java.lang.ArithmeticException: negative exponent
java.lang.ArithmeticException: negative exponent
at java.math.BigInteger.pow(libgcj.so.81)
at gnu.java.security.key.dss.FIPS186.generateParameters(libgcj.so.81)
at gnu.java.security.key.dss.DSSKeyPairGenerator.generate(libgcj.so.81)
at gnu.java.security.jce.sig.KeyPairGeneratorAdapter.generateKeyPair(libgcj.so.81)
at java.security.KeyPairGenerator.genKeyPair(libgcj.so.81)
Can any one support.
BTW, i tried to run this code with window XP and it was working perfectly.
Thanks and waiting your replies.
Cu,
Ahmed Banihammad