Skip to content

Conversation

@neha-gunta
Copy link

Add certificate parser to parse x509 Certificate to EK Certificate.
The standard fields are validated by referencing the TCG EK Credential Profile.

var tpmManufacturer, tpmModel, tpmVersion string
for _, attr := range name.Names {
if attr.Type.Equal(oid.TPMManufacturer) {
tpmManufacturer = fmt.Sprintf("%v", attr.Value)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the reason for using fmt.Sprintf vs asn1.Unmarshal()?
The later returns an error so I think it is more robust.

Copy link
Collaborator

@liamjm liamjm left a comment

Choose a reason for hiding this comment

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

I didn't see any handling of TPM Security Assertions (Section 3.1.1 from the EK Credential profile spec). Shall we add a TODO to add these.

The code also doesn't validate some things, eg the format of the TPM Manufacturer. I think this is OK, as that can be in a separate method to verify these attributes, if anyone cares. However, the code does verify some aspects (eg critical vs optional extensions), so there is some potential for confusion. Perhaps the method documentation should state something around the face that the presence of extensions are check, but not all values are checked. WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants