使用节点创建 CA
这是使用OpenSSL创建证书的方法OpenSSL证书颁发机构
我试过用 pem
这是我关闭的问题无法从私钥创建 CSR #244 GitHub
当我尝试生成 CSR 时
var csrOptions = {
clientKey: '/root/ca/intermediate/private/client.key.pem',
clientKeyPassword: '123456',
hash: 'sha256',
country: 'US',
state: 'California',
locality: 'Mountain View',
organization: 'Alice Ltd',
organizationUnit: 'Alice Ltd Web Services',
commonName: 'pass:client',
}
pem.createCSR( csrOptions , function(err, csr) {
if (err) {
throw err
} else {
console.log(csr.clientKey)
console.log(csr.csr)
}
});
我收到此错误
/root/sslnode/index2.js:37
投掷错误^
% openssl req -new -sha256 -config/root/ca/intermediate/openssl.cnf -key/tmp/54f976cb9cbd0e2dd53b755badb6e6e3fe2256ad -passin file:/tmp/3f4640f1d95ca955f1c44c7f2c4b729347813a5f
无法加载私钥140563986715072:错误:0906D06C:PEM 例程:PEM_read_bio:无开始>行:../crypto/pem/pem_lib.c:691:期望:任何私钥
后出现错误,clientKey 将键作为字符串,而不是路径
clientKey: '/root/ca/intermediate/private/client.key.pem',
clientKey: fs.readFileSync('/root/ca/intermediate/private/client.key.pem'),