libsodium-bindings-0.0.1.1: FFI bindings to libsodium
LicenseBSD-3-Clause
MaintainerThe Haskell Cryptography Group
StabilityStable
PortabilityGHC only
Safe HaskellNone
LanguageHaskell2010

LibSodium.Bindings.SealedBoxes

Description

 
Synopsis

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

cryptoBoxSeal Source #

Arguments

:: Ptr CUChar

Buffer that will hold the encrypted message of size (size of original message + cryptoBoxSealbytes) bytes

-> Ptr CUChar

Buffer that holds the plaintext message

-> CULLong

Length of the plaintext message

-> Ptr CUChar

Buffer that holds public key of size cryptoBoxPublicKeyBytes bytes.

-> 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

cryptoBoxSealOpen Source #

Arguments

:: Ptr CUChar

Buffer that will hold the plaintext message of size (size of original message - cryptoBoxSealbytes) bytes

-> Ptr CUChar

Buffer that holds the encrypted message.

-> CULLong

Length of the encrypted message

-> Ptr CUChar

Buffer that holds public key of size cryptoBoxPublicKeyBytes bytes.

-> Ptr CUChar

Buffer that holds secret key of size cryptoBoxSecretKeyBytes bytes.

-> 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.

See: crypto_box_seal_open()

Since: 0.0.1.0

cryptoBoxKeyPair Source #

Arguments

:: Ptr CUChar

Buffer that will hold the public key, of size cryptoBoxPublicKeyBytes

-> Ptr CUChar

Buffer that will hold the secret key, of size cryptoBoxSecretKeyBytes

-> 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

cryptoBoxSeedKeyPair Source #

Arguments

:: Ptr CUChar

Buffer that will hold the public key, of size cryptoBoxPublicKeyBytes

-> Ptr CUChar

Buffer that will hold the secret key, of size cryptoBoxSecretKeyBytes

-> Ptr CUChar

Buffer that holds the seed, of size cryptoBoxSeedBytes

-> 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