我尝试使用“crypto/x509”包生成CSR,但没有找到将“emailAddress”字段添加到其主题的方法。根据文档CertificateRequest结构有一个“EmailAddresses []string”字段,但它被序列化为 SAN 扩展。这是我使用的测试代码:http : //play.golang.org/p/OtObaTyuTM我还使用“openssl req”程序创建了一个 CSR 并比较了结果:% openssl req -in openssl.csr -noout -textCertificate Request: Data: Version: 0 (0x0) Subject: C=AU, ST=Some-State, L=MyCity, O=Company Ltd, OU=IT, CN=domain.com/emailAddress=test@email.com Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (512 bit) Modulus: 00:a3:05:e3:37:63:f9:8b:d0:37:46:2d:a8:d9:26: 4e:be:83:1d:b9:30:88:2b:80:4b:53:cc:7c:01:86: b0:9b:1d:3b:0a:05:c4:56:47:4e:5d:90:f9:5a:29: 8b:9a:7f:fa:4b:5e:e4:5d:dd:c6:8b:87:33:c4:b4: fa:6b:b4:67:bd Exponent: 65537 (0x10001) Attributes: a0:00 Signature Algorithm: sha1WithRSAEncryption 0b:24:6e:0a:f9:bf:23:d7:41:5f:96:da:78:d1:99:18:fb:d6: 71:7e:79:f0:02:e9:8a:50:a9:00:32:df:26:14:2f:f4:3e:c4: 22:c9:5c:4e:79:c1:c2:22:1b:2a:da:79:6f:51:ba:8a:12:63: 27:02:4a:b3:22:97:59:f7:6e:d6=============================================================== % openssl req -in golang.csr -noout -textCertificate Request: Data: Version: 0 (0x0) Subject: C=AU, O=Company Ltd, OU=IT, L=MyCity, ST=Some-State, CN=domain.com Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (512 bit)在哪里:var oidEmailAddress = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}appendRDNs() 在crypto/x509/pkix 中定义(因为它的名字不以大写字母开头,所以默认情况下不导出。您可以使用copy&paste 再次将其定义为您自己的函数)。
3 回答
- 3 回答
- 0 关注
- 253 浏览
添加回答
举报
0/150
提交
取消