I'm trying to use node-jose to create a JWE. I don't know why I am unable to create a JWE token with A256GCM algorithm. I have a code that works, but as soon as I uncomment the algorithm specification line alg: 'A256GCM'
, it stops working. How could I fix this?
This is a working code with a problematic line commented out:
jose.JWK.asKeyStore([{
kid: 'mykey',
kty: 'oct',
k: '5A611871C939AB2432F0C0552315429D787DF69F7321B4810ED2E4363FF4A036',
//alg: 'A256GCM',
use: 'enc'
}]).then(ks => {
var key = ks.get('mykey');
jose.JWE.createEncrypt({
format: 'compact'
}, {
key: key,
header: {
alg: 'dir'
}
}).update("proba").final().then(ejwt => {
console.log(`ejwt = ${ejwt}`)
jose.JWE.createDecrypt(ks.get('mykey')).decrypt(ejwt).then(djwt => {
console.log(JSON.stringify(djwt, null, " "))
})
})
})
The error message says:
unsupported algorithm