Use ASN.1 format to store TPM child key#31131
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #31131 +/- ##
==========================================
+ Coverage 64.01% 64.04% +0.02%
==========================================
Files 1905 1905
Lines 187633 187578 -55
Branches 5415 5415
==========================================
+ Hits 120122 120130 +8
+ Misses 58068 58006 -62
+ Partials 9443 9442 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // tpm2Signer implements crypto.Signer using TPM 2.0. | ||
| type tpm2Signer struct { | ||
| tpm transport.TPMCloser | ||
| tpm transport.TPM |
There was a problem hiding this comment.
There was no need for this type to be a Closer.
sgress454
left a comment
There was a problem hiding this comment.
I'm not able to run this (or the tests) because I don't have a compatible system, but it looks good to me based on the docs for github.com/foxboron/go-tpm-keyfiles.
| return fmt.Errorf("write public blob to %s: %w", t.publicBlobPath, err) | ||
| func (t *tpm2TEE) saveTPMKeyFile(privateKey tpm2.TPM2BPrivate, publicKey tpm2.TPM2BPublic) error { | ||
| k := keyfile.NewTPMKey( | ||
| keyfile.OIDOldLoadableKey, |
There was a problem hiding this comment.
You probably want keyfile.OIDLoadableKey here. I realize now that the README.md example is using the wrong OID.
There was a problem hiding this comment.
Oh thank you! I totally missed the "Old" part there.
And double thanks for catching this before our agent release :)
See #31131 (review). Thanks @Foxboron!
See #31131 (review). Thanks @Foxboron!
#31047
We were storing public key bytes and encrypted private key bytes as raw files called
tpm_cms_pub.blobandtpm_cms_priv.blobrespectively. This PR changes to use a better format on a single file that looks like this:(We haven't released this feature yet so we don't need a migration.)