PKCS11 example for doing a CSR generation and creating signed certificate#318
Open
dgarske wants to merge 1 commit intowolfSSL:masterfrom
Open
PKCS11 example for doing a CSR generation and creating signed certificate#318dgarske wants to merge 1 commit intowolfSSL:masterfrom
dgarske wants to merge 1 commit intowolfSSL:masterfrom
Conversation
…ed with PKCS11 key.
SparkiDev
requested changes
Nov 23, 2022
| XMEMSET(pem, 0, LARGE_TEMP_SZ); | ||
| #endif | ||
|
|
||
| #ifdef HAVE_ECC |
Contributor
There was a problem hiding this comment.
Why check for HAVE_ECC here when other ECC APIs are used outside of this?
| printf("Init Cert failed: %d\n", ret); | ||
| goto exit; | ||
| } | ||
| strncpy(req.subject.country, "US", CTC_NAME_SIZE); |
Contributor
There was a problem hiding this comment.
Extract the setting of subject to a new function and comment it to say it needs to be replaced.
| newCert.sigType = CTC_SHA256wECDSA; | ||
|
|
||
| printf("Setting certificate subject\n"); | ||
| #ifdef HAVE_DECODEDCERT |
Contributor
There was a problem hiding this comment.
Extract this code in to separate function and add comment to indicate customer specific changes required.
| strncpy(newCert.subject.email, decoded.subjectEmail, decoded.subjectEmailLen); | ||
| #else | ||
| /* This can be used if the DER is an X.509 certificate (not CSR) */ | ||
| //ret = wc_SetSubjectBuffer(&newCert, derBuf, derSz); |
| /* Code for parsing a CSR to a DecodedCert struct */ | ||
| /* Note: These are not public API's unless WOLFSSL_TEST_CERT or the compat | ||
| * layer is enabled */ | ||
| InitDecodedCert(&decoded, derBuf, derSz, HEAP_HINT); |
Contributor
There was a problem hiding this comment.
wc_InitDecodedCert() and wc_ParseCert()?
| printf("Setting certificate subject\n"); | ||
| #ifdef HAVE_DECODEDCERT | ||
| /* Copy fields from CSR to new certificate */ | ||
| if (decoded.subjectC) |
Contributor
There was a problem hiding this comment.
Can we get raw and set raw?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a rough template for:
wc_Pkcs11_CryptoDevCb).