Foxboron / go-tpm-keyfiles

TPM 2.0 TSS keyfile library
https://www.hansenpartnership.com/draft-bottomley-tpm2-keys.html
MIT License
9 stars 1 forks source link

More openssl3 compatibility issues #3

Open salrashid123 opened 1 month ago

salrashid123 commented 1 month ago

hi,

is is really an FYI and not a bug for this library but i thought i'd mention it since it plays into cross-compatilbility with openssl (and incase i cited something incorrect in the following bugs)

basically, the description field ins't implemented in openssl and fails outright if its present. The emptyAuth one is a bit confusing but it seems if its not present, its interepreted there 'no userauth'

the library here is doning precisely what its supposed to do but i think openssl isn't strictly following the updated specs.

For the userauth one, i verified it by editing this library's go-tpm-keyfiles/der.go to always emit the field and it works just fine with openssl

func Marshal(key *TPMKey) []byte {
    var b cryptobyte.Builder

    b.AddASN1(asn1.SEQUENCE, func(b *cryptobyte.Builder) {

        b.AddASN1ObjectIdentifier(key.Keytype)

        b.AddASN1(asn1.Tag(0).ContextSpecific().Constructed(), func(b *cryptobyte.Builder) {
            b.AddASN1Boolean(key.EmptyAuth)
        })

finally, i wrapped this library into a small cli of alpha qualtiy tpm2genkey if interested

Foxboron commented 1 month ago

Thanks for the FYI :)

finally, i wrapped this library into a small cli of alpha qualtiy tpm2genkey if interested

Cool, thanks! I was contemplating writing something myself but it wound up on the backburner :)

I have sealed keys on my todo still, but should not be very hard to implement.