- data Key = Key {}
- data IV
- randomIV :: IO IV
- mkIV :: ByteString -> Maybe IV
- getKey :: FilePath -> IO Key
- defaultKeyFile :: String
- getDefaultKey :: IO Key
- initKey :: ByteString -> Either String Key
- encrypt :: Key -> IV -> ByteString -> ByteString
- encryptIO :: Key -> ByteString -> IO ByteString
- decrypt :: Key -> ByteString -> Maybe ByteString
Automatic key generation
mkIV :: ByteString -> Maybe IVSource
Get a key from the given text file.
If the file does not exist a random key will be generated and stored in that file.
defaultKeyFile :: StringSource
The default key file.
Simply calls getKey
defaultKeyFile
.
initKey :: ByteString -> Either String KeySource
Initializes a Key
from a random ByteString
. It's
better to give a ByteString
with exactly 64 bytes, but
anything with at least 32 bytes will work.
Actual encryption/decryption
:: Key | |
-> IV | |
-> ByteString | data |
-> ByteString |
encryptIO :: Key -> ByteString -> IO ByteStringSource
:: Key | key |
-> ByteString | data |
-> Maybe ByteString |