refactor csr_example to use filled Cert struct workflow#569
Open
night1rider wants to merge 1 commit intowolfSSL:masterfrom
Open
refactor csr_example to use filled Cert struct workflow#569night1rider wants to merge 1 commit intowolfSSL:masterfrom
night1rider wants to merge 1 commit intowolfSSL:masterfrom
Conversation
…d out Cert struct (req) to fully create a CSR with proper error handling and memory management.
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.
Driven by #567.
The previous example used a separate
typevariable (from argv) to drive all per-type decisions: which key to generate, which signature algorithm, which PEM type. TheCertstruct was only used to hold subject fields and was not treated as the central data structure for the CSR workflow.Filling out the Cert struct (req) fully beforehand allows it to drive all aspects of CSR generation. This refactor updates the example to use that workflow:
fill_csr_reqpopulates the req with subject info andsigTypeas the single source of truth. After this call, no per-type switching is neededinit_pk_keyallocates and generates a key based onreq->sigTypebuild_csrcallswc_MakeCertReq_exandwc_SignCert_exreadingreq->sigTypeandreq->bodySzdirectly from the structwolfCrypt_Init/Cleanup, input validation, and proper error handling