-
Notifications
You must be signed in to change notification settings - Fork 2
During Azure vTPM attestation verification, parse potentially several intermediaries from AK cert chain #48
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -297,7 +297,7 @@ fn finish_azure_attestation_verification( | |
| let (_type_label, ak_certificate_der) = | ||
| pem_rfc7468::decode_vec(tpm_attestation.ak_certificate_pem.as_bytes())?; | ||
|
|
||
| let (remaining_bytes, ak_certificate) = X509Certificate::from_der(&ak_certificate_der)?; | ||
| let (_, ak_certificate) = X509Certificate::from_der(&ak_certificate_der)?; | ||
|
|
||
| // Check that AK public key matches that from TPM quote and HCL claims | ||
| let ak_from_certificate = RsaPubKey::from_certificate(&ak_certificate)?; | ||
|
|
@@ -309,12 +309,8 @@ fn finish_azure_attestation_verification( | |
| return Err(MaaError::AkFromClaimsNotEqualAkFromCertificate); | ||
| } | ||
|
|
||
| // Strip trailing data from AK certificate | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was (i think) the issue - here we are potentially discarding intermediary certs which are needed for verification. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think you are discarding them. Afaict they aren't there in the first place. At least they weren't in my NV reponse. That's why in your link they mention "The AIA mechanism is the supported and expected way to validate the certificate hierarchy." They want you to fetch the certs dynamically from the URLs embedded in the leaf AK cert. |
||
| let leaf_len = ak_certificate_der.len() - remaining_bytes.len(); | ||
| let ak_certificate_der_without_trailing_data = &ak_certificate_der[..leaf_len]; | ||
|
|
||
| // Verify the AK certificate against microsoft root cert | ||
| verify_ak_cert_with_azure_roots(ak_certificate_der_without_trailing_data, now)?; | ||
| verify_ak_cert_with_azure_roots(&ak_certificate_der, now)?; | ||
|
|
||
| Ok(MultiMeasurements::from_pcrs(pcrs)) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure if we should still be always adding this hard coded intermediary.