Struct elliptic_curve::PublicKey[][src]

pub struct PublicKey<C> where
    C: Curve + ProjectiveArithmetic
{ /* fields omitted */ }
This is supported on crate feature arithmetic only.
Expand description

Elliptic curve public keys.

This is a wrapper type for AffinePoint which ensures an inner non-identity point and provides a common place to handle encoding/decoding.

Parsing “SPKI” Keys

X.509 SubjectPublicKeyInfo (SPKI) is a commonly used format for encoding public keys, notably public keys corresponding to PKCS#8 private keys. (especially ones generated by OpenSSL).

Keys in SPKI format are either binary (ASN.1 BER/DER), or PEM encoded (ASCII) and begin with the following:

-----BEGIN PUBLIC KEY-----

To decode an elliptic curve public key from SPKI, enable the pkcs8 feature of this crate (or the pkcs8 feature of a specific RustCrypto elliptic curve crate) and use the elliptic_curve::pkcs8::FromPublicKey trait to parse it.

When the pem feature of this crate (or a specific RustCrypto elliptic curve crate) is enabled, a FromStr impl is also available.

Implementations

Convert an AffinePoint into a PublicKey

Compute a PublicKey from a secret NonZeroScalar value (i.e. a secret key represented as a raw scalar value)

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).

http://www.secg.org/sec1-v2.pdf

Borrow the inner AffinePoint from this PublicKey.

In ECC, public keys are elliptic curve points.

Convert this PublicKey to a ProjectivePoint for the given curve

This is supported on crate feature jwk only.

Parse a JwkEcKey JSON Web Key (JWK) into a PublicKey.

This is supported on crate feature jwk only.

Parse a string containing a JSON Web Key (JWK) into a PublicKey.

This is supported on crate feature jwk only.

Serialize this public key as JwkEcKey JSON Web Key (JWK).

This is supported on crate feature jwk only.

Serialize this public key as JSON Web Key (JWK) string.

Trait Implementations

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Initialize PublicKey from an EncodedPoint

Parse SubjectPublicKeyInfo into a public key object.

Deserialize object from ASN.1 DER-encoded SubjectPublicKeyInfo (binary format). Read more

Deserialize PKCS#8 private key from a PrivateKeyDocument.

Deserialize PEM-encoded SubjectPublicKeyInfo. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this PublicKey as a SEC1 EncodedPoint, optionally applying point compression

Serialize a PublicKeyDocument containing a SPKI-encoded public key.

Serialize this public key as PEM-encoded SPKI.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.