Skip to main content

VerifyingKey

Struct VerifyingKey 

Source
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

Source

pub fn from_raw(raw: VerifyingKey) -> Self

Wrap a raw verifying-key resource.

Source

pub fn as_raw(&self) -> &VerifyingKey

Borrow the raw verifying-key resource.

Source

pub fn into_raw(self) -> VerifyingKey

Unwrap into the raw verifying-key resource.

Source§

impl VerifyingKey

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for VerifyingKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<VerifyingKey> for VerifyingKey

Source§

fn from(raw: VerifyingKey) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Resource for T
where T: 'static,

§

type Rep = Option<T>

The type which is actually stored in-memory for this resource. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.