如何确定小程序是否已签名并显示证书的提供者,例如Digicert 和证书的到期日期

How to determine if an Applet is Signed and display the provider of the certificate e.g. Digicert and the expiry date of the certificate

我想检查 Jar 文件是否已签名,响应应 return 以下详细信息

  1. 证书文件提供者,例如受信任的 CA、Digicert、诺顿等
  2. 签名的到期日期(如果有)
  3. 签署日期
  4. 小程序是否自签名

如何实现?

  1. 通过Class.getProtectionDomain().getCodeSource()获取CodeSource
  2. 获取证书链。
  3. 如果存在,则 JAR 已签名。
  4. 如果长度为 1,则证书是自签名的。
  5. 它由出现在链中第一个证书的 IssuerDN 中的任何人签名。
  6. 有效日期在证书中。