pub struct PublicKey { /* private fields */ }
Expand description

Represents a public key for both the client and server.

This is used instead of a raw array in order to move the error of verifying the key out of the proof functions in order to increase readability.

Will return an error if all elements are 0, or the bytes represented as an integer modulus the large safe prime is equal to 0. Since the large safe prime multiplied by 2 results in a 33 byte value it is unrepresentable as a public key and thus the only two failure opportunities are if the key is exactly zero or if it is exactly equal to the large safe prime.

Implementations

Returns the value as little endian bytes.

The bytes are stored internally as little endian, so this causes no reversal.

Creates the struct from little endian bytes.

Values are stored internally as little endian so no reversal occurs.

Errors

Will error if the public key is invalid. See PublicKey for specifics.

Trait Implementations

Formats the value using the given formatter. Read more

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

This method tests for !=.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

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.