Skip to content

Commit

Permalink
Make ra.matchesCSR slightly less strict
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongable committed Jul 25, 2024
1 parent 0ef7a60 commit 284c814
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ra/ra.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,12 @@ func (ra *RegistrationAuthorityImpl) matchesCSR(parsedCertificate *x509.Certific
if parsedCertificate.IsCA {
return berrors.InternalServerError("generated certificate can sign other certificates")
}
if !slices.Equal(parsedCertificate.ExtKeyUsage, []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}) {
for _, eku := range parsedCertificate.ExtKeyUsage {
if eku != x509.ExtKeyUsageServerAuth && eku != x509.ExtKeyUsageClientAuth {
return berrors.InternalServerError("generated certificate doesn't have correct key usage extensions")
}
}
if !slices.Contains(parsedCertificate.ExtKeyUsage, x509.ExtKeyUsageServerAuth) {
return berrors.InternalServerError("generated certificate doesn't have correct key usage extensions")
}

Expand Down

0 comments on commit 284c814

Please sign in to comment.