NullPointerException when generating RSA keys with BouncyCastle

Posted by Tom Brito on Stack Overflow See other posts from Stack Overflow or by Tom Brito
Published on 2010-05-20T19:15:49Z Indexed on 2010/05/20 19:40 UTC
Read the original article Hit count: 331

public static void main(String[] args) throws Exception {
    RSAKeyPairGenerator rsaKeyPairGen = new RSAKeyPairGenerator();
    AsymmetricCipherKeyPair keyPair = rsaKeyPairGen.generateKeyPair();
}

the rsaKeyPairGen is not null, but the generateKeyPair() method is throwing NullPointerException. What may be wrong?

Error message:

java.lang.NullPointerException
at org.bouncycastle.crypto.generators.RSAKeyPairGenerator.generateKeyPair(Unknown Source)
at pkg.main(Main.java:154)

© Stack Overflow or respective owner

Related posts about java

Related posts about bouncycastle