I imported a p12 certificate file to system on Windows 7, on which a Tomcat webapp is running. I try to retrieve certificate with following code:
private KSPrivateKeyEntry getKSPrivateKeyEntry(final String alias, ProtectionParameter passwordProtection) {
KeyStore keyStore = getKeyStore();
try {
if (keyStore.isKeyEntry(alias)) {
final PrivateKeyEntry entry = (PrivateKeyEntry) keyStore.getEntry(alias, passwordProtection);
return new KSPrivateKeyEntry(alias, entry);
}
} catch (GeneralSecurityException e) {
throw new DSSException("Unable to retrieve key for alias '" + alias + "'", e);
}
return null;
}
Certificate not present in output and I am not sure, how to use alias for a certificate in a proper way.