我正在尝试使用UTF-8主题生成证书签名请求。如何在openssl中使用utf8主题创建CSR?
$ openssl req -utf8 -nodes -newkey rsa:2048 -keyout my.private_key.pem -out my.csr.pem -text
Generating a 2048 bit RSA private key
......................................................................................................................................................................+++
......+++
writing new private key to 'my.private_key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [PL]:
State or Province Name (full name) []:Zażółć gęślą jaźń
problems making Certificate Request
12376:error:0D07A07C:asn1 encoding routines:ASN1_mbstring_ncopy:illegal characters:a_mbstr.c:162:
终端编码是UTF-8,I得到了同样的问题,当我使用命令行受试者 (...) -subj /C=PL/ST=zażółć\ gęślą\ jaźń/O=my-company/CN=ThisIsMeForSure
当我跳过-utf8
开关,CSR与替换所有的非ASCII字符产生用十六进制符号(例如ó
变成\xC3\xB3
)。这样的CSR无法用php(openss_x509_parse
)正确读取 - 原始的ó
被读为四个字节,代表两个奇怪的字符...
我在做什么错?
使用'openssl req' * *没有*自定义conf文件意味着服务器名称将在'CN'中。 IETF和CA/B论坛都不赞成这种做法。相反,你应该确保服务器名称(和IP地址)在'SAN'中。例如,请参阅[如何使用openssl创建自签名证书?](http://stackoverflow.com/a/27931596)(答案用于签署请求和自签名证书)。并且在配置文件中设置了'string_mask = utf8only'。 – jww 2015-04-15 12:07:56