I have a Base-64 encoded X.509 (.CER) certificate that is causing a NullPointerException on the below java code. The line causing it is PublicKey pubKey = pubCert.getPublicKey();
Is there a way to verify that myfile.keystore has the “xyz” certificate?
final FileInputStream keyFile = new FileInputStream(filePath
+ "myfile.keystore");
final KeyStore keyStore = KeyStore.getInstance("JKS");
String storepass = "mypass";
keyStore.load(keyFile, storepass.toCharArray());
Certificate pubCert = keyStore.getCertificate("xyz");
PublicKey pubKey = pubCert.getPublicKey();
Try the
keytoolcommand that should be in your JRE or JDK bin directory, see output below:Reference:
http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/keytool.html