- type Key = ByteString
- getKey :: FilePath -> IO Key
- embedKey :: FilePath -> Q Exp
- defaultKeyFile :: String
- getDefaultKey :: IO Key
- embedDefaultKey :: Q Exp
- encrypt :: ByteString -> ByteString -> ByteString
- decrypt :: ByteString -> ByteString -> Maybe ByteString
Automatic key generation
type Key = ByteStringSource
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.
embedKey :: FilePath -> Q ExpSource
Embed a key from the given text file into haskell source.
Eliminates overhead of reading key file with each request.
defaultKeyFile :: StringSource
The default key file.
Simply calls getKey
defaultKeyFile
.
embedDefaultKey :: Q ExpSource
Simply calls embedKey
defaultKeyFile
.
Actual encryption/decryption
:: ByteString | key |
-> ByteString | data |
-> ByteString |
:: ByteString | key |
-> ByteString | data |
-> Maybe ByteString |