Can i get installed certificate on my system through java

橙三吉。 提交于 2019-12-01 06:19:46

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).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!