J'ai une instance expresse et un pfx non crypté qui contient mon cert et une clé privée cryptée. Quand je charge le pfx dans express, je n'ai pas besoin de fournir un mot de passe, et cela fonctionne. Comment l'instance node.js accède-t-elle à la clé privée? Est-ce que l'accès à la clé privée non cryptée nécessaire pour que https fonctionne?Express Can Utiliser un fichier .pfx avec une clé privée cryptée sans le mot de passe de la clé privée
Code express:
var httpsOptions = {
'pfx': fs.readfileSync('./cert.pfx'),
'passphrase': ''
};
https.createServer(httpsOptions, expressApp).listen(443, 'example.com');
Mes infos .pfx de OpenSSL se présente comme suit:
openssl pkcs12 -in cert.pfx -info
MAC Iteration 2048
MAC verified OK
PKCS7 Encrypted data: XXXXXXXXXXXX, Iteration 2048
Certificate bag
Bag Attributes
localKeyID: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
subject=/OU=Domain Control Validated/CN=*.example.com
issuer=/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com,
Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure
Certificate Authority - G2
-----BEGIN CERTIFICATE-----
XXXXXXXXXXX=
-----END CERTIFICATE-----
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2048
Bag Attributes
localKeyID: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
Key Attributes: <No Attributes>
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,XXXXXXXXXXX
XXXXXXXXXXXXXXXX==
-----END RSA PRIVATE KEY-----