Commit Graph

7 Commits

Author SHA1 Message Date
Violet Hynes
dbecbcec18
VAULT-27384 Fix faulty assignments and unchecked errors (#27810)
* VAULT-27384 Fix faulty assignments and unchecked errors

* Another missed error

* Small refactor
2024-07-22 16:53:02 -04:00
Josh Black
fa13dbd381
add gosimport to make fmt and run it (#25383)
* add gosimport to make fmt and run it

* move installation to tools.sh

* correct weird spacing issue

* Update Makefile

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>

* fix a weird issue

---------

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
2024-02-13 14:07:02 -08:00
Kit Haines
99c74f5c80
Base Binary Cert and CSR Parse functions. (#24958)
* Base Binary Cert and CSR Parse functions.

* Add otherSANS parsing.

* Notate what doesn't exist on a CSR.

* Fix otherSans call err-checking and add basic-constriants to CSR

* Move BasicConstraint parsing to be optionally set.

* Refactored to use existing ParseBasicConstraintsExtension.

* Add handling for the ChangeSubjectName ext on CSR that is needed for EST

* Remove ChangeSubjectName - it's an attribute, not an extension, and there is no clean way to parse it, so pair down for now.

* Make these public methods, so they can be used in vault.

* Add unit tests for certutil.ParseCertificateToCreationParameters.

Also add unit tests for certutil.ParseCertificateToFields.

* Cleanup TestParseCertificate.

* Add unit tests for certutil.ParseCsrToCreationParameters and ParseCsrToFields.

* Fix return values for  "add_basic_constraints" in certutil.ParseCsrToFields.

Add a test for parsing CSRs where "add_basic_constraints" is false.

* Clear up some todos.

* Add a test for certutil.ParseCertificateToCreationParameters for non-CA cert.

* Tweak TestParseCertificate/full_non_CA_cert.

* Basics of three remaining fields - keyUsage; extKeyUsage; PolicyIdentifiers

* Fix tests and err handling

* Add unit tests for policy_identifiers; ext_key_usage_oids; key_usage

* Add test on ext_key_usage_oids

* Remove duplicate usages elsewhere.

* Add error handling to csr-checks.

* Remove extranames on returned types.

* Remove useless function.

---------

Co-authored-by: Victor Rodriguez <vrizo@hashicorp.com>
2024-02-01 10:03:43 -05:00
hashicorp-copywrite[bot]
0b12cdcfd1
[COMPLIANCE] License changes (#22290)
* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License.

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUS-1.1

* Fix test that expected exact offset on hcl file

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
2023-08-10 18:14:03 -07:00
Hamid Ghaf
e55c18ed12
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00
Steven Clark
7d9dd37f88
Trap errors related to vault pki list-intermediate issuer reading (#19165)
* Rename files to match test suite and existing pattern

* Factor out issuer loading into a dedicated function

 - Add a little more checks/validation when loading the a PKI issuer
 - Factor out the issuer loading into a dedicated function
 - Leverage existing health check code to parse issuer certificates

* Read parent issuer once instead of reloading it for every child

 - Read in our parent issuer once instead of running it for every child
   we want to compare against
 - Provides clearer error message that we have failed reading from which
   path to the end user

* PR Feedback

 - Rename a variable for clarity
 - Use readIssuer in the validation of the parent issuer within
   pkiIssuer
 - Add some missing return 1 statements in error handlers that had been
   missed
2023-02-14 08:51:44 -05:00
Kit Haines
d08de3e78e
Vault 11799 Vault CLI Re-Issue (Templating based on existing certificate) (#18499)
* The verify-sign command in it's cleanest existing form.

* Working state

* Updates to proper verification syntax

Co-authored-by: 'Alex Scheel' <alex.scheel@hashicorp.com>

* make fmt

* Base functionality.

* make fmt; changelog

* pki issue command.

* Make fmt. Changelog.

* Error Handling Is Almost A Tutorial

* Issue and ReIssue are Almost the Same Command

* Make Fmt + Changelog.

* Make some of the tests go.

* make fmt

* Merge fix (take 2)

* Fix existing support, add support for use_pss, max_path_length, not_after, permitted_dns_domains and skid

* Good Test which Fails

* Test-correction.

* Fix update to key_type key_bits; allow "," in OU or similar

* More specific includeCNinSANs

* Add tests around trying to use_pss on an ec key.

* GoDoc Test Paragraph thing.

---------

Co-authored-by: 'Alex Scheel' <alex.scheel@hashicorp.com>
2023-02-10 20:27:36 +00:00