[][src]Crate exonum_crypto

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

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

Structs

Hash

The result of applying the SHA-256 hash function to data.

HashStream

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.

PublicKey

Ed25519 public key used to verify digital signatures.

SecretKey

Ed25519 secret key used to create digital signatures over messages.

Seed

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.

SignStream

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.

Signature

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

HASH_SIZE

Number of bytes in a Hash.

PUBLIC_KEY_LENGTH

Number of bytes in a public key.

SECRET_KEY_LENGTH

Number of bytes in a secret key.

SEED_LENGTH

Number of bytes in a seed.

SIGNATURE_LENGTH

Number of bytes in a signature.

Traits

CryptoHash

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

Functions

gen_keypair

Generates a secret key and a corresponding public key using a cryptographically secure pseudo-random number generator.

gen_keypair_from_seed

Computes a secret key and a corresponding public key from a Seed.

generate_keys_file

Creates a TOML file that contains encrypted SecretKey and returns PublicKey for the secret key.

hash

Calculates a hash of a bytes slice.

init

Initializes the cryptographic backend.

read_keys_from_file

Reads and returns PublicKey and SecretKey from encrypted file located by path and returns its.

sign

Signs a slice of bytes using the signer's secret key and returns the resulting Signature.

verify

Verifies that data is signed with a secret key corresponding to the given public key.