getName(String format)
的{{1}}方法的Javadoc:
使用返回X.500专有名称的字符串表示形式 指定的格式。格式的有效值为“RFC1779”, “RFC2253”和“CANONICAL”(不区分大小写)。
我的证书中有X500Principal
类型的属性。我尝试了上面的三种格式,它们都没有给我E
的值。例如:
E
给我以下输出:
1.2.840.113549.1.9.1 = blah,cn = John Smith,2.5.4.5 = blah,2.5.4.4 = blah,2.5.4.42 = blah,2.5.4.12 = blah,1.2.840.113549.1.9.2 = blah,ou = blah blah,ou = blah,ou = 1234567,ou = blah,o = org,l = ll,st = st,c = cc
如何获取属性java.security.cert.X509Certificate certs[] =(java.security.cert.X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate");
javax.security.auth.x500.X500Principal subjectDN = certs[0].getSubjectX500Principal();
subjectDN.getName("CANONICAL");
的值?