crypton-box: NaCl crypto/secret box implementations based on crypton primitives.

[ bsd3, cryptography, library ] [ Propose Tags ] [ Report a vulnerability ]

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. Side channel attacks and memory-related vulnerabilities may exist! Use at your own risk.

(P.S. I would love to hear from you if you can audit this library and improve its security!)


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.1.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), bytestring (>=0.9 && <1.0.0.0), crypton (>=1.0.0 && <2.0.0), memory (>=0.18 && <1.0) [details]
Tested with ghc ==9.4.8
License BSD-3-Clause
Copyright 2025 Yuto Takano
Author Yuto Takano
Maintainer moa17stock@gmail.com
Category Cryptography
Home page https://github.com/yutotakano/crypton-box#readme
Bug tracker https://github.com/yutotakano/crypton-box/issues
Source repo head: git clone https://github.com/yutotakano/crypton-box
Uploaded by yutotakano at 2025-02-05T21:40:35Z
Distributions
Downloads 17 total (17 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
All reported builds failed as of 2025-02-05 [all 1 reports]

Readme for crypton-box-1.1.0

[back to package description]

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