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.
18 lines
390 B
18 lines
390 B
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) |
|
})
|
|
|