Crate exonum_crypto

source ·
Expand description

Cryptography related types, constants, traits and functions. The functions in this library are used for key generation, hashing, signing and signature verification.

The Crypto library makes it possible to potentially change the type of cryptography applied in the system and add abstractions best suited for Exonum.

Modules

X25519 related types and methods used in Diffie-Hellman key exchange.

Structs

The result of applying the SHA-256 hash function to data.
This structure provides a possibility to calculate a hash digest for a stream of data. Unlike the Hash structure, the given structure lets the code process several data chunks without the need to copy them into a single buffer.
Ed25519 public key used to verify digital signatures.
Ed25519 secret key used to create digital signatures over messages.
Ed25519 seed representing a succession of bytes that can be used for deterministic keypair generation. If the same seed is indicated in the generator multiple times, the generated keys will be the same each time.
This structure provides a possibility to create and/or verify digital signatures for a stream of data. If the data are split into several chunks, the indicated chunks are added to the system and when adding is complete, the data is signed.
Ed25519 digital signature. This structure creates a signature over data using a secret key. Later it is possible to verify, using the corresponding public key, that the data have indeed been signed with that secret key.

Constants

Number of bytes in a Hash.
Number of bytes in a public key.
Number of bytes in a secret key.
Number of bytes in a seed.
Number of bytes in a signature.

Traits

A common trait for the ability to compute a cryptographic hash.

Functions

Generates a secret key and a corresponding public key using a cryptographically secure pseudo-random number generator.
Computes a secret key and a corresponding public key from a Seed.
Creates a TOML file that contains encrypted SecretKey and returns PublicKey for the secret key.
Calculates a hash of a bytes slice.
Initializes the cryptographic backend.
Reads and returns PublicKey and SecretKey from encrypted file located by path and returns its.
Signs a slice of bytes using the signer’s secret key and returns the resulting Signature.
Verifies that data is signed with a secret key corresponding to the given public key.