mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Move all pki-verification calls from sdk-Verify() to pki-specific (#29342)
* Move all pki-verification calls from sdk-Verify() to pki-specific VerifyCertifcate(...); update sdk-Verify to allow multiple chains, but validate that at least one of those chains is valid. * Updates to Validate on Parse PEMBlock, so that a single cert or a single key parses (test fixes). * Add changelog. * Make test certificate expire in a while, not at linux epoch. * Remove duplicate code. * Fix header file + go mod tidy. * Updates based on review.
This commit is contained in:
@@ -312,8 +312,12 @@ func ParsePEMBundle(pemBundle string) (*ParsedCertBundle, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if err := parsedBundle.Verify(); err != nil {
|
||||
return nil, errutil.UserError{Err: fmt.Sprintf("verification of parsed bundle failed: %s", err)}
|
||||
if len(certPath) > 1 {
|
||||
// Don't validate the certificate chain if no certificate exists eg. only a key is given
|
||||
// And don't validate a chain if it isn't given (eg. only one certificate)
|
||||
if err := parsedBundle.Verify(); err != nil {
|
||||
return nil, errutil.UserError{Err: fmt.Sprintf("verification of parsed bundle failed: %s", err)}
|
||||
}
|
||||
}
|
||||
|
||||
return parsedBundle, nil
|
||||
|
||||
Reference in New Issue
Block a user