GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — crypto.Decipher.update errors when inputEncoding is provided and data is a Buffer · Issue #31751 · nodejs/node Closed Closed Copy link Description
What steps will reproduce the bug?Creating a piece of content to encrypt with an odd length, encrypting it using cipher then calling decipher.update with a buffer containing the encrypted value and 'hex' as the inputEncoding will reproduce the error. How often does it reproduce? Is there a required condition?Should be consistently reproducible with the above code What is the expected behavior?The docs for Decipher.update state that inputEncoding should be ignored when the data argument is a Buffer: The input encoding is instead being validated and failing validation. If the inputEncoding is provided as null in the example above, decryption happens correctly. The above code snippet should log out 'the content to be encrypted seems to need to be an odd length to reproduce the issue correctly.' What do you see instead?internal/validators.js:153 TypeError [ERR_INVALID_ARG_VALUE]: The argument 'encoding' is invalid for data of length 95. Received 'hex' Additional informationThis works properly in all versions of node I've tried prior to 13 (tried 10 and 12). It seems to be caused by the addition of the validateEncoding call to the Cipher.prototype.update function in internal/crypto/cipher.js without any check for whether the data provided is a Buffer or not, but I'm not sure if the docs were meant to change, or if the possibility of a Buffer being provided was overlooked when that call was added. Activity
|
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |