feat(pqc): add VerifySignature simplified API

- Add VerifySignature method to ML-DSA and SLH-DSA public keys
- Keep Verify method for crypto.Signer compatibility
- Add documentation clarifying opts parameter is ignored
This commit is contained in:
Zach Kelling
2025-12-11 02:33:54 +00:00
parent bc658139cf
commit 1760ba5f50
2 changed files with 12 additions and 0 deletions
+6
View File
@@ -192,7 +192,13 @@ func (priv *PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerO
}
// Verify verifies a signature with the public key using circl
// The opts parameter is ignored but kept for crypto.Signer interface compatibility
func (pub *PublicKey) Verify(message, signature []byte, opts crypto.SignerOpts) bool {
return pub.VerifySignature(message, signature)
}
// VerifySignature verifies a signature with the public key (simplified API)
func (pub *PublicKey) VerifySignature(message, signature []byte) bool {
switch pub.mode {
case MLDSA44:
var pk mldsa44.PublicKey
+6
View File
@@ -205,7 +205,13 @@ func (priv *PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerO
}
// Verify verifies a signature with the public key using circl
// The opts parameter is ignored but kept for crypto.Signer interface compatibility
func (pub *PublicKey) Verify(message, signature []byte, opts crypto.SignerOpts) bool {
return pub.VerifySignature(message, signature)
}
// VerifySignature verifies a signature with the public key (simplified API)
func (pub *PublicKey) VerifySignature(message, signature []byte) bool {
id := modeToID(pub.mode)
if !id.IsValid() {
return false