-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.
Description
- version: v.6.1.0
- platforms:
- 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
- Linux 3.13.0-29-generic # 53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
- module affected: crypto
Basic failing example:
const iv = crypto.randomBytes(16);
const salt = "foobar";
const hash = crypto.createHash("sha1");
hash.update(salt);
let key = hash.digest("binary");
key = key.substring(0, 16);
key.length // 16
const cipher = crypto.createCipheriv('aes-128-cbc', key, iv); //uncaughtException: Invalid key length Passing in a binary encoded string with a length of 16 causes the last line to throw. Adding more or removing bytes has no effect.
Passing a utf8 encoded line with a length of 16 doesn't throw.
This behaviour showed up with Node v6 (v5 worked fine).
zhongdeming428 and instantleves
Metadata
Metadata
Assignees
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.