pub trait VerifyingKey {
// Required method
fn verify(
&self,
algorithm: SignatureAlgorithm,
signed_data: &[u8],
signature_value: &[u8],
) -> Result<bool, DsigError>;
// Provided methods
fn provider_binding(&self) -> Option<&ProviderBinding> { ... }
fn verify_candidate_keys(
&self,
_verify: &mut dyn FnMut(&dyn VerifyingKey) -> Result<bool, DsigError>,
) -> Result<Option<bool>, DsigError> { ... }
fn verification_spki(
&self,
_algorithm: SignatureAlgorithm,
) -> Result<Option<&[u8]>, DsigError> { ... }
fn ecdsa_encoding(&self) -> EcdsaSignatureValueEncoding { ... }
fn verify_with_context(
&self,
algorithm: SignatureAlgorithm,
context: &SignatureContext,
data: &[u8],
signature: &[u8],
) -> Result<bool, DsigError> { ... }
fn validate_policy(
&self,
_policy: &VerificationPolicy,
) -> Result<(), DsigError> { ... }
fn validate_signature_value(
&self,
algorithm: SignatureAlgorithm,
signature_value: &[u8],
) -> Result<bool, DsigError> { ... }
fn validate_signature_value_with_policy(
&self,
policy: &VerificationPolicy,
algorithm: SignatureAlgorithm,
signature_value: &[u8],
) -> Result<bool, DsigError> { ... }
fn verify_with_policy(
&self,
policy: &VerificationPolicy,
algorithm: SignatureAlgorithm,
signed_data: &[u8],
signature_value: &[u8],
) -> Result<bool, DsigError> { ... }
}Expand description
Cryptographic verifier used by VerifyContext.
This trait intentionally has no Send + Sync supertraits so lightweight
single-threaded verifiers can be used without additional bounds.
Required Methods§
Provided Methods§
Sourcefn provider_binding(&self) -> Option<&ProviderBinding>
fn provider_binding(&self) -> Option<&ProviderBinding>
Exact external execution domain; a key cannot be moved between token sessions.
Sourcefn verify_candidate_keys(
&self,
_verify: &mut dyn FnMut(&dyn VerifyingKey) -> Result<bool, DsigError>,
) -> Result<Option<bool>, DsigError>
fn verify_candidate_keys( &self, _verify: &mut dyn FnMut(&dyn VerifyingKey) -> Result<bool, DsigError>, ) -> Result<Option<bool>, DsigError>
Composite resolvers may try individual keys through the selected engine.
None identifies a leaf handle. Wrappers must preserve per-key policy
when forwarding the visitor; no public/private key copy is required.
Sourcefn verification_spki(
&self,
_algorithm: SignatureAlgorithm,
) -> Result<Option<&[u8]>, DsigError>
fn verification_spki( &self, _algorithm: SignatureAlgorithm, ) -> Result<Option<&[u8]>, DsigError>
Borrow public SPKI for native verification, validating method/key binding.
Opaque external keys may return None; native providers then fail closed.
Sourcefn ecdsa_encoding(&self) -> EcdsaSignatureValueEncoding
fn ecdsa_encoding(&self) -> EcdsaSignatureValueEncoding
Wire encoding already selected by the immutable verification policy.
Sourcefn verify_with_context(
&self,
algorithm: SignatureAlgorithm,
context: &SignatureContext,
data: &[u8],
signature: &[u8],
) -> Result<bool, DsigError>
fn verify_with_context( &self, algorithm: SignatureAlgorithm, context: &SignatureContext, data: &[u8], signature: &[u8], ) -> Result<bool, DsigError>
Verify with validated domain separation, rejecting unsupported contexts.
Sourcefn validate_policy(&self, _policy: &VerificationPolicy) -> Result<(), DsigError>
fn validate_policy(&self, _policy: &VerificationPolicy) -> Result<(), DsigError>
Validate this key against the operation’s immutable trust policy.
Built-in keys override this hook so pre-resolved and resolver-produced keys enforce identical strength constraints. Custom opaque keys may retain their own policy enforcement by accepting the default no-op.
Sourcefn validate_signature_value(
&self,
algorithm: SignatureAlgorithm,
signature_value: &[u8],
) -> Result<bool, DsigError>
fn validate_signature_value( &self, algorithm: SignatureAlgorithm, signature_value: &[u8], ) -> Result<bool, DsigError>
Check that signature_value has the wire framing required by the
declared algorithm and this key before provider dispatch.
Key implementations with key-size-dependent framing should override this method. The default enforces the algorithm-wide XMLDSig envelope.
Sourcefn validate_signature_value_with_policy(
&self,
policy: &VerificationPolicy,
algorithm: SignatureAlgorithm,
signature_value: &[u8],
) -> Result<bool, DsigError>
fn validate_signature_value_with_policy( &self, policy: &VerificationPolicy, algorithm: SignatureAlgorithm, signature_value: &[u8], ) -> Result<bool, DsigError>
Validate wire framing under the operation’s immutable compatibility policy.
The default delegates to VerifyingKey::validate_signature_value and
therefore implements only the standard XMLDSig framing contract. Custom
keys that support policy-selected wire formats, such as
crate::policy::EcdsaSignatureValueEncoding::XmlSecAsn1Der, must
override this hook rather than accepting both formats implicitly.
Sourcefn verify_with_policy(
&self,
policy: &VerificationPolicy,
algorithm: SignatureAlgorithm,
signed_data: &[u8],
signature_value: &[u8],
) -> Result<bool, DsigError>
fn verify_with_policy( &self, policy: &VerificationPolicy, algorithm: SignatureAlgorithm, signed_data: &[u8], signature_value: &[u8], ) -> Result<bool, DsigError>
Verify after applying operation-scoped compatibility semantics.
The default delegates to VerifyingKey::verify. Custom keys whose
provider input depends on compatibility policy must override this hook
consistently with VerifyingKey::validate_signature_value_with_policy.
Trait Implementations§
Source§impl<'a> AsRef<dyn VerifyingKey + 'a> for ResolvedVerificationKey<'a>
impl<'a> AsRef<dyn VerifyingKey + 'a> for ResolvedVerificationKey<'a>
Source§fn as_ref(&self) -> &(dyn VerifyingKey + 'a)
fn as_ref(&self) -> &(dyn VerifyingKey + 'a)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".