Closed cryptofuture closed 6 years ago
I have exception Uncaught Exception...RangeError: private key length is invalid from
Uncaught Exception...RangeError: private key length is invalid
exports.isBufferLength = function (buffer, length, message) { if (buffer.length !== length) throw RangeError(message) }
<Buffer 83 8b f2 6b d6 35 85 cd 25 b7 c7 8c 3c 7d ed fe 29 b7 de 72 d7 6c 8c c2 ca 76 b9 72 ff c7 44 2e> Code:
<Buffer 83 8b f2 6b d6 35 85 cd 25 b7 c7 8c 3c 7d ed fe 29 b7 de 72 d7 6c 8c c2 ca 76 b9 72 ff c7 44 2e>
let privateKey = "838bf26bd63585cd25b7c78c3c7dedfe29b7de72d76c8cc2ca76b972ffc7442e"; var params = { keyBytes: 32, ivBytes: 16 }; let password = "1"; var options = { kdf: "scrypt", cipher: "aes-128-ctr", kdfparams: { n: 262144, dklen: 32, p:1, r:8 } }; var dk = keythereum.create(params); //var nullBuff = new Buffer ([0x00]); //dk.privateKey = Buffer.concat([nullBuff, privateKey]); dk.privateKey = new Buffer(privateKey); keythereum.dump(password, dk.privateKey, dk.salt, dk.iv, options, function (keyObject) { keythereum.exportToFile(keyObject); });
In case when I empty if blocks in RangeError in assert.js, I getting privatekey is incorrect. I tried with like 5 private keys already.
assert.js
privatekey is incorrect
I have exception
Uncaught Exception...RangeError: private key length is invalid
from<Buffer 83 8b f2 6b d6 35 85 cd 25 b7 c7 8c 3c 7d ed fe 29 b7 de 72 d7 6c 8c c2 ca 76 b9 72 ff c7 44 2e>
Code:In case when I empty if blocks in RangeError in
assert.js
, I gettingprivatekey is incorrect
. I tried with like 5 private keys already.