sharplispers / ironclad

A cryptographic toolkit written in Common Lisp
BSD 3-Clause "New" or "Revised" License
166 stars 28 forks source link

Retrieving the `key` from MAC? #59

Closed dnaeon closed 1 year ago

dnaeon commented 1 year ago

Hey there,

I'm currently working on a new system for decoding and encoding JSON Web Keys (JWK).

In order to encode a symmetric key back to a JWK format, I need to access the internal MAC key, which I don't see it being exposed in ironclad.

For example:

(make-mac :hmac key digest-name)

Once I get the instance from MAKE-MAC, is there a way to get it back? Or should I just keep the key around when I need it?

Thanks!

References:

glv2 commented 1 year ago

When creating a HMAC, the provided key is processed (padded, hashed, etc) when the hmac class is instanciated, but it is not kept as-is in any slot after that. So it's not possible to recover the key from the hmac object.

dnaeon commented 1 year ago

Got it, thanks @glv2 !