Skip to content

JWE verification is valid after providing secret key as Buffer with an invalid string | Node.js #452

Answered by panva
Gleb-Gaiduk asked this question in Q&A
Discussion options

You must be logged in to vote
> Buffer.alloc(32, 'djsakldjlsakjdasjkdjsalkdjlskajdlksjdsadjklsajdksajldksa')
<Buffer 64 6a 73 61 6b 6c 64 6a 6c 73 61 6b 6a 64 61 73 6a 6b 64 6a 73 61 6c 6b 64 6a 6c 73 6b 61 6a 64>
> Buffer.alloc(32, 'djsakldjlsakjdasjkdjsalkdjlskajdlksjdsadjklsajdksajldksafhjdshfjkdshfjksa')
<Buffer 64 6a 73 61 6b 6c 64 6a 6c 73 61 6b 6a 64 61 73 6a 6b 64 6a 73 61 6c 6b 64 6a 6c 73 6b 61 6a 64>

Notice the same buffer comes out.

What you want to do is e.g.

Buffer.from('059bde05519b5a8098f1007fc8dd28ad223378a997ed3750edfb0895859ee18d', 'hex')

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Gleb-Gaiduk
Comment options

@panva
Comment options

@Gleb-Gaiduk
Comment options

Answer selected by Gleb-Gaiduk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants