Programmatically getting Certificate Details
I have a self-signed JAR file. I would like for it to be able to:
开发者_运维问答- Check if it is signed;
- Get and output the details of the certificate it was signed with.
The jar does not need to check or verify the certificate with a server.
Any help would be appreciated. Thanks! :)
Use CodeSource#getCertificates()
.
Certificate[] certificates = YourClass.class.getProtectionDomain().getCodeSource().getCertificates();
精彩评论