Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TPMKMS implementation #253

Merged
merged 41 commits into from
Jun 7, 2023
Merged

Add TPMKMS implementation #253

merged 41 commits into from
Jun 7, 2023

Conversation

hslatman
Copy link
Member

@hslatman hslatman commented Jun 5, 2023

This PR adds a KMS implementation backed by a TPM. It uses our tpm package and its storage methods for its core operations. It uses URIs similar to the format used by PKCS11 to address / configure (attestation) keys.

The TPMKMS implementation supports attestation through configuration of the attestation CA to use when instantiating the KMS instance. This configuration is provided through an URI too. A default client implementation is provided that interacts with the Smallstep Attestation CA. A custom implementation can be provided through the AttestationClient interface.

As a bonus, this PR includes an io.Reader implementation backed by the tpm package to make a TPM generate random data.

@hslatman hslatman marked this pull request as ready for review June 5, 2023 16:36
@hslatman hslatman requested a review from maraino June 5, 2023 16:41
@hslatman hslatman requested a review from maraino June 7, 2023 00:27
kms/tpmkms/tpmkms.go Outdated Show resolved Hide resolved
kms/tpmkms/tpmkms.go Show resolved Hide resolved
kms/tpmkms/tpmkms.go Show resolved Hide resolved
tpm/attestation/client.go Outdated Show resolved Hide resolved
tpm/rand/rand.go Outdated Show resolved Hide resolved
@hslatman hslatman requested a review from maraino June 7, 2023 11:06
When CreateAttestation is used with the TPMKMS, the existing
CertificationParameters are required to be returned, so that
they can be used within an application. The certification facts
are recorded at the time of key attestation.
kms/apiv1/options.go Show resolved Hide resolved
tpm/rand/rand.go Outdated Show resolved Hide resolved
maraino
maraino previously approved these changes Jun 7, 2023
Copy link
Contributor

@maraino maraino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a couple of comments, if you're ok with them, I am ok. It will also be good to send to codecov the coverage with the simulator.

kms/tpmkms/tpmkms.go Show resolved Hide resolved
@hslatman
Copy link
Member Author

hslatman commented Jun 7, 2023

I've added a couple of comments, if you're ok with them, I am ok. It will also be good to send to codecov the coverage with the simulator.

I thought I already added coverage reporting through combining the results from multiple tests runs, but maybe this typo resulted in it not working as expected: c2407d1. And now also include kms/tpmkms: b2dc92c.

@maraino maraino self-requested a review June 7, 2023 21:04
maraino
maraino previously approved these changes Jun 7, 2023
@hslatman hslatman merged commit 541f830 into master Jun 7, 2023
12 of 13 checks passed
@hslatman hslatman deleted the herman/tpmkms branch June 7, 2023 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants