Java获取.CER证书有效期

1   public static void main(String[] args) throws  CertificateException, FileNotFoundException {
2         CertificateFactory cf = CertificateFactory.getInstance("X.509");
3         FileInputStream in = new  FileInputStream("G://test.cer");
4         X509Certificate cert = (X509Certificate) cf.generateCertificate(in);
5         Date effDate = cert.getNotBefore();
6         Date expDate = cert.getNotAfter();
7         System.out.println(effDate);
8         System.out.println(expDate);
9     }
原文地址:https://www.cnblogs.com/sulishihupan/p/14447130.html