Search code examples
node.jssecurityjwtjwe

How to create JWK with node-jose from AES key represented as hex binary


I'm reading a node-jose documentation which explains how to import a JWK key. What I cant understand is how could I import and existing AES key from hexBinary format to create a JWK.Key instance?

For example, this is my AES key represented as hexBinary:

5A611871C939AB2432F0C0552315429D787DF69F7321B4810ED2E4363FF4A036

Solution

  • I solved this. The problem was in the fact that node-jose creates JWE.KEY instance in which the key value is Base64 encoded. So I had to translate my key from hexBinary representation to Base64 encoded representation.