mirror of
https://github.com/emmansun/gmsm.git
synced 2025-05-12 03:56:17 +08:00
smx509: clarify that CheckSignatureFrom and CheckSignature are low-level API
This commit is contained in:
parent
24d89df5c0
commit
72bb569234
@ -673,8 +673,10 @@ func (c *Certificate) hasSANExtension() bool {
|
||||
return oidInExtensions(oidExtensionSubjectAltName, c.Extensions)
|
||||
}
|
||||
|
||||
// CheckSignatureFrom verifies that the signature on c is a valid signature
|
||||
// from parent. SHA1WithRSA and ECDSAWithSHA1 signatures are not supported.
|
||||
// CheckSignatureFrom verifies that the signature on c is a valid signature from parent.
|
||||
//
|
||||
// This is a low-level API that performs very limited checks, and not a full
|
||||
// path verifier. Most users should use [Certificate.Verify] instead.
|
||||
func (c *Certificate) CheckSignatureFrom(parent *Certificate) error {
|
||||
// RFC 5280, 4.2.1.9:
|
||||
// "If the basic constraints extension is not present in a version 3
|
||||
@ -701,6 +703,11 @@ func (c *Certificate) CheckSignatureFrom(parent *Certificate) error {
|
||||
|
||||
// CheckSignature verifies that signature is a valid signature over signed from
|
||||
// c's public key.
|
||||
//
|
||||
// This is a low-level API that performs no validity checks on the certificate.
|
||||
//
|
||||
// [MD5WithRSA] signatures are rejected, while [SHA1WithRSA] and [ECDSAWithSHA1]
|
||||
// signatures are currently accepted.
|
||||
func (c *Certificate) CheckSignature(algo SignatureAlgorithm, signed, signature []byte) error {
|
||||
return checkSignature(algo, signed, signature, c.PublicKey, true)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user