hidekatsu-izuno / josekit-rs

JOSE (Javascript Object Signing and Encryption) library for Rust (based on OpenSSL).
Apache License 2.0
74 stars 31 forks source link

Add '.' when ADD value is present #4

Closed arronwy closed 3 years ago

arronwy commented 3 years ago

To compatiable with golang https://pkg.go.dev/gopkg.in/square/go-jose.v2

hidekatsu-izuno commented 3 years ago

Thank you for your request. I checked the spec and it looks like you are right.

The RFC7516 says:

   14.  Let the Additional Authenticated Data encryption parameter be
        ASCII(Encoded Protected Header).  However, if a JWE AAD value is
        present (which can only be the case when using the JWE JSON
        Serialization), instead let the Additional Authenticated Data
        encryption parameter be ASCII(Encoded Protected Header || '.' ||
        BASE64URL(JWE AAD)).

I'm going to merge and release a new version.