#[repr(C)]pub struct VerifyingKey<C: IntrinsicCurve> { /* private fields */ }
Implementations§
Source§impl<C: IntrinsicCurve> VerifyingKey<C>where
C::Point: WeierstrassPoint + Group + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
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>,
impl<C: IntrinsicCurve> VerifyingKey<C>where
C::Point: WeierstrassPoint + Group + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
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>,
pub fn new(public_key: PublicKey<C>) -> Self
pub fn from_sec1_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_affine(point: <C as IntrinsicCurve>::Point) -> Result<Self>
pub fn to_sec1_bytes(&self, compress: bool) -> Vec<u8> ⓘ
pub fn as_affine(&self) -> &<C as IntrinsicCurve>::Point
pub fn into_affine(self) -> <C as IntrinsicCurve>::Point
Source§impl<C> VerifyingKey<C>where
C: IntrinsicCurve + PrimeCurve,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate> + VerifyCustomHook<C>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
C::Scalar: IntMod + Reduce,
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>,
FieldBytesSize<C>: ModulusSize,
SignatureSize<C>: ArrayLength<u8>,
impl<C> VerifyingKey<C>where
C: IntrinsicCurve + PrimeCurve,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate> + VerifyCustomHook<C>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
C::Scalar: IntMod + Reduce,
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>,
FieldBytesSize<C>: ModulusSize,
SignatureSize<C>: ArrayLength<u8>,
Sourcepub fn recover_from_msg(
msg: &[u8],
signature: &Signature<C>,
recovery_id: RecoveryId,
) -> Result<Self>where
C: DigestPrimitive,
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
.
Sourcepub fn recover_from_digest<D>(
msg_digest: D,
signature: &Signature<C>,
recovery_id: RecoveryId,
) -> Result<Self>where
D: Digest,
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
.
Sourcepub fn recover_from_prehash(
prehash: &[u8],
signature: &Signature<C>,
recovery_id: RecoveryId,
) -> Result<Self>
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>where
C: CurveArithmetic + IntrinsicCurve,
<C as IntrinsicCurve>::Point: FromEncodedPoint<C> + ToEncodedPoint<C> + Default + ConditionallySelectable,
FieldBytesSize<C>: ModulusSize,
impl<C> VerifyingKey<C>where
C: CurveArithmetic + IntrinsicCurve,
<C as IntrinsicCurve>::Point: FromEncodedPoint<C> + ToEncodedPoint<C> + Default + ConditionallySelectable,
FieldBytesSize<C>: ModulusSize,
Sourcepub fn from_encoded_point(public_key: &EncodedPoint<C>) -> Result<Self>
pub fn from_encoded_point(public_key: &EncodedPoint<C>) -> Result<Self>
Initialize VerifyingKey
from an EncodedPoint
.
Sourcepub fn to_encoded_point(&self, compress: bool) -> EncodedPoint<C>
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>where
C: IntrinsicCurve + PrimeCurve,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
C::Scalar: IntMod + Reduce,
impl<C> VerifyingKey<C>where
C: IntrinsicCurve + PrimeCurve,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
C::Scalar: IntMod + Reduce,
Sourcepub 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>,
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
.
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>
impl<C: IntrinsicCurve> AsRef<<C as IntrinsicCurve>::Point> for VerifyingKey<C>
Source§fn as_ref(&self) -> &<C as IntrinsicCurve>::Point
fn as_ref(&self) -> &<C as IntrinsicCurve>::Point
Source§impl<C: Clone + IntrinsicCurve> Clone for VerifyingKey<C>
impl<C: Clone + IntrinsicCurve> Clone for VerifyingKey<C>
Source§fn clone(&self) -> VerifyingKey<C>
fn clone(&self) -> VerifyingKey<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<C, D> DigestVerifier<D, Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + IntrinsicCurve,
D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
SignatureSize<C>: ArrayLength<u8>,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate> + VerifyCustomHook<C>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
<C as IntrinsicCurve>::Scalar: IntMod + Reduce,
for<'a> &'a C::Point: Add<&'a C::Point, Output = C::Point>,
for<'a> &'a <C as IntrinsicCurve>::Scalar: DivUnsafe<&'a <C as IntrinsicCurve>::Scalar, Output = <C as IntrinsicCurve>::Scalar>,
impl<C, D> DigestVerifier<D, Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + IntrinsicCurve,
D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
SignatureSize<C>: ArrayLength<u8>,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate> + VerifyCustomHook<C>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
<C as IntrinsicCurve>::Scalar: IntMod + Reduce,
for<'a> &'a C::Point: Add<&'a C::Point, Output = C::Point>,
for<'a> &'a <C as IntrinsicCurve>::Scalar: DivUnsafe<&'a <C as IntrinsicCurve>::Scalar, Output = <C as IntrinsicCurve>::Scalar>,
Source§impl<C> PrehashVerifier<Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + IntrinsicCurve,
SignatureSize<C>: ArrayLength<u8>,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate> + VerifyCustomHook<C>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
C::Scalar: IntMod + Reduce,
for<'a> &'a C::Point: Add<&'a C::Point, Output = C::Point>,
for<'a> &'a <C as IntrinsicCurve>::Scalar: DivUnsafe<&'a <C as IntrinsicCurve>::Scalar, Output = <C as IntrinsicCurve>::Scalar>,
impl<C> PrehashVerifier<Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + IntrinsicCurve,
SignatureSize<C>: ArrayLength<u8>,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate> + VerifyCustomHook<C>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
C::Scalar: IntMod + Reduce,
for<'a> &'a C::Point: Add<&'a C::Point, Output = C::Point>,
for<'a> &'a <C as IntrinsicCurve>::Scalar: DivUnsafe<&'a <C as IntrinsicCurve>::Scalar, Output = <C as IntrinsicCurve>::Scalar>,
Source§impl<C> Verifier<Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive + IntrinsicCurve,
SignatureSize<C>: ArrayLength<u8>,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate> + VerifyCustomHook<C>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
<C as IntrinsicCurve>::Scalar: IntMod + Reduce,
for<'a> &'a C::Point: Add<&'a C::Point, Output = C::Point>,
for<'a> &'a <C as IntrinsicCurve>::Scalar: DivUnsafe<&'a <C as IntrinsicCurve>::Scalar, Output = <C as IntrinsicCurve>::Scalar>,
impl<C> Verifier<Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive + IntrinsicCurve,
SignatureSize<C>: ArrayLength<u8>,
C::Point: WeierstrassPoint + CyclicGroup + FromCompressed<<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate> + VerifyCustomHook<C>,
<<C as IntrinsicCurve>::Point as WeierstrassPoint>::Coordinate: IntMod,
<C as IntrinsicCurve>::Scalar: IntMod + Reduce,
for<'a> &'a C::Point: Add<&'a C::Point, Output = C::Point>,
for<'a> &'a <C as IntrinsicCurve>::Scalar: DivUnsafe<&'a <C as IntrinsicCurve>::Scalar, Output = <C as IntrinsicCurve>::Scalar>,
Auto Trait Implementations§
impl<C> Freeze for VerifyingKey<C>
impl<C> RefUnwindSafe for VerifyingKey<C>
impl<C> Send for VerifyingKey<C>
impl<C> Sync for VerifyingKey<C>
impl<C> Unpin for VerifyingKey<C>
impl<C> UnwindSafe for VerifyingKey<C>
Blanket Implementations§
Source§impl<A, T> AsBits<T> for A
impl<A, T> AsBits<T> for A
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)