License | BSD-3-Clause |
---|---|
Maintainer | The Haskell Cryptography Group |
Stability | Stable |
Portability | GHC only |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- cryptoBoxSeal :: Ptr CUChar -> Ptr CUChar -> CULLong -> Ptr CUChar -> IO CInt
- cryptoBoxSealOpen :: Ptr CUChar -> Ptr CUChar -> CULLong -> Ptr CUChar -> Ptr CUChar -> IO CInt
- cryptoBoxKeyPair :: Ptr CUChar -> Ptr CUChar -> IO CInt
- cryptoBoxSeedKeyPair :: Ptr CUChar -> Ptr CUChar -> Ptr CUChar -> IO CInt
- cryptoBoxSealbytes :: CSize
Introduction
Sealed boxes are designed to anonymously send messages to a recipient given their public key.
Only the recipient can decrypt these messages using their secret key. While the recipient can verify the integrity of the message, they cannot verify the identity of the sender.
A message is encrypted using an ephemeral key pair, with the secret key being erased right after the encryption process.
Without knowing the secret key used for a given message, the sender cannot decrypt the message later. Furthermore, without additional data, a message cannot be correlated with the identity of its sender.
Functions
:: Ptr CUChar | Buffer that will hold the encrypted message of size
(size of original message + |
-> Ptr CUChar | Buffer that holds the plaintext message |
-> CULLong | Length of the plaintext message |
-> Ptr CUChar | Buffer that holds public key of size
|
-> IO CInt | Returns 0 on success and -1 on error. |
cryptoBoxSeal
creates a new key pair for each message and attaches the public
key to the ciphertext. The secret key is overwritten and is not accessible
after this function returns.
See: crypto_box_seal()
Since: 0.0.1.0
:: Ptr CUChar | Buffer that will hold the plaintext message of size
(size of original message - |
-> Ptr CUChar | Buffer that holds the encrypted message. |
-> CULLong | Length of the encrypted message |
-> Ptr CUChar | Buffer that holds public key of size
|
-> Ptr CUChar | Buffer that holds secret key of size
|
-> IO CInt | Returns 0 on success and -1 on error. |
cryptoBoxSealOpen
doesn't require passing the public key of
the sender as the ciphertext already includes this information.
Key pairs are compatible with operations from CryptoBox
module and can be created using cryptoBoxKeyPair
or cryptoBoxSeedKeyPair
.
Since: 0.0.1.0
:: Ptr CUChar | Buffer that will hold the public key, of size |
-> Ptr CUChar | Buffer that will hold the secret key, of size |
-> IO CInt | The function returns 0 on success and -1 if something fails. |
Generate a random secret key and the corresponding public key.
See: crypto_box_keypair()
Since: 0.0.1.0
:: Ptr CUChar | Buffer that will hold the public key, of size |
-> Ptr CUChar | Buffer that will hold the secret key, of size |
-> Ptr CUChar | Buffer that holds the seed, of size |
-> IO CInt | The function returns 0 on success and -1 if something fails. |
Generate a random secret key and the corresponding public key in a deterministic manner from a single key that acts as a seed.
See: crypto_box_seed_keypair()
Since: 0.0.1.0
Constants
cryptoBoxSealbytes :: CSize Source #
Size diff in bytes between encrypted and plaintext messages, i.e.
cryptoBoxSealbytes = length encryptedMsg - length plaintextMsg
Since: 0.0.1.0