Crate safe_crypto[][src]

This is a convenience library providing abstractions for cryptographic functions required by other SAFE Network libraries.

Structs

PublicId

Represents a public identity, consisting of a public signature key and a public encryption key.

SecretId

Secret counterpart of the public identity, consisting of a secret signing key and a secret encryption key.

SharedSecretKey

Precomputed shared secret key. Can be created from a pair of our secret key and the recipient's public key. As a result, we'll get the same key as the recipient with their secret key and our public key.

Signature

Detached signature.

SymmetricKey

Secret key for authenticated symmetric encryption.

Enums

EncryptionError

This error is returned if encryption or decryption fail. The encryption failure is rare and mostly connected to serialisation failures. Decryption can fail because of invalid keys, invalid data, or deserialisation failures.

Functions

init

Initialise random number generator for the key generation functions.

init_with_rng

Initialise the key generation functions with a custom random number generator rng. Can be used for deterministic key generation in tests. Returns an error in case of an random generator initialisation error.