Box
NaCl-compatible box API.
A secretbox contains both an encrypted message and an authentication tag to verify that it hasn't been tampered with. This construction uses public-key cryptography. A shared secret doesn't have to be known in advance by both parties. Instead, a message is encrypted using a sender's secret key and a recipient's public key, and is decrypted using the recipient's secret key and the sender's public key.
Nonces are 192-bit large and can safely be chosen with a random number generator.
A key pair.
Types
- KeyPair
- A key pair.
Compute a secret suitable for `secretbox` given a recipient's public key and a sender's secret key.
Functions
- createSharedSecret
- Compute a secret suitable for `secretbox` given a recipient's public key and a sender's secret key.
- seal
- Encrypt and authenticate a message using a recipient's public key `public_key` and a sender's `secret_key`.
- open
- Verify and decrypt a message using a recipient's secret key `public_key` and a sender's `public_key`.
Public key length in bytes.
Values
- public_length
- Public key length in bytes.
- secret_length
- Secret key length in bytes.
- shared_length
- Shared key length in bytes.
- seed_length
- Seed (for key pair creation) length in bytes.
- nonce_length
- Nonce length in bytes.
- tag_length
- Authentication tag length in bytes.