Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_CRYPTO_INVALID_KEYLEN #92

Closed
ivanbacher opened this issue Apr 23, 2024 · 1 comment · Fixed by #93
Closed

ERR_CRYPTO_INVALID_KEYLEN #92

ivanbacher opened this issue Apr 23, 2024 · 1 comment · Fixed by #93
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@ivanbacher
Copy link

ivanbacher commented Apr 23, 2024

Whats the correct secret length to use?


const mtOptions = {
  uri: uri,
  encrypt: true,
  secret: ...
}
RangeError: Invalid key length
   ...
   ) {
  code: 'ERR_CRYPTO_INVALID_KEYLEN'
}
@boly38 boly38 added the question Further information is requested label Apr 23, 2024
@boly38 boly38 self-assigned this Apr 23, 2024
@boly38
Copy link
Owner

boly38 commented Apr 23, 2024

Hi @ivanbacher and thanks for your question,
my side I'm using MT_SECRET: size 32
I'll dig that ant improve doc/feedback 👍


EDIT: used by crypto.createCipheriv (secretKey) --> nodejs doc key

And as the algorithm used is aes-256-ctrthen the key must be 32 bytes length

boly38 added a commit that referenced this issue Apr 23, 2024
@boly38 boly38 added documentation Improvements or additions to documentation enhancement New feature or request and removed question Further information is requested labels Apr 24, 2024
boly38 added a commit that referenced this issue Apr 25, 2024
@boly38 boly38 added this to the v2.2.6 milestone Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants