JWE encryption with TPM sealed encryption key metadata #1540
Replies: 1 comment
-
|
ok, its a private header like this https://datatracker.ietf.org/doc/html/rfc7516#page-15 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hi-
i'm new to using this specific library and wanted to get some thoughts around the proper way to incorporate TPM based keys with JWE.
The general idea is that if i'm on a VM with a trusted platform module (TPM), i can use it to
sealsome small bit of data into a TPM object and represent that as PEM file (for example). Then if i wanted to unseal the data, i can only do that on that same TPM.to combine that with what i understand are the constructs in this library and JWE, i'd do the following:
so you'll end up with something like this
{ "ciphertext": "TYqD60p17tRbMvQ", "encrypted_key": "eg_w8gT48w-X7DjAU_fXtvG8uBzXz91rSP3HZYEF33lq6UJcIl7qvA", "header": { "alg": "A128KW", "tpm_key": "-----BEGIN TSS2 PRIVATE KEY-----\nbMIICFAYGZ4EFCgEDoAMBAf8CBEAA..." }, "iv": "s0m0ROYSr6mWAm6a", "protected": "eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMjU2R0NNIiwidHBtX2tleSI6Ii0tLS0tQkVHSU4gVFNTMiBQUklWQVRFIEtFWS0tLS0tXG5iTUlJQ0ZBWUdaNEVGQ2dFRG9BTUJBZjhDQkVBQS4uLiJ9", "tag": "DXABwL9VADLuamj-ltP3SA" }to decrypt, i'll first extract (unseal) the root key from the
tpm_keyheader and and supply that back to this library...does it seem ok to use the headers like this? Also i used
jwa.A128KW()above but maybe i could also usejwa.DIRECT()the example above uses tpm's seal/unseal capability...there's also a way to do this remotely too (i.,e you can create a JWE intended for a remote system which can only get decrypted there)....its basically this: https://github.com/salrashid123/go-tpm-wrapping (you can also transfer arbitrary keys in pem format too (tpmcopy)
fwiw, on the topic of TPM, it seems you can 'just supply' a
crypto.Signerpointing to a TPM object outright, see exampleBeta Was this translation helpful? Give feedback.
All reactions