Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

self-signed leaf cert error message not clear #121

Closed
JeyJeyGao opened this issue Feb 9, 2023 · 1 comment · Fixed by #120
Closed

self-signed leaf cert error message not clear #121

JeyJeyGao opened this issue Feb 9, 2023 · 1 comment · Fixed by #120
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@JeyJeyGao
Copy link
Contributor

JeyJeyGao commented Feb 9, 2023

// For self-signed signing certificate (not a CA)
if len(certChain) == 1 {
cert := certChain[0]
if signingTime != nil && (signingTime.Before(cert.NotBefore) || signingTime.After(cert.NotAfter)) {
return fmt.Errorf("certificate with subject %q was not valid at signing time of %s", cert.Subject, signingTime.UTC())
}
if err := cert.CheckSignature(cert.SignatureAlgorithm, cert.RawTBSCertificate, cert.Signature); err != nil {
return err
}
return validateLeafCertificate(cert, expectedLeafEku)
}

In line 50 or 53, if it return an error, it had better tell user that there is only one cert and the cert subject is xxxxx with error:xxxx
Also, it may be replaced by isSelfSigned() because it also need to make sure that the issuer and subject are the same.

@patrickzheng200
Copy link

The fix will be included in PR 120 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants