Skip to content

Commit

Permalink
backport of commit bae0072 (#28602)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Miller <smiller@hashicorp.com>
  • Loading branch information
1 parent 5edfee5 commit 92ad805
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions changelog/28597.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
auth/cert: When using ocsp_ca_certificates, an error was produced though extra certs validation succeeded.
```
20 changes: 12 additions & 8 deletions sdk/helper/ocsp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,19 @@ func validateOCSPParsedResponse(ocspRes *ocsp.Response, subject, issuer *x509.Ce
var matchedCA *x509.Certificate

// Assumption 1 failed, try 2
if err := ocspRes.Certificate.CheckSignatureFrom(issuer); err != nil {
// Assumption 2 failed, try 3
overallErr = multierror.Append(overallErr, err)

m, err := verifySignature(ocspRes, extraCas)
if err != nil {
overallErr = multierror.Append(overallErr, err)
if sigFromIssuerErr := ocspRes.Certificate.CheckSignatureFrom(issuer); sigFromIssuerErr != nil {
if len(extraCas) > 0 {
// Assumption 2 failed, try 3
m, err := verifySignature(ocspRes, extraCas)
if err != nil {
overallErr = multierror.Append(overallErr, sigFromIssuerErr)
overallErr = multierror.Append(overallErr, err)
} else {
overallErr = nil
matchedCA = m
}
} else {
matchedCA = m
overallErr = multierror.Append(overallErr, sigFromIssuerErr)
}
} else {
matchedCA = ocspRes.Certificate
Expand Down

0 comments on commit 92ad805

Please sign in to comment.