-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create self signed chain from command line (#1)
* Create test chain from command line Add functionality to create a test chain from the commandline Refactor things: - Cert chain always in fixed order - `*[]x509.Certificate` -> `[]*x509.Certificate` - `*[][]byte` -> `[][]byte` * Prevented infinite loop - Multiple CA roots co-exist when the -t flag is enabled. * Remove debug print statements from findOtherNameValue Removed two debug print statements that printed extension IDs and other name types. These statements were cluttering the output and are not necessary for the final implementation. * Refactor certificate validation to support test and self-signed CAs Introduce `allowUziTestCa` and `allowSelfSignedCa` flags to UraValidatorImpl for more flexible certificate chain validation. Refactor the validation logic to handle these new flags appropriately, ensuring better support for various CA configurations. * Fix certificate lookup in validator Re-enable the use of findSigningCertificate to ensure proper certificate validation based on X509 thumbprint. Remove hardcoding of the signingCert as first certificate in the chain and handle potential errors appropriately. * Update test-cert CLI to include UZI, URA, and AGB parameters Improved the test-cert command to specify UZI, URA, and AGB parameters instead of a single identifier. This change enhances flexibility and allows for a more precise definition of test certificates. Updated help text for better clarity and added comments to explain the format of the otherName field. * Handle file write errors separately Previously, errors when writing "chain.pem" and "signing_key.pem" were not handled separately. This change ensures that each file write operation checks for errors independently and exits with an error message if a write fails. * Rename variables and use helper function for root CA check Updated `FormatDid` function to use a more descriptive variable `caCert` instead of `ca`. Modified the `FindRootCertificate` function to use the `x509_cert.IsRootCa` helper function for improved readability and consistency in the root CA check. * Bugfix: Rename and update CertTemplate to include organization. The Name seems to be the field that identifies the signer and subject. Updated CertTemplate function to accept an additional "organization" parameter, which allows different organization names for certificates. Adjusted related calls and modified default certificate values to reflect these changes. * Add `subject_did` field and update `test-cert` case Introduce a new `subject_did` field in the `TestCert` struct with a default value. Update the `test-cert` command case to handle this new parameter and adjust the VC issuance logic. * Potentially unsafe quoting: Refactor JSON unmarshal logic in Validate method Replaced the string formatting approach with direct JSON marshaling to prevent potentially unsafe quoting. * Refactor variable name in EncodeCertificates function Renamed the loop variable from 'cert' to 'c' to prevent a naming collision with the cert import. * Add a comment to keep DebugUnmarshall for future debugging A comment was added to the DebugUnmarshall method to indicate that it should be retained for future debugging purposes. --------- Co-authored-by: Roland Groen <[email protected]>
- Loading branch information
1 parent
ef8021f
commit abe731e
Showing
15 changed files
with
358 additions
and
239 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.