pub struct VerifyingKey(/* private fields */);Expand description
A signature.verifying-key: public-key signature verification.
Secret-free — a component holding only this key provably cannot sign.
Implementations§
Source§impl VerifyingKey
impl VerifyingKey
Sourcepub fn from_raw(raw: VerifyingKey) -> Self
pub fn from_raw(raw: VerifyingKey) -> Self
Wrap a raw verifying-key resource.
Sourcepub fn as_raw(&self) -> &VerifyingKey
pub fn as_raw(&self) -> &VerifyingKey
Borrow the raw verifying-key resource.
Sourcepub fn into_raw(self) -> VerifyingKey
pub fn into_raw(self) -> VerifyingKey
Unwrap into the raw verifying-key resource.
Source§impl VerifyingKey
impl VerifyingKey
Sourcepub async fn verify(
&self,
data: impl Into<DataSource<'_>>,
sig: impl Into<Cow<'_, [u8]>>,
) -> Result<(), Error>
pub async fn verify( &self, data: impl Into<DataSource<'_>>, sig: impl Into<Cow<'_, [u8]>>, ) -> Result<(), Error>
Verify sig over data.
Fails closed with Error::AuthenticationFailed if the signature
does not verify — deliberately a Result rather than a bool: an
ignored boolean fails open, a dropped Result does not. The precise
verification criterion (which degenerate keys and signatures must be
rejected) is defined by the key’s minting interface, exactly like
the wire format.
Sourcepub fn algorithm_name(&self) -> String
pub fn algorithm_name(&self) -> String
The name of the key’s algorithm family, e.g. "Ed25519" or
"ECDSA" — WebCrypto’s KeyAlgorithm.name, spelled as the W3C Web
Cryptography API algorithm
registry
spells it.
Sourcepub fn algorithm_curve(&self) -> Option<String>
pub fn algorithm_curve(&self) -> Option<String>
The registry name of the curve for curve-parameterized algorithms,
e.g. "P-256" (WebCrypto’s EcKeyAlgorithm.namedCurve). None for
Ed25519, whose curve is implied by the name.
Sourcepub fn algorithm_hash(&self) -> Option<String>
pub fn algorithm_hash(&self) -> Option<String>
The registry name of the digest bound at mint, e.g. "SHA-256".
None for Ed25519: RFC 8032 fixes SHA-512 internally, so it is not
a parameter.
Sourcepub fn algorithm_length(&self) -> Option<u32>
pub fn algorithm_length(&self) -> Option<u32>
The key’s length in bits for algorithms parameterized by one — the
RSA modulus length (WebCrypto’s RsaKeyAlgorithm.modulusLength).
None for Ed25519 and ECDSA, whose key size is fixed by the
algorithm or curve.
Sourcepub fn algorithm_public_exponent(&self) -> Option<Vec<u8>>
pub fn algorithm_public_exponent(&self) -> Option<Vec<u8>>
The RSA public exponent’s big-endian bytes (WebCrypto’s
RsaKeyAlgorithm.publicExponent; [1, 0, 1] for 65537). None
for Ed25519 and ECDSA, which have no such parameter.
Sourcepub async fn export_key_raw(&self) -> Result<Vec<u8>, Error>
pub async fn export_key_raw(&self) -> Result<Vec<u8>, Error>
The public key material, in the minting interface’s documented public format.
There is no extractability gate on this key, so this never fails
with Error::NotExtractable. It can still fail with
Error::Other: a provider may hold the key as a handle it can
use but not read, so verifying succeeds while recovering the
encoding does not.