License | AGPL-3 |
---|---|
Maintainer | Kinoru |
Stability | Provisional |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Simple interface to the cryptographic primitives that are provided by the cryptonite package.
- getRandomBytes :: Int -> IO ByteString
- scrypt :: ByteString -> ByteString -> ByteString
- encrypt :: ByteString -> ByteString -> ByteString -> CryptoFailable ByteString
- decrypt :: ByteString -> ByteString -> CryptoFailable ByteString
- encryptFileName :: ByteString -> ByteString -> ByteString
- decryptFileName :: ByteString -> ByteString -> ByteString
- module Crypto.Error
Documentation
getRandomBytes :: Int -> IO ByteString Source
Read bytes from /dev/urandom
.
:: ByteString | input |
-> ByteString | salt |
-> ByteString | output (32 bytes) |
The scrypt key derivation function from Crypto.KDF.Scrypt. The parameters are:
- CPU/memory cost parameter N = 16384 (2^14)
- SMix function parameter r = 8
- Parallelization parameter p = 1
- Intended output length dkLen = 32 (for use in ChaCha20-Poly1305)
:: ByteString | nonce (12 random bytes, must be different each time) |
-> ByteString | the secret symmetric key |
-> ByteString | the plaintext to be encrypted |
-> CryptoFailable ByteString | ciphertext with a 128-bit tag attached |
Encrypt the given ByteString
using the
ChaCha20-Poly1305 scheme
from Crypto.Cipher.ChaChaPoly1305.
The resulting ByteString
is nonce (12 bytes) ++ ciphertext ++
the auth tag (16 bytes).
:: ByteString | the secret symmetric key |
-> ByteString | the input (nonce ++ ciphertext ++ tag) |
-> CryptoFailable ByteString | the decrypted plaintext |
Decrypt a ByteString
that is produced by the encrypt
function.
:: ByteString | file name |
-> ByteString | key |
-> ByteString |
Encryption of unbreak file names.
decryptFileName :: ByteString -> ByteString -> ByteString Source
Decryption of unbreak file names.
module Crypto.Error