How to use the kem function from node-forge
Find comprehensive JavaScript node-forge.kem code examples handpicked from public code repositorys.
71 72 73 74 75 76 77 78 79 80
const publicKey = toPem.publicKeyFromPem(pemPublicKey); // Use RSA-KEM to encrypt the msg with a randomly // generated one time password and AES-256 const kdf1 = new forge.kem.kdf1(forge.md.sha256.create()); const kem = forge.kem.rsa.create(kdf1); const otp = kem.encrypt(publicKey, 32); const iv = forge.random.getBytesSync(12); const cipher = forge.cipher.createCipher('AES-GCM', otp.key); let aesCipherText;
1
3
1
+ 15 other calls in file
node-forge.pki is the most popular function in node-forge (10287 examples)