Skip to main content

VerifyingKey

Struct VerifyingKey 

Source
pub struct VerifyingKey<C: IntrinsicCurve> { /* private fields */ }

Implementations§

Source§

impl<C: IntrinsicCurve> VerifyingKey<C>

Source

pub fn new(public_key: PublicKey<C>) -> Self

Source

pub fn from_sec1_bytes(bytes: &[u8]) -> Result<Self>

Source

pub fn from_affine(point: <C as IntrinsicCurve>::Point) -> Result<Self>

Convert an affine point into a verifying key.

This has the same validation behavior as PublicKey::from_affine.

Source

pub fn to_sec1_bytes(&self, compress: bool) -> Vec<u8> ⓘ

Source

pub fn as_affine(&self) -> &<C as IntrinsicCurve>::Point

Source

pub fn into_affine(self) -> <C as IntrinsicCurve>::Point

Source§

impl<C> VerifyingKey<C>

Source

pub fn recover_from_msg( msg: &[u8], signature: &Signature<C>, recovery_id: RecoveryId, ) -> Result<Self>
where C: DigestPrimitive,

Recover a VerifyingKey from the given message, signature, and RecoveryId.

The message is first hashed using this curve’s DigestPrimitive.

Source

pub fn recover_from_digest<D>( msg_digest: D, signature: &Signature<C>, recovery_id: RecoveryId, ) -> Result<Self>
where D: Digest,

Recover a VerifyingKey from the given message Digest, signature, and RecoveryId.

Source

pub fn recover_from_prehash( prehash: &[u8], signature: &Signature<C>, recovery_id: RecoveryId, ) -> Result<Self>

Recover a VerifyingKey from the given prehash of a message, the signature over that prehashed message, and a RecoveryId. Note that this function does not verify the signature with the recovered key.

Source§

impl<C> VerifyingKey<C>

Source

pub fn from_encoded_point(public_key: &EncodedPoint<C>) -> Result<Self>

Initialize VerifyingKey from an EncodedPoint.

Source

pub fn to_encoded_point(&self, compress: bool) -> EncodedPoint<C>

Serialize this VerifyingKey as a SEC1 EncodedPoint, optionally applying point compression.

Source§

impl<C> VerifyingKey<C>

Source

pub fn recover_from_prehash_noverify( prehash: &[u8], sig: &[u8], recovery_id: RecoveryId, ) -> Result<Self>
where for<'a> &'a C::Point: Add<&'a C::Point, Output = C::Point>, for<'a> &'a <<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: Mul<&'a <<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate, Output = <<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate>,

§Assumption

To use this implementation, the Signature<C>, Coordinate<C>, and FieldBytes<C> should all be encoded in big endian bytes. The implementation also assumes that Scalar::<C>::NUM_LIMBS <= FieldBytesSize::<C>::USIZE <= Coordinate::<C>::NUM_LIMBS.

Ref: https://github.com/RustCrypto/signatures/blob/85c984bcc9927c2ce70c7e15cbfe9c6936dd3521/ecdsa/src/recovery.rs#L297

Recovery does not require additional signature verification: https://github.com/RustCrypto/signatures/pull/831

Trait Implementations§

Source§

impl<C: IntrinsicCurve> AsRef<<C as IntrinsicCurve>::Point> for VerifyingKey<C>

Source§

fn as_ref(&self) -> &<C as IntrinsicCurve>::Point

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<C: Clone + IntrinsicCurve> Clone for VerifyingKey<C>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C, D> DigestVerifier<D, Signature<C>> for VerifyingKey<C>

Source§

fn verify_digest(&self, msg_digest: D, signature: &Signature<C>) -> Result<()>

Verify the signature against the given Digest output.
Source§

impl<C> PrehashVerifier<Signature<C>> for VerifyingKey<C>

Source§

fn verify_prehash(&self, prehash: &[u8], signature: &Signature<C>) -> Result<()>

Use Self to verify that the provided signature for a given message prehash is authentic. Read more
Source§

impl<C> Verifier<Signature<C>> for VerifyingKey<C>

Source§

fn verify(&self, msg: &[u8], signature: &Signature<C>) -> Result<()>

Use Self to verify that the provided signature for a given message bytestring is authentic. Read more

Auto Trait Implementations§

§

impl<C> Freeze for VerifyingKey<C>
where PublicKey<C>: Freeze,

§

impl<C> RefUnwindSafe for VerifyingKey<C>

§

impl<C> Send for VerifyingKey<C>
where PublicKey<C>: Send,

§

impl<C> Sync for VerifyingKey<C>
where PublicKey<C>: Sync,

§

impl<C> Unpin for VerifyingKey<C>
where PublicKey<C>: Unpin,

§

impl<C> UnsafeUnpin for VerifyingKey<C>

§

impl<C> UnwindSafe for VerifyingKey<C>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.