pub type PublicKey = PublicKey<Secp256k1>;
Expand description
secp256k1 (K-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 to_sec1_bytes(&self) -> Box<[u8]>where
C: PointCompression,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
pub fn to_sec1_bytes(&self) -> Box<[u8]>where
C: PointCompression,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
Convert this PublicKey
into 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 TryFrom<&AffinePoint> for PublicKey
impl TryFrom<&AffinePoint> for PublicKey
Source§impl TryFrom<&ProjectivePoint> for PublicKey
impl TryFrom<&ProjectivePoint> for PublicKey
Source§impl TryFrom<AffinePoint> for PublicKey
impl TryFrom<AffinePoint> for PublicKey
Source§impl TryFrom<ProjectivePoint> for PublicKey
impl TryFrom<ProjectivePoint> for PublicKey
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
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>
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>
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>
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>
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,
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