Can i get installed certificates on my system through java
something like this Eg. Certificate[] certificate = someClass.getsystemCertificates();
Is there is some api available for this????
Can i get installed certificates on my system through java
something like this Eg. Certificate[] certificate = someClass.getsystemCertificates();
Is there is some api available for this????
You can use the keytool
command to get the list of certificates in your cacerts file, which is the collection of approved certificates that Java comes with. The default password for this keystore is "changeit".
keytool -list -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit
This depends on the system. Windows has centralized certificate storage, while other platforms don't (at least, no uniform one). So querying system certificates is platform-specific. And as it is, it would be wise to look for JNI to platform-specific API for doing what you need.
I guess there must be some class already available for Windows (most likely working via JNI), but I never saw one. I'd be interested in such solution too (for specific purposes where JNI can't be used).