解決思路:code
代碼以下:get
// 取證書 Base64 String cert = request.getHeader("SSLClientCERT"); String certBase64 = cert.replaceAll(X509Factory.BEGIN_CERT, "").replaceAll(X509Factory.END_CERT, ""); byte[] certByte = Base64.decodeBase64(certBase64); ByteArrayInputStream is = new ByteArrayInputStream(certByte); CertificateFactory cf = CertificateFactory.getInstance("X.509"); // 生成X509證書 X509Certificate certFile = (X509Certificate) cf.generateCertificate(is); // 獲取使用者 String name = certFile.getSubjectDN().getName();