得到“ERR_CRYPTO_INVALID_IV”。为什么?
Got “ERR_CRYPTO_INVALID_IV.” Why?
我做错了什么?这是 Node.js 16.1.0.
> crypto.createCipheriv("AES-128-CTR", Buffer.allocUnsafe(16), Buffer.allocUnsafe(16));
Cipheriv {…}
> crypto.createCipheriv("AES-128-OCB", Buffer.allocUnsafe(16), Buffer.allocUnsafe(16));
Uncaught TypeError: Invalid initialization vector
at Cipheriv.createCipherBase (node:internal/crypto/cipher:119:19)
at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:138:3)
at new Cipheriv (node:internal/crypto/cipher:246:3)
at Object.createCipheriv (node:crypto:131:10) {
code: 'ERR_CRYPTO_INVALID_IV'
}
OCB模式的初始向量应该是12个八位字节; 96位,即。
我做错了什么?这是 Node.js 16.1.0.
> crypto.createCipheriv("AES-128-CTR", Buffer.allocUnsafe(16), Buffer.allocUnsafe(16));
Cipheriv {…}
> crypto.createCipheriv("AES-128-OCB", Buffer.allocUnsafe(16), Buffer.allocUnsafe(16));
Uncaught TypeError: Invalid initialization vector
at Cipheriv.createCipherBase (node:internal/crypto/cipher:119:19)
at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:138:3)
at new Cipheriv (node:internal/crypto/cipher:246:3)
at Object.createCipheriv (node:crypto:131:10) {
code: 'ERR_CRYPTO_INVALID_IV'
}
OCB模式的初始向量应该是12个八位字节; 96位,即。