You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
390 B
19 lines
390 B
3 years ago
|
const crypto = require('crypto')
|
||
|
function genNewPrivKey(callback){
|
||
|
crypto.generateKeyPair('rsa', {
|
||
|
modulusLength: 4096,
|
||
|
publicKeyEncoding: {
|
||
|
type: 'spki',
|
||
|
format: 'pem'
|
||
|
},
|
||
|
privateKeyEncoding: {
|
||
|
type: 'pkcs8',
|
||
|
format: 'pem',
|
||
|
}
|
||
|
}, callback)
|
||
|
}
|
||
|
|
||
|
genNewPrivKey((err, pubkey, privkey) => {
|
||
|
console.log(privkey)
|
||
|
})
|