- Krypton is a JavaScript class with Symmetric (asynchronous and synchronous) and Asymmetric encryption and decryption methods. Cipher is configured to use AES-256-CBC with initialization vector.
npm install Krypton-js
const { Krypton } = require("krypton-js")
let Krypton = new Krypton(encryptionFileName, Password)
Krypton.encrypt(data)
data = Krypton.decrypt()
Krypton.encryptAsync(data).then(result=>{ ... })
// Result = { message: "Encrypted!" }
Krypton.decryptAsync(data).then(decryptedData=>{ ... })
//
encrypted_data = Krypton.encryptWithRSAPrivateKey( client_request, privateKey )
decrypted_data = Krypton.decryptWithRSAPublicKey(encrypted_data, pubKey)
encrypted_data = Krypton.encryptWithRSAPublicKey(server_response, pubKey)
decrypted_data = Krypton.decryptWithRSAPrivateKey(encrypted_data, privateKey)
1. ssh-keygen -t rsa
2. openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
npm install
npm run test
istanbul cover test
Check coverage folder