Skip to content

Commit

Permalink
KBS: Update KBS protocol to 0.2.0 to fix JWE
Browse files Browse the repository at this point in the history
Fixes confidential-containers#583.

This commit does two things:
1. Fix JWE format to align with RFC 7516.
2. Use more strong algorithm for JWE.

Due to RFC 7516, the JWE AEAD Auth Tag should be expcilitly be included
inside the `tag` part. Before this commit, the tag is actually included
as the suffix of the `ciphertext`.

We fix this by expcilitly extract the tag and include it into the jwe
body.

Also, we fix the AAD calculation logic, s.t. derived from
ProtectedHeader which is also specifiled by RFC7516. This should be
align with the guest-components side.

This commit supports the following JWE algorithms for KBS response:

1. RSA PKCS v1.5 Padding. This algorithm is not recommended but for
compability it is still reserved.
2. RSA OAEP.
3. ECDH-ES-A256KW with curve P256. This is recommended as EC algorithms
are more fast and safe.

which algorithm is used is decided by the TEE public key sent by the
client.

Some more unit tests to test the compability is added to make sure the
algorithm is implemented as standard.

Both change will make the kbs_client not able to connect to the KBS.
Thus we update the KBS protocol version from 0.1.1 to 0.2.0.

Signed-off-by: Xynnn007 <[email protected]>
  • Loading branch information
Xynnn007 committed Dec 19, 2024
1 parent 54dd787 commit e49016a
Show file tree
Hide file tree
Showing 6 changed files with 774 additions and 353 deletions.
Loading

0 comments on commit e49016a

Please sign in to comment.