编程语言
首页 > 编程语言> > java查看证书有效期

java查看证书有效期

作者:互联网

public static void main(String[] args) throws  CertificateException, FileNotFoundException {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        FileInputStream in = new  FileInputStream("G://test.cer");
        X509Certificate cert = (X509Certificate) cf.generateCertificate(in);
        Date effDate = cert.getNotBefore();
        Date expDate = cert.getNotAfter();
        System.out.println(effDate);
        System.out.println(expDate);
    }

标签:java,有效期,证书,cf,expDate,cert,CertificateFactory,FileInputStream,out
来源: https://blog.csdn.net/qq_22472619/article/details/121748007