我正在尝试使用 UTF-8 主题生成证书签名请求。
$ 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,当我使用命令行主题时遇到同样的问题
(...) -subj /C=PL/ST=zażółć\ gęślą\ jaźń/O=my-company/CN=ThisIsMeForSure
当我跳过-utf8
开关时,生成的 CSR 将所有非 ascii 字符替换为十六进制表示法(例如ó
变为\xC3\xB3
)。这样的 CSR 不能用 php ( openss_x509_parse
) 正确读取 - 原始ó
被读取为四个字节,代表两个奇怪的字符......
我究竟做错了什么?