I need to generate a CSR key from a private key/cert
When doing this I get an error
openssl_csr_new(): dn: add_entry_by_NID 48 -> (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) test.php(33)
$dn = [
'commonName' => '123@-1552-21',// 'func_id@activationcode',
'organizationalUnitName'=> 'test',
'organizationName' => 'test',
'localityName' => 'DK',
'stateOrProvinceName' => 'DK',
'countryName' => 'DK',
'emailAddress' => ''
];
$csr = [
'private_key_bits' => 2048,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
'encrypt_key' => true
];
$private_key = openssl_pkey_get_private('./1_0010444508001.pem');
$csr = openssl_csr_new($dn, $private_key, [
'digest_alg' => 'sha256'
]);
openssl_csr_export($csr, $csrout);
openssl_pkey_export($private_key, $pkeyout, '');
echo $csrout . "\n" . $pkeyout;
dn
. NID 48 isemailAddress
, thus check this part of dn. – Steffen UllrichemailAddress
can't be empty.. create an answer :) – clarkk