pub type PublicKey = PublicKey<NistP256>;
Expand description
NIST P-256 public key.
Aliased Type§
struct PublicKey { /* private fields */ }
Implementations
Source§impl<C> PublicKey<C>where
C: CurveArithmetic,
impl<C> PublicKey<C>where
C: CurveArithmetic,
Sourcepub fn from_affine(
point: <C as CurveArithmetic>::AffinePoint,
) -> Result<PublicKey<C>, Error>
pub fn from_affine( point: <C as CurveArithmetic>::AffinePoint, ) -> Result<PublicKey<C>, Error>
Convert an AffinePoint
into a PublicKey
Sourcepub fn from_secret_scalar(scalar: &NonZeroScalar<C>) -> PublicKey<C>
pub fn from_secret_scalar(scalar: &NonZeroScalar<C>) -> PublicKey<C>
Compute a PublicKey
from a secret NonZeroScalar
value
(i.e. a secret key represented as a raw scalar value)
Sourcepub fn from_sec1_bytes(bytes: &[u8]) -> Result<PublicKey<C>, Error>where
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
pub fn from_sec1_bytes(bytes: &[u8]) -> Result<PublicKey<C>, Error>where
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
Decode PublicKey
(compressed or uncompressed) from the
Elliptic-Curve-Point-to-Octet-String
encoding described in
SEC 1: Elliptic Curve Cryptography (Version 2.0) section
2.3.3 (page 10).
Sourcepub fn as_affine(&self) -> &<C as CurveArithmetic>::AffinePoint
pub fn as_affine(&self) -> &<C as CurveArithmetic>::AffinePoint
Borrow the inner AffinePoint
from this PublicKey
.
In ECC, public keys are elliptic curve points.
Sourcepub fn to_projective(&self) -> <C as CurveArithmetic>::ProjectivePoint
pub fn to_projective(&self) -> <C as CurveArithmetic>::ProjectivePoint
Convert this PublicKey
to a ProjectivePoint
for the given curve
Sourcepub fn to_nonidentity(&self) -> NonIdentity<<C as CurveArithmetic>::AffinePoint>
pub fn to_nonidentity(&self) -> NonIdentity<<C as CurveArithmetic>::AffinePoint>
Convert this PublicKey
to a NonIdentity
of the inner AffinePoint
Trait Implementations
Source§impl<C> AsRef<<C as CurveArithmetic>::AffinePoint> for PublicKey<C>where
C: CurveArithmetic,
impl<C> AsRef<<C as CurveArithmetic>::AffinePoint> for PublicKey<C>where
C: CurveArithmetic,
Source§fn as_ref(&self) -> &<C as CurveArithmetic>::AffinePoint
fn as_ref(&self) -> &<C as CurveArithmetic>::AffinePoint
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<C, P> From<&NonIdentity<P>> for PublicKey<C>
impl<C, P> From<&NonIdentity<P>> for PublicKey<C>
Source§fn from(value: &NonIdentity<P>) -> PublicKey<C>
fn from(value: &NonIdentity<P>) -> PublicKey<C>
Converts to this type from the input type.
Source§impl<C> From<&VerifyingKey<C>> for PublicKey<C>where
C: PrimeCurve + CurveArithmetic,
impl<C> From<&VerifyingKey<C>> for PublicKey<C>where
C: PrimeCurve + CurveArithmetic,
Source§fn from(verifying_key: &VerifyingKey<C>) -> PublicKey<C>
fn from(verifying_key: &VerifyingKey<C>) -> PublicKey<C>
Converts to this type from the input type.
Source§impl<C, P> From<NonIdentity<P>> for PublicKey<C>
impl<C, P> From<NonIdentity<P>> for PublicKey<C>
Source§fn from(value: NonIdentity<P>) -> PublicKey<C>
fn from(value: NonIdentity<P>) -> PublicKey<C>
Converts to this type from the input type.
Source§impl<C> From<VerifyingKey<C>> for PublicKey<C>where
C: PrimeCurve + CurveArithmetic,
impl<C> From<VerifyingKey<C>> for PublicKey<C>where
C: PrimeCurve + CurveArithmetic,
Source§fn from(verifying_key: VerifyingKey<C>) -> PublicKey<C>
fn from(verifying_key: VerifyingKey<C>) -> PublicKey<C>
Converts to this type from the input type.
Source§impl<C> FromEncodedPoint<C> for PublicKey<C>where
C: CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
impl<C> FromEncodedPoint<C> for PublicKey<C>where
C: CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
Source§fn from_encoded_point(
encoded_point: &EncodedPoint<<C as Curve>::FieldBytesSize>,
) -> CtOption<PublicKey<C>>
fn from_encoded_point( encoded_point: &EncodedPoint<<C as Curve>::FieldBytesSize>, ) -> CtOption<PublicKey<C>>
Initialize PublicKey
from an EncodedPoint
Source§impl<C> Ord for PublicKey<C>where
C: CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
impl<C> Ord for PublicKey<C>where
C: CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<C> PartialOrd for PublicKey<C>where
C: CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
impl<C> PartialOrd for PublicKey<C>where
C: CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
Source§impl<C> ToEncodedPoint<C> for PublicKey<C>where
C: CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
impl<C> ToEncodedPoint<C> for PublicKey<C>where
C: CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
Source§fn to_encoded_point(
&self,
compress: bool,
) -> EncodedPoint<<C as Curve>::FieldBytesSize>
fn to_encoded_point( &self, compress: bool, ) -> EncodedPoint<<C as Curve>::FieldBytesSize>
Serialize this PublicKey
as a SEC1 EncodedPoint
, optionally applying
point compression
Source§impl<C> TryFrom<&AffinePoint<C>> for PublicKey<C>where
C: PrimeCurveParams,
impl<C> TryFrom<&AffinePoint<C>> for PublicKey<C>where
C: PrimeCurveParams,
Source§impl<C> TryFrom<&EncodedPoint<<C as Curve>::FieldBytesSize>> for PublicKey<C>where
C: CurveArithmetic,
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
impl<C> TryFrom<&EncodedPoint<<C as Curve>::FieldBytesSize>> for PublicKey<C>where
C: CurveArithmetic,
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
Source§impl<C> TryFrom<&GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>> for PublicKey<C>where
C: CurveArithmetic,
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
impl<C> TryFrom<&GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>> for PublicKey<C>where
C: CurveArithmetic,
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
Source§fn try_from(
point: &GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>,
) -> Result<PublicKey<C>, Error>
fn try_from( point: &GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>, ) -> Result<PublicKey<C>, Error>
Performs the conversion.
Source§impl<C> TryFrom<&ProjectivePoint<C>> for PublicKey<C>where
C: PrimeCurveParams,
impl<C> TryFrom<&ProjectivePoint<C>> for PublicKey<C>where
C: PrimeCurveParams,
Source§impl<C> TryFrom<AffinePoint<C>> for PublicKey<C>where
C: PrimeCurveParams,
impl<C> TryFrom<AffinePoint<C>> for PublicKey<C>where
C: PrimeCurveParams,
Source§impl<C> TryFrom<EncodedPoint<<C as Curve>::FieldBytesSize>> for PublicKey<C>where
C: CurveArithmetic,
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
impl<C> TryFrom<EncodedPoint<<C as Curve>::FieldBytesSize>> for PublicKey<C>where
C: CurveArithmetic,
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
Source§impl<C> TryFrom<GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>> for PublicKey<C>where
C: CurveArithmetic,
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
impl<C> TryFrom<GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>> for PublicKey<C>where
C: CurveArithmetic,
<C as Curve>::FieldBytesSize: ModulusSize,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
Source§fn try_from(
point: GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>,
) -> Result<PublicKey<C>, Error>
fn try_from( point: GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>, ) -> Result<PublicKey<C>, Error>
Performs the conversion.