I am facing a weird error when I try to add a certificate to Keystore.
System.out.println(x509Certificate.getPublicKey()); // prints public key, certificate is valid
GlobalStoreManager.getInstance().getSPATruststore().setCertificateEntry(name, x509Certificate); // no error
System.out.println(GlobalStoreManager.getInstance().getSPATruststore().getCertificate(name)); // null
Why is the setCertificateEntry
is not throwing any error and still getCertificate
returns null?
Update:
I tried to get the certificate alias right after calling setCertificateEntry()
and it worked??!, so the problems seems to be with getCertificate()
call rather than setCertificateEntry()
call?
System.out.println(GlobalStoreManager.getInstance().getSPATruststore().getCertificateAlias(x509Certificate));
Thanks.