Trait SignatureVerificationAlgorithm
trait SignatureVerificationAlgorithm: Send + Sync + fmt::Debug
An abstract signature verification algorithm.
One of these is needed per supported pair of public key type (identified
with public_key_alg_id()) and signatureAlgorithm (identified with
signature_alg_id()). Note that both of these AlgorithmIdentifiers include
the parameters encoding, so separate SignatureVerificationAlgorithms are needed
for each possible public key or signature parameters.
Debug implementations should list the public key algorithm identifier and signature algorithm identifier in human friendly form (i.e. not encoded bytes), along with the name of the implementing library (to distinguish different implementations of the same algorithms).
Required Methods
fn verify_signature(self: &Self, public_key: &[u8], message: &[u8], signature: &[u8]) -> Result<(), InvalidSignature>Verify a signature.
public_keyis thesubjectPublicKeyvalue from aSubjectPublicKeyInfoencoding and is untrusted. The key'ssubjectPublicKeyInfomatches theAlgorithmIdentifierreturned bypublic_key_alg_id().messageis the data over which the signature was allegedly computed. It is not hashed; implementations of this trait function must do hashing if that is required by the algorithm they implement.signatureis the signature allegedly overmessage.Return
Ok(())only ifsignatureis a valid signature onmessage.Return
Err(InvalidSignature)if the signature is invalid, including if thepublic_keyencoding is invalid. There is no need or opportunity to produce errors that are more specific than this.fn public_key_alg_id(self: &Self) -> AlgorithmIdentifierReturn the
AlgorithmIdentifierthat must equal a public key'ssubjectPublicKeyInfovalue for thisSignatureVerificationAlgorithmto be used for signature verification.fn signature_alg_id(self: &Self) -> AlgorithmIdentifierReturn the
AlgorithmIdentifierthat must equal thesignatureAlgorithmvalue on the data to be verified for thisSignatureVerificationAlgorithmto be used for signature verification.
Provided Methods
fn fips(self: &Self) -> boolReturn
trueif this is backed by a FIPS-approved implementation.