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
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.
KeyPair
Pair of matching secret and public keys.
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.

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.
hash
Calculates a hash of a bytes slice.
init
Initializes the cryptographic backend.
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.