Functions for the core crypto.
Nonce | Nonce for asymmetric authenticated encryption
|
PrecomputedKey | Applications that send several messages to the same receiver can gain speed by
splitting seal() into two steps, precompute() and seal_precomputed() .
Similarly, applications that receive several messages from the same sender can gain
speed by splitting open() into two steps, precompute() and open_precomputed() .
|
PublicKey | PublicKey for asymmetric authenticated encryption
|
SecretKey | SecretKey for asymmetric authenticated encryption
|
Seed | Seed that can be used for keypair generation
|
Tag | Authentication Tag for the detached encryption mode
|
MACBYTES | Number of bytes in the authenticator tag of an encrypted message
i.e. the number of bytes by which the ciphertext is larger than the
plaintext.
|
NONCEBYTES | Number of bytes in a Nonce .
|
PRECOMPUTEDKEYBYTES | Number of bytes in a PrecomputedKey .
|
PUBLICKEYBYTES | Number of bytes in a PublicKey .
|
SECRETKEYBYTES | Number of bytes in a SecretKey .
|
SEEDBYTES | Number of bytes in a Seed .
|
crypto_init | Run before using crypto.
|
decrypt_data_symmetric | Returns plain data from encrypted , with length of encrypted - 16 due to
padding, or () if data couldn't be decrypted.
|
digest_as_pk | Convert sha256 Digest to PublicKey type.
|
encrypt_data_symmetric | Returns encrypted data from plain , with length of plain + 16 due to
padding.
|
encrypt_precompute | Precomputes the shared key from their_public_key and our_secret_key .
|
gen_keypair | gen_keypair() randomly generates a secret key and a corresponding public key.
|
gen_nonce | gen_nonce() randomly generates a nonce
|
increment_nonce | Inrement given nonce by 1.
|
increment_nonce_number | Inrement given nonce by number num .
|
keypair_from_seed | key_pair_from_seed() deterministically derives a key pair from a single key seed (crypto_box_SEEDBYTES bytes).
|
open | open() verifies and decrypts a ciphertext c using the receiver's secret key sk ,
the senders public key pk , and a nonce n . It returns a plaintext Ok(m) .
If the ciphertext fails verification, open() returns Err(()) .
|
open_detached | open_detached() verifies and decrypts a ciphertext c using the receiver's secret key sk ,
the senders public key pk , and a nonce n . c is decrypted in place, so if this function is
successful it will contain the plaintext. If the ciphertext fails verification,
open_detached() returns Err(()) , and the ciphertext is not modified.
|
open_detached_precomputed | open_detached_precomputed() verifies and decrypts a ciphertext c using a precomputed key
k and a nonce n . c is decrypted in place, so if this function is successful it will
contain the plaintext. If the ciphertext fails verification, open_detached() returns
Err(()) , and the ciphertext is not modified.
|
open_precomputed | open_precomputed() verifies and decrypts a ciphertext c using a precomputed
key k and a nonce n . It returns a plaintext Ok(m) .
If the ciphertext fails verification, open_precomputed() returns Err(()) .
|
pk_as_digest | Convert PublicKey to sha256 Digest type.
|
precompute | precompute() computes an intermediate key that can be used by seal_precomputed()
and open_precomputed()
|
public_key_valid | Check if Tox public key PUBLICKEYBYTES is valid. Should be used only for
input validation.
|
random_limit_usize | Return unbiased random number from [0, limit) interval.
|
random_u32 | Return a random number.
|
random_u64 | Return a random number.
|
random_usize | Return a random number.
|
randombytes_into | randombytes_into() fills a buffer buf with random data.
|
seal | seal() encrypts and authenticates a message m using the senders secret key sk ,
the receivers public key pk and a nonce n . It returns a ciphertext c .
|
seal_detached | seal_detached() encrypts and authenticates a message m using the senders secret key sk ,
the receivers public key pk and a nonce n . m is encrypted in place, so after this
function returns it will contain the ciphertext. The detached authentication tag is returned by
value.
|
seal_detached_precomputed | seal_detached_precomputed() encrypts and authenticates a message m using a precomputed key
k and a nonce n . m is encrypted in place, so after this function returns it will contain
the ciphertext. The detached authentication tag is returned by value.
|
seal_precomputed | seal_precomputed() encrypts and authenticates a message m using a precomputed key k ,
and a nonce n . It returns a ciphertext c .
|