Unable to get certs from Windows Store

32 views Asked by At

We are reading the public key from the Windows Store to use it for signature validation of a JWT token. My application is hosted on Tomcat Server. I am able to read the certificates from the Windows Store when tomcat is run in debug mode (started from commandline). But when the tomcat is run as a local service, it returns an empty list. Below is the code that is used to read the certs.

KeyStore keystore = KeyStore.getInstance("Windows-MY");
keystore.load(null, null);
Certificate certificate = keystore.getCertificate(alias);
X509Certificate cert = (X509Certificate) certificate;

Below is the image of the Windows store having 2 entries. enter image description here

Could anyone please help identify the mistake. Thanks in advance!

0

There are 0 answers