-
Notifications
You must be signed in to change notification settings - Fork 62
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
Adding wrappers for CSR Generation #219
Conversation
a5367be
to
5658769
Compare
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.
Sweet! Think I caught some stuff. Please look over my comments.
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.
Everything looks great to me. Waiting for a few more changes as discussed privately.
Note: Going to be adding a WOLFTPM_CSR struct / class to support assembling a CSR then asking for it to be signed. This will allow for the custom request extension support. |
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.
Nice changes. Just looking for a bit of new wording.
examples/csr/csr.c
Outdated
rc = wolfTPM2_CSR_SetKeyUsage(dev, csr, keyUsage); | ||
} | ||
if (rc == 0) { | ||
rc = wolfTPM2_CSR_SetCustomExt(dev, csr, 0, "1.3.6.1.4.1.37244.2.2", |
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.
Can we get a comment or some sort of explanation of what is "1.3.6.1.4.1.37244.2.2" ?
wolftpm/tpm2_wrap.h
Outdated
\param selfSign If set to 1 (non-zero) then result will be a self signed certificate. | ||
Zero (0) will generate a CSR to be used by a CA to sign and make into a "real" certificate. |
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.
In both cases, (zero, non-zero) this is a self signed object. (CA cert or CSR) . Can you call this parameter is_ca_cert
or something similar? (admittedly not the best name. )
wrapper/CSharp/wolfTPM-tests.cs
Outdated
ret = csr.SetKeyUsage(keyUsage); | ||
Assert.AreEqual((int)Status.TPM_RC_SUCCESS, ret); | ||
|
||
ret = csr.SetCustomOid("1.3.6.1.4.1.37244.2.2", |
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.
what is this OID? Perhaps comment?
wrapper/CSharp/wolfTPM.cs
Outdated
string oid, | ||
byte[] der, | ||
uint derSz); | ||
public int SetCustomOid(string oid, string der, int critical) |
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.
Can this be renamed to SetCustomExtension()
?
examples/csr/csr.c
Outdated
static void usage(void) | ||
{ | ||
printf("Expected usage:\n"); | ||
printf("./examples/csr/csr [-selfsigned]\n"); |
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.
this selfsigned flag is strange as its always selfsigned. Either as a CA cert or a CSR.
…tion including CSharp wrappers. This includes support for subject, key usage, custom request extensions and output as PEM or DER. New structure `WOLFTPM2_CSR`. New API's `wolfTPM2_CSR_*`. New CSharp class `Csr`.
ret = device.LoadKey(keyBlob, parent_key); | ||
Assert.AreEqual((int)Status.TPM_RC_SUCCESS, ret); | ||
|
||
ret = device.GenerateCSR(keyBlob, subject, keyUsage, |
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.
Could add subject format requirements for this interface.
wolfTPM2_CSR_Generate
wrapper to assist with CSR generation.WOLFTPM2_CSR
structure and using custom OIDs in the CSR. This allows passing aWOLFTPM2_CSR
to a set of newwolfTPM2_CSR_*
API's.The custom OID feature requires:
user_settings.h:
Cmake:
Configure (autoconf):