However, tpm2-openssl seems to always look for an explicit definition to be present to trigger userAuath (i.,e it must be present with a zero value for the BOOLEAN ). If this provider doens't see the field at all, it proceeds if it no userAuth is rquired.
unfortuantely, I don't have a 'direct' line in code to cite to back this claim up but i can show it emperically with a utility i wrowup here. With that you can generate akey with user auth with
go run cmd/main.go --alg=rsa --out=private.pem --password=foo`
## you'll see emptyAuth is omitted
### then using this provider, it looks like its suggests auth isn't rquired
openssl asn1parse -inform PEM -in private.pem
$ echo -n "bar" > tmp/data.in.raw
$ openssl pkeyutl -provider tpm2 -provider default -inkey private.pem -passin pass:foo -sign -rawin -in /tmp/data.in.raw -out /tmp/data.out.signed
WARNING:esys:src/tss2-esys/api/Esys_Sign.c:314:Esys_Sign_Finish() Received TPM Error
ERROR:esys:src/tss2-esys/api/Esys_Sign.c:108:Esys_Sign() Esys Finish ErrorCode (0x0000098e)
Public Key operation error
40A7649AFB7F0000:error:4000000F:tpm2::cannot sign::-1:2446 tpm:session(1):the authorization HMAC check failed and DA counter incremented
the underlying library i used there is Foxboron/go-tpm-keyfiles) where if i edited Marshaller to always emit the emtpyAuth field, openssl works fine
the specs here for
emptyAuth
field for PEM encoded tpm keysstates that if the emptyauth field is absent, it should get interpreted as 'required'
userAuth not required (emptyAuth=true) BOOLEAN=[1..255]
userAuth is required (emptyAuth=false) BOOLEAN=0 or not present
However,
tpm2-openssl
seems to always look for an explicit definition to be present to trigger userAuath (i.,e it must be present with a zero value for theBOOLEAN
). If this provider doens't see the field at all, it proceeds if it no userAuth is rquired.unfortuantely, I don't have a 'direct' line in code to cite to back this claim up but i can show it emperically with a utility i wrowup here. With that you can generate akey with user auth with
the underlying library i used there is Foxboron/go-tpm-keyfiles) where if i edited Marshaller to always emit the emtpyAuth field, openssl works fine