Expand description

Submodule of crypto utils for working with public key crypto primitives If you are looking for git history please refer to the ethkey crate in the parity-ethereum repository.

Re-exports

pub use self::error::Error;

Modules

Multiple primitives for work with public and secret keys and with secp256k1 curve points

ECDH key agreement scheme implemented as a free function.

Functions for ECIES scheme encryption and decryption

Module specific errors.

Structs

Extended public key, allows deterministic derivation of subsequent keys.

Extended secret key, allows deterministic derivation of subsequent keys.

secp256k1 key pair

Randomly generates new keypair, instantiating the RNG each time.

Represents secret key

Signature encoded as RSV components

In ethereum we allow public key recovery from a signature + message pair where the message is all-zeroes. This conflicts with the best practise of not allowing such values and so in order to avoid breaking consensus we need this to work around it. The ZeroesAllowedType wraps an H256 that can be converted to a [u8; 32] which in turn can be cast to a secp256k1::Message by the ThirtyTwoByteHash and satisfy the API for recover().

A wrapper type around SecretKey to prevent leaking secret key data. This type will properly zeroize the secret key to ONE_KEY in a way that will not get optimized away by the compiler nor be prone to leaks that take advantage of access reordering.

Enums

Key derivation over generic label T

Traits

Generates new keypair.

Functions

Convert public key into the address

Recovers the public key from the signature for the message

Recovers the public key from the signature for the given message. This version of recover() allows for all-zero messages, which is necessary for ethereum but is otherwise highly discouraged. Use with caution.

Signs message with the given secret key. Returns the corresponding signature.

Checks if the address corresponds to the public key from the signature for the message

Performs verification of the signature for the given message with corresponding public key

Type Definitions