I use the code below to get certificate from personal keystore in java but the statement ksp.load(null,null) takes 14 seconds to execute which I am not able to figure out why and how I can reduce it. I am able to sign the pdf document with the certificate but the whole process takes 1 minute which I wanted to be 1 sec.
SunMSCAPI SunProvider=new SunMSCAPI();
Security.addProvider(SunProvider);
KeyStore ksp = KeyStore.getInstance("Windows-MY");
ksp.load(null,null);
java.security.cert.Certificate[] chain = ksp.getCertificateChain(certName);