pub struct VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,{ /* private fields */ }
Expand description
ECDSA verification key (i.e. public key). Generic over elliptic curves.
Requires an [elliptic_curve::ProjectiveArithmetic
] impl on the curve, and a
VerifyPrimitive
impl on its associated AffinePoint
type.
§serde
support
When the serde
feature of this crate is enabled, it provides support for
serializing and deserializing ECDSA signatures using the Serialize
and
Deserialize
traits.
The serialization leverages the encoding used by the [PublicKey
] type,
which is a binary-oriented ASN.1 DER encoding.
Implementations§
Source§impl<C> VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Sourcepub fn from_sec1_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_sec1_bytes(bytes: &[u8]) -> Result<Self>
Initialize VerifyingKey
from a SEC1-encoded public key.
Sourcepub fn from_affine(affine: AffinePoint<C>) -> Result<Self>
pub fn from_affine(affine: AffinePoint<C>) -> Result<Self>
Initialize VerifyingKey
from an affine point.
Returns an Error
if the given affine point is the additive identity
(a.k.a. point at infinity).
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.
Trait Implementations§
Source§impl<C> AsRef<<C as AffineArithmetic>::AffinePoint> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> AsRef<<C as AffineArithmetic>::AffinePoint> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§impl<C> AsRef<VerifyingKey<C>> for SigningKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + Reduce<C::UInt> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> AsRef<VerifyingKey<C>> for SigningKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + Reduce<C::UInt> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn as_ref(&self) -> &VerifyingKey<C>
fn as_ref(&self) -> &VerifyingKey<C>
Source§impl<C> Clone for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic + Clone,
impl<C> Clone for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic + Clone,
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> Debug for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic + Debug,
impl<C> Debug for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic + Debug,
Source§impl<C> DecodePublicKey for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> DecodePublicKey for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
§fn from_public_key_der(bytes: &[u8]) -> Result<Self, Error>
fn from_public_key_der(bytes: &[u8]) -> Result<Self, Error>
SubjectPublicKeyInfo
]
(binary format).§fn from_public_key_pem(s: &str) -> Result<Self, Error>
fn from_public_key_pem(s: &str) -> Result<Self, Error>
SubjectPublicKeyInfo
]. Read moreSource§impl<'de, C> Deserialize<'de> for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<'de, C> Deserialize<'de> for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<C, D> DigestVerifier<D, Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
D: Digest + FixedOutput<OutputSize = FieldSize<C>>,
AffinePoint<C>: VerifyPrimitive<C>,
Scalar<C>: Reduce<C::UInt>,
SignatureSize<C>: ArrayLength<u8>,
impl<C, D> DigestVerifier<D, Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
D: Digest + FixedOutput<OutputSize = FieldSize<C>>,
AffinePoint<C>: VerifyPrimitive<C>,
Scalar<C>: Reduce<C::UInt>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> EncodePublicKey for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> EncodePublicKey for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§fn to_public_key_der(&self) -> Result<Document>
fn to_public_key_der(&self) -> Result<Document>
Document
containing a SPKI-encoded public key.§fn to_public_key_pem(&self, line_ending: LineEnding) -> Result<String, Error>
fn to_public_key_pem(&self, line_ending: LineEnding) -> Result<String, Error>
LineEnding
.Source§impl<C> From<&PublicKey<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
impl<C> From<&PublicKey<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Source§fn from(public_key: &PublicKey<C>) -> VerifyingKey<C>
fn from(public_key: &PublicKey<C>) -> VerifyingKey<C>
Source§impl<C> From<&SigningKey<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + Reduce<C::UInt> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> From<&SigningKey<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + Reduce<C::UInt> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn from(signing_key: &SigningKey<C>) -> VerifyingKey<C>
fn from(signing_key: &SigningKey<C>) -> VerifyingKey<C>
Source§impl<C> From<&VerifyingKey<C>> for EncodedPoint<C>where
C: PrimeCurve + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> From<&VerifyingKey<C>> for EncodedPoint<C>where
C: PrimeCurve + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§fn from(verifying_key: &VerifyingKey<C>) -> EncodedPoint<C>
fn from(verifying_key: &VerifyingKey<C>) -> EncodedPoint<C>
Source§impl<C> From<&VerifyingKey<C>> for PublicKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
impl<C> From<&VerifyingKey<C>> for PublicKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Source§fn from(verifying_key: &VerifyingKey<C>) -> PublicKey<C>
fn from(verifying_key: &VerifyingKey<C>) -> PublicKey<C>
Source§impl<C> From<PublicKey<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
impl<C> From<PublicKey<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Source§fn from(public_key: PublicKey<C>) -> VerifyingKey<C>
fn from(public_key: PublicKey<C>) -> VerifyingKey<C>
Source§impl<C> From<VerifyingKey<C>> for PublicKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
impl<C> From<VerifyingKey<C>> for PublicKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Source§fn from(verifying_key: VerifyingKey<C>) -> PublicKey<C>
fn from(verifying_key: VerifyingKey<C>) -> PublicKey<C>
Source§impl<C> FromStr for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> FromStr for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§impl<C> Ord for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> Ord for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§impl<C> PartialEq for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
impl<C> PartialEq for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Source§impl<C> PartialOrd for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> PartialOrd for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§impl<C> PrehashVerifier<Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic + DigestPrimitive,
AffinePoint<C>: VerifyPrimitive<C>,
Scalar<C>: Reduce<C::UInt>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> PrehashVerifier<Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic + DigestPrimitive,
AffinePoint<C>: VerifyPrimitive<C>,
Scalar<C>: Reduce<C::UInt>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> Serialize for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> Serialize for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§impl<C> TryFrom<&[u8]> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> TryFrom<&[u8]> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§impl<C> TryFrom<SubjectPublicKeyInfo<'_>> for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
impl<C> TryFrom<SubjectPublicKeyInfo<'_>> for VerifyingKey<C>where
C: PrimeCurve + AssociatedOid + ProjectiveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldSize<C>: ModulusSize,
Source§impl<C> Verifier<Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic + DigestPrimitive,
C::Digest: FixedOutput<OutputSize = FieldSize<C>>,
AffinePoint<C>: VerifyPrimitive<C>,
Scalar<C>: Reduce<C::UInt>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Verifier<Signature<C>> for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic + DigestPrimitive,
C::Digest: FixedOutput<OutputSize = FieldSize<C>>,
AffinePoint<C>: VerifyPrimitive<C>,
Scalar<C>: Reduce<C::UInt>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Copy for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
impl<C> Eq for VerifyingKey<C>where
C: PrimeCurve + ProjectiveArithmetic,
Auto Trait Implementations§
impl<C> Freeze for VerifyingKey<C>where
<C as AffineArithmetic>::AffinePoint: Freeze,
impl<C> RefUnwindSafe for VerifyingKey<C>where
<C as AffineArithmetic>::AffinePoint: RefUnwindSafe,
impl<C> Send for VerifyingKey<C>
impl<C> Sync for VerifyingKey<C>
impl<C> Unpin for VerifyingKey<C>where
<C as AffineArithmetic>::AffinePoint: Unpin,
impl<C> UnwindSafe for VerifyingKey<C>where
<C as AffineArithmetic>::AffinePoint: UnwindSafe,
Blanket Implementations§
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)