I'm running a simple PKI web application in Php that uses OpenSSL shell commands and stores information in a text database. I have to deal with non-ASCII input characters (eg. German) but when a new cert is created, the fields turn into
[...] /C=DE/ST=H\xC3\xA4mburg/L=H\xC3\xA4mburg/O=\xC3\x9FBCD/OU=\xC3\xA4BC/ [...]
[req] utf8 = yes string_mask = utf8only name_opt = multiline,-esc_msb,utf8
to the OpenSSL config files, and the certs are created using
openssl req -utf8 [...] openssl ca -utf8 [...]
The program writes out temporary config files used to request and create the user cert. I've checked and the fields in the user config file are fine, as well as in the CA's. The problem appears when OpenSSL creates the certificates. The database and the certs contain these codes instead of the correct characters.
I also tried to convert the database file to UTF-8 using
iconv but the file remains in US-ASCII format. This approach changes what
file --mime-encoding outputs to utf-8, but OpenSSL continues to write new entries the same way as before.
I'll also mention I'm sending the utf-8 header and setting
AddDefaultCharset utf-8 in virtualhosts. The locale is set to
de_DE.utf8 in the code and on the server.
What am I missing? Any help is appreciated.