I noticed that instantiating a NewMultiEncrypter does not recognize the extra headers specified in the passed EncrypterOptions. In the following code I would expect the protected header to contain the specified extra header sharedHeader. However, the resulting protected header only contains enc parameter:
var options jose.EncrypterOptions
options.WithHeader("sharedHeader", "some public data")
encrypter, err := jose.NewMultiEncrypter(jose.A256GCM, recipients, &options)
if err != nil {
return "", err
}
jwe, err := encrypter.Encrypt([]byte("confidential data"))
if err != nil {
return "", err
}
fmt.Println(jwe.FullSerialize())
A possible solution would simply set the extra header when instantiating a NewMultiEncrypter.
Instead of:
Dear go-jose Team,
I noticed that instantiating a
NewMultiEncrypter
does not recognize the extra headers specified in the passedEncrypterOptions
. In the following code I would expect the protected header to contain the specified extra headersharedHeader
. However, the resulting protected header only containsenc
parameter:A possible solution would simply set the extra header when instantiating a
NewMultiEncrypter
. Instead of:This would work:
Am I something missing here? I require this functionality to produce tokens which are compatible with the Python library
jwcrypto
(https://pypi.org/project/jwcrypto/) and the JS libraryjose
(https://www.npmjs.com/package/jose).Thanks for your help :-)