Struct ethers::core::k256::elliptic_curve::PublicKey[][src]

pub struct PublicKey<C> where
    C: Curve + ProjectiveArithmetic
{ /* fields omitted */ }
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][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

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.

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

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

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

Calculate the base32 serialized length

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Error type if conversion fails

Check if all values are in range and return array-like struct of u5 values

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate. Read more

Convert Self to base32 vector

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more

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)

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more