How to use the aes function from node-forge
Find comprehensive JavaScript node-forge.aes code examples handpicked from public code repositorys.
GitHub: mitro-co/keyczarjs
229 230 231 232 233 234 235 236 237 238
var key = keyczar_util.decodeBase64Url(data.key); var derivedKey = _deriveKey(password, salt, data.iterationCount); // decrypt the key with the derived key var cipher = forge.aes.startDecrypting(derivedKey, iv, null); cipher.update(new forge.util.ByteBuffer(key)); var success = cipher.finish(); if (!success) { throw new Error(PBE_DECRYPT_FAILED_MESSAGE);
17
38
9
+ 3 other calls in file
GitHub: y-kkky/dotfiles
257 258 259 260 261 262 263 264 265 266
var iterationCount = _DEFAULT_ITERATIONS; var salt = forge.random.getBytes(_SALT_BYTES); var derivedKey = _deriveKey(password, salt, iterationCount); var iv = forge.random.getBytes(_PBE_AES_KEY_BYTES); var cipher = forge.aes.startEncrypting(derivedKey, iv, null); cipher.update(new forge.util.ByteBuffer(keyString)); var success = cipher.finish(); if (!success) { throw new Error('AES encryption failed');
0
0
0
GitHub: y-kkky/dotfiles
379 380 381 382 383 384 385 386 387 388 389 390
return keyczar_util._aesFromBytes(keyBytes, hmacBytes); }; keyczar_util._aesFromBytes = function(keyBytes, hmacBytes) { var aesObject = forge.aes.createEncryptionCipher(keyBytes); var mdObject = forge.md.sha1.create(); var hmacObject = forge.hmac.create(); hmacObject.start(mdObject, hmacBytes);
0
0
0
+ 5 other calls in file
node-forge.pki is the most popular function in node-forge (10287 examples)