I'm very new to android and java both, so hopefully I'm missing
something easy. I have some code that will compile and run on my
ubuntu box, but throws a null pointer exception in the android
emulator:
KeyPair myKeyPair =
KeyPairGenerator.getInstance("RSA").generateKeyPair();
X500Principal subject = new X500Principal("CN=Test V3
Certificate");
PKCS10CertificationRequest csr = new PKCS10CertificationRequest
( "SHA1withRSA",
new X500Principal(new X500Name()),
myKeyPair.getPublic(),
null,
myKeyPair.getPrivate()
);
byte[] outBytes = csr.getEncoded();
return new String(outBytes);