cordis/server/scripts/create-keypair.js
2021-10-30 12:26:41 -05:00

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' }));