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.

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