8 lines
350 B
JavaScript
8 lines
350 B
JavaScript
const crypto = require('crypto');
|
|
const fs = require('fs');
|
|
|
|
let keyPair = crypto.generateKeyPairSync('rsa', { modulusLength: 4096 });
|
|
|
|
fs.writeFileSync('../keypair/private.pem', keyPair.privateKey.export({ type: 'pkcs8', format: 'pem' }));
|
|
fs.writeFileSync('../keypair/public.pem', keyPair.publicKey.export({ type: 'spki', format: 'pem' }));
|