Convert a PEM-formatted String to a java.security.cert.X509Certificate

前端 未结 5 689
再見小時候
再見小時候 2020-12-24 12:57

How does one create a java.security.cert.X509Certificate instance from a PEM-formatted String? The PEM-formatted String is a HTTP request \"SSL_CLIENT_CERT\" h

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-24 13:20

    Decode the Base64 to binary, with some InputStream reading it, then try

    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    Certificate cert = cf.generateCertificate(is);
    

提交回复
热议问题