pub type PublicKey = PublicKey<NistP384>;
Expand description
NIST P-384 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<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> AssociatedAlgorithmIdentifier for PublicKey<C>where
C: AssociatedOid + CurveArithmetic,
impl<C> AssociatedAlgorithmIdentifier for PublicKey<C>where
C: AssociatedOid + CurveArithmetic,
Source§const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<ObjectIdentifier>
const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<ObjectIdentifier>
AlgorithmIdentifier
for this structure.Source§type Params = ObjectIdentifier
type Params = ObjectIdentifier
Source§impl<C> EncodePublicKey for PublicKey<C>where
C: AssociatedOid + CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
impl<C> EncodePublicKey for PublicKey<C>where
C: AssociatedOid + CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
Source§fn to_public_key_der(&self) -> Result<Document, Error>
fn to_public_key_der(&self) -> Result<Document, Error>
Document
containing a SPKI-encoded public key.Source§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§fn write_public_key_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
fn write_public_key_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
Source§fn write_public_key_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding,
) -> Result<(), Error>
fn write_public_key_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding, ) -> Result<(), Error>
Source§impl<C> From<&EphemeralSecret<C>> for PublicKey<C>where
C: CurveArithmetic,
impl<C> From<&EphemeralSecret<C>> for PublicKey<C>where
C: CurveArithmetic,
Source§fn from(ephemeral_secret: &EphemeralSecret<C>) -> PublicKey<C>
fn from(ephemeral_secret: &EphemeralSecret<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, 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> FromStr for PublicKey<C>where
C: AssociatedOid + CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
impl<C> FromStr for PublicKey<C>where
C: AssociatedOid + CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
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