NaCl crypto/secret box implementations based on crypton primitives.
This library provides a high-level API for authenticated encryption and decryption using the NaCl crypto_box and crypto_secretbox constructs.
The API is implemented in pure Haskell using XSalsa and Poly1305 primitives provided by the crypton library.
Important: This library has not been professionally reviewed. Sidechannel attacks and memory-related vulnerabilities may exist! Use at yourown risk.
(P.S. I would love to hear from you if you can audit this library andimprove its security!)
crypton-box
crypton-box
is a Haskell library that provides NaCl's box and secretbox operations, using primitives provided in crypton
.
Important: This library is provided as a proof of concept. Please carefully evaluate the security related to your requirements before using! No professional security review has taken place for the implementations, and I strongly recommended not to use this library for anything critical.
Usage
Qualified imports are recommended for use:
import qualified Crypto.PubKey.Curve25519 as X25519
import qualified Crypto.Box as Box
message, nonce :: B.ByteString
secret :: X25519.DhSecret
encrypted :: B.ByteString
encrypted = Box.create message nonce secret
decrypted :: B.ByteString
decrypted = Box.open encrypted nonce secret