crypto-api 0.13.2 → 0.13.3
raw patch · 5 files changed
+160/−18 lines, 5 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Crypto.Classes: instance BlockCipher k => Serialize (IV k)
- Crypto.Classes.Exceptions: class CryptoRandomGen g where genBytesWithEntropy len entropy g = let res = genBytes len g in case res of { Left err -> Left err Right (bs, g') -> let entropy' = append entropy (replicate (len - length entropy) 0) in Right (zwp' entropy' bs, g') } newGenIO = go 0 where go 1000 = throw $ GenErrorOther $ "The generator instance requested by" ++ "newGenIO never instantiates (1000 tries). " ++ "It must be broken." go i = do { let p = Proxy getTypedGen :: CryptoRandomGen g => Proxy g -> IO (Either GenError g) getTypedGen pr = liftM newGen (getEntropy $ proxy genSeedLength pr); res <- getTypedGen p; case res of { Left _ -> go (i + 1) Right g -> return (g `asProxyTypeOf` p) } }
- Crypto.Classes.Exceptions: instance Data CipherError
- Crypto.Classes.Exceptions: instance Eq CipherError
- Crypto.Classes.Exceptions: instance Exception CipherError
- Crypto.Classes.Exceptions: instance Ord CipherError
- Crypto.Classes.Exceptions: instance Read CipherError
- Crypto.Classes.Exceptions: instance Show CipherError
- Crypto.Classes.Exceptions: instance Typeable CipherError
- Crypto.HMAC: instance Eq (MacKey c d)
- Crypto.HMAC: instance Ord (MacKey c d)
- Crypto.HMAC: instance Show (MacKey c d)
- Crypto.Random: class CryptoRandomGen g where genBytesWithEntropy len entropy g = let res = genBytes len g in case res of { Left err -> Left err Right (bs, g') -> let entropy' = append entropy (replicate (len - length entropy) 0) in Right (zwp' entropy' bs, g') } newGenIO = go 0 where go 1000 = throw $ GenErrorOther $ "The generator instance requested by" ++ "newGenIO never instantiates (1000 tries). " ++ "It must be broken." go i = do { let p = Proxy getTypedGen :: CryptoRandomGen g => Proxy g -> IO (Either GenError g) getTypedGen pr = liftM newGen (getEntropy $ proxy genSeedLength pr); res <- getTypedGen p; case res of { Left _ -> go (i + 1) Right g -> return (g `asProxyTypeOf` p) } }
- Crypto.Random: instance CryptoRandomGen SystemRandom
- Crypto.Random: instance Data GenError
- Crypto.Random: instance Data ReseedInfo
- Crypto.Random: instance Eq GenError
- Crypto.Random: instance Eq ReseedInfo
- Crypto.Random: instance Exception GenError
- Crypto.Random: instance Ord GenError
- Crypto.Random: instance Ord ReseedInfo
- Crypto.Random: instance Read GenError
- Crypto.Random: instance Read ReseedInfo
- Crypto.Random: instance Show GenError
- Crypto.Random: instance Show ReseedInfo
- Crypto.Random: instance Typeable GenError
- Crypto.Random: instance Typeable ReseedInfo
- Crypto.Types: initializationVector :: IV k -> {-# UNPACK #-} !ByteString
- Crypto.Types: instance Data BlockCipherError
- Crypto.Types: instance Eq (IV k)
- Crypto.Types: instance Eq BlockCipherError
- Crypto.Types: instance Exception BlockCipherError
- Crypto.Types: instance Ord (IV k)
- Crypto.Types: instance Ord BlockCipherError
- Crypto.Types: instance Read BlockCipherError
- Crypto.Types: instance Show (IV k)
- Crypto.Types: instance Show BlockCipherError
- Crypto.Types: instance Typeable BlockCipherError
+ Crypto.Classes: instance Crypto.Classes.BlockCipher k => Data.Serialize.Serialize (Crypto.Types.IV k)
+ Crypto.Classes.Exceptions: class CryptoRandomGen g
+ Crypto.Classes.Exceptions: instance Data.Data.Data Crypto.Classes.Exceptions.CipherError
+ Crypto.Classes.Exceptions: instance GHC.Classes.Eq Crypto.Classes.Exceptions.CipherError
+ Crypto.Classes.Exceptions: instance GHC.Classes.Ord Crypto.Classes.Exceptions.CipherError
+ Crypto.Classes.Exceptions: instance GHC.Exception.Exception Crypto.Classes.Exceptions.CipherError
+ Crypto.Classes.Exceptions: instance GHC.Read.Read Crypto.Classes.Exceptions.CipherError
+ Crypto.Classes.Exceptions: instance GHC.Show.Show Crypto.Classes.Exceptions.CipherError
+ Crypto.HMAC: instance GHC.Classes.Eq (Crypto.HMAC.MacKey c d)
+ Crypto.HMAC: instance GHC.Classes.Ord (Crypto.HMAC.MacKey c d)
+ Crypto.HMAC: instance GHC.Show.Show (Crypto.HMAC.MacKey c d)
+ Crypto.Random: class CryptoRandomGen g
+ Crypto.Random: instance Crypto.Random.CryptoRandomGen Crypto.Random.SystemRandom
+ Crypto.Random: instance Data.Data.Data Crypto.Random.GenError
+ Crypto.Random: instance Data.Data.Data Crypto.Random.ReseedInfo
+ Crypto.Random: instance GHC.Classes.Eq Crypto.Random.GenError
+ Crypto.Random: instance GHC.Classes.Eq Crypto.Random.ReseedInfo
+ Crypto.Random: instance GHC.Classes.Ord Crypto.Random.GenError
+ Crypto.Random: instance GHC.Classes.Ord Crypto.Random.ReseedInfo
+ Crypto.Random: instance GHC.Exception.Exception Crypto.Random.GenError
+ Crypto.Random: instance GHC.Read.Read Crypto.Random.GenError
+ Crypto.Random: instance GHC.Read.Read Crypto.Random.ReseedInfo
+ Crypto.Random: instance GHC.Show.Show Crypto.Random.GenError
+ Crypto.Random: instance GHC.Show.Show Crypto.Random.ReseedInfo
+ Crypto.Types: [initializationVector] :: IV k -> {-# UNPACK #-} !ByteString
+ Crypto.Types: instance Data.Data.Data Crypto.Types.BlockCipherError
+ Crypto.Types: instance GHC.Classes.Eq (Crypto.Types.IV k)
+ Crypto.Types: instance GHC.Classes.Eq Crypto.Types.BlockCipherError
+ Crypto.Types: instance GHC.Classes.Ord (Crypto.Types.IV k)
+ Crypto.Types: instance GHC.Classes.Ord Crypto.Types.BlockCipherError
+ Crypto.Types: instance GHC.Exception.Exception Crypto.Types.BlockCipherError
+ Crypto.Types: instance GHC.Read.Read Crypto.Types.BlockCipherError
+ Crypto.Types: instance GHC.Show.Show (Crypto.Types.IV k)
+ Crypto.Types: instance GHC.Show.Show Crypto.Types.BlockCipherError
- Crypto.Classes: blockSizeBytes :: BlockCipher k => Tagged k ByteLength
+ Crypto.Classes: blockSizeBytes :: (BlockCipher k) => Tagged k ByteLength
- Crypto.Classes: buildKeyIO :: BlockCipher k => IO k
+ Crypto.Classes: buildKeyIO :: (BlockCipher k) => IO k
- Crypto.Classes: buildSigningKeyPairIO :: Signing p v => BitLength -> IO (Either GenError (p, v))
+ Crypto.Classes: buildSigningKeyPairIO :: (Signing p v) => BitLength -> IO (Either GenError (p, v))
- Crypto.Classes: chunkFor :: BlockCipher k => k -> ByteString -> [ByteString]
+ Crypto.Classes: chunkFor :: (BlockCipher k) => k -> ByteString -> [ByteString]
- Crypto.Classes: chunkFor' :: BlockCipher k => k -> ByteString -> [ByteString]
+ Crypto.Classes: chunkFor' :: (BlockCipher k) => k -> ByteString -> [ByteString]
- Crypto.Classes: class Serialize k => BlockCipher k where ecb = modeEcb' unEcb = modeUnEcb' cbc = modeCbc' unCbc = modeUnCbc' ctr = modeCtr' incIV unCtr = modeUnCtr' incIV ctrLazy = modeCtr incIV unCtrLazy = modeUnCtr incIV cfb = modeCfb' unCfb = modeUnCfb' ofb = modeOfb' unOfb = modeUnOfb' cbcLazy = modeCbc unCbcLazy = modeUnCbc sivLazy = modeSiv unSivLazy = modeUnSiv siv = modeSiv' unSiv = modeUnSiv' ecbLazy = modeEcb unEcbLazy = modeUnEcb cfbLazy = modeCfb unCfbLazy = modeUnCfb ofbLazy = modeOfb unOfbLazy = modeUnOfb
+ Crypto.Classes: class (Serialize k) => BlockCipher k
- Crypto.Classes: class (Serialize d, Eq d, Ord d) => Hash ctx d | d -> ctx, ctx -> d where hash msg = res where res = finalize ctx end ctx = foldl' updateCtx initialCtx blks (blks, end) = makeBlocks msg blockLen blockLen = (blockLength .::. res) `div` 8 hash' msg = res where res = finalize (updateCtx initialCtx top) end (top, end) = splitAt remlen msg remlen = length msg - (length msg `rem` bLen) bLen = blockLength `for` res `div` 8
+ Crypto.Classes: class (Serialize d, Eq d, Ord d) => Hash ctx d | d -> ctx, ctx -> d
- Crypto.Classes: class Serialize k => StreamCipher k iv | k -> iv
+ Crypto.Classes: class (Serialize k) => StreamCipher k iv | k -> iv
- Crypto.Classes: decryptAsym :: (AsymCipher p v, CryptoRandomGen g) => g -> v -> ByteString -> Either GenError (ByteString, g)
+ Crypto.Classes: decryptAsym :: (AsymCipher p v, (CryptoRandomGen g)) => g -> v -> ByteString -> Either GenError (ByteString, g)
- Crypto.Classes: encryptAsym :: (AsymCipher p v, CryptoRandomGen g) => g -> p -> ByteString -> Either GenError (ByteString, g)
+ Crypto.Classes: encryptAsym :: (AsymCipher p v, (CryptoRandomGen g)) => g -> p -> ByteString -> Either GenError (ByteString, g)
- Crypto.Classes: getIVIO :: BlockCipher k => IO (IV k)
+ Crypto.Classes: getIVIO :: (BlockCipher k) => IO (IV k)
- Crypto.Classes: hash :: (Hash ctx d, Hash ctx d) => ByteString -> d
+ Crypto.Classes: hash :: (Hash ctx d, (Hash ctx d)) => ByteString -> d
- Crypto.Classes: hash' :: (Hash ctx d, Hash ctx d) => ByteString -> d
+ Crypto.Classes: hash' :: (Hash ctx d, (Hash ctx d)) => ByteString -> d
- Crypto.Classes: keyLengthBytes :: BlockCipher k => Tagged k ByteLength
+ Crypto.Classes: keyLengthBytes :: (BlockCipher k) => Tagged k ByteLength
- Crypto.Classes: zeroIV :: BlockCipher k => IV k
+ Crypto.Classes: zeroIV :: (BlockCipher k) => IV k
- Crypto.Classes.Exceptions: blockSizeBytes :: BlockCipher k => Tagged k ByteLength
+ Crypto.Classes.Exceptions: blockSizeBytes :: (BlockCipher k) => Tagged k ByteLength
- Crypto.Classes.Exceptions: buildKeyIO :: BlockCipher k => IO k
+ Crypto.Classes.Exceptions: buildKeyIO :: (BlockCipher k) => IO k
- Crypto.Classes.Exceptions: class Serialize k => BlockCipher k where ecb = modeEcb' unEcb = modeUnEcb' cbc = modeCbc' unCbc = modeUnCbc' ctr = modeCtr' incIV unCtr = modeUnCtr' incIV ctrLazy = modeCtr incIV unCtrLazy = modeUnCtr incIV cfb = modeCfb' unCfb = modeUnCfb' ofb = modeOfb' unOfb = modeUnOfb' cbcLazy = modeCbc unCbcLazy = modeUnCbc sivLazy = modeSiv unSivLazy = modeUnSiv siv = modeSiv' unSiv = modeUnSiv' ecbLazy = modeEcb unEcbLazy = modeUnEcb cfbLazy = modeCfb unCfbLazy = modeUnCfb ofbLazy = modeOfb unOfbLazy = modeUnOfb
+ Crypto.Classes.Exceptions: class (Serialize k) => BlockCipher k
- Crypto.Classes.Exceptions: class (Serialize d, Eq d, Ord d) => Hash ctx d | d -> ctx, ctx -> d where hash msg = res where res = finalize ctx end ctx = foldl' updateCtx initialCtx blks (blks, end) = makeBlocks msg blockLen blockLen = (blockLength .::. res) `div` 8 hash' msg = res where res = finalize (updateCtx initialCtx top) end (top, end) = splitAt remlen msg remlen = length msg - (length msg `rem` bLen) bLen = blockLength `for` res `div` 8
+ Crypto.Classes.Exceptions: class (Serialize d, Eq d, Ord d) => Hash ctx d | d -> ctx, ctx -> d
- Crypto.Classes.Exceptions: getIVIO :: BlockCipher k => IO (IV k)
+ Crypto.Classes.Exceptions: getIVIO :: (BlockCipher k) => IO (IV k)
- Crypto.Classes.Exceptions: hash :: (Hash ctx d, Hash ctx d) => ByteString -> d
+ Crypto.Classes.Exceptions: hash :: (Hash ctx d, (Hash ctx d)) => ByteString -> d
- Crypto.Classes.Exceptions: hash' :: (Hash ctx d, Hash ctx d) => ByteString -> d
+ Crypto.Classes.Exceptions: hash' :: (Hash ctx d, (Hash ctx d)) => ByteString -> d
- Crypto.Classes.Exceptions: keyLengthBytes :: BlockCipher k => Tagged k ByteLength
+ Crypto.Classes.Exceptions: keyLengthBytes :: (BlockCipher k) => Tagged k ByteLength
- Crypto.Classes.Exceptions: zeroIV :: BlockCipher k => IV k
+ Crypto.Classes.Exceptions: zeroIV :: (BlockCipher k) => IV k
- Crypto.HMAC: hmac :: Hash c d => MacKey c d -> ByteString -> d
+ Crypto.HMAC: hmac :: (Hash c d) => MacKey c d -> ByteString -> d
- Crypto.HMAC: hmac' :: Hash c d => MacKey c d -> ByteString -> d
+ Crypto.HMAC: hmac' :: (Hash c d) => MacKey c d -> ByteString -> d
Files
- Crypto/Classes.hs +2/−0
- Crypto/Classes.hs-boot +132/−3
- Crypto/Classes/Exceptions.hs +22/−13
- Crypto/Random.hs +3/−1
- crypto-api.cabal +1/−1
Crypto/Classes.hs view
@@ -490,6 +490,7 @@ privateKeyLength :: v -> BitLength -- |Build a pair of asymmetric keys using the system random generator.+-- WARNING: This function opens a file handle which will never be closed! buildKeyPairIO :: AsymCipher p v => BitLength -> IO (Either GenError (p,v)) buildKeyPairIO bl = do g <- newGenIO :: IO SystemRandom@@ -542,6 +543,7 @@ verifyingKeyLength :: p -> BitLength -- |Build a signing key using the system random generator+-- WARNING: This function opens a file handle which will never be closed! buildSigningKeyPairIO :: (Signing p v) => BitLength -> IO (Either GenError (p,v)) buildSigningKeyPairIO bl = do g <- newGenIO :: IO SystemRandom
Crypto/Classes.hs-boot view
@@ -1,4 +1,133 @@+{-|+ Maintainer: Thomas.DuBuisson@gmail.com+ Stability: beta+ Portability: portable + Authors: Thomas DuBuisson++This is the heart of the crypto-api package. By making (or having) an instance+of Hash, AsymCipher, BlockCipher or StreamCipher you provide (or obtain) access+to any infrastructure built on these primitives include block cipher modes of+operation, hashing, hmac, signing, etc. These classes allow users to build+routines that are agnostic to the algorithm used so changing algorithms is as+simple as changing a type signature.+-} module Crypto.Classes where- import Crypto.Types- class BlockCipher k- zeroIV :: (BlockCipher k) => IV k++ import Data.ByteString as B+ import Data.ByteString.Lazy as L+ import Crypto.Types+ import Data.Serialize+ import Data.Tagged++ class ( Serialize k) => BlockCipher k where+ blockSize :: Tagged k BitLength -- ^ The size of a single block; the smallest unit on which the cipher operates.+ encryptBlock :: k -> B.ByteString -> B.ByteString -- ^ encrypt data of size @n*blockSize@ where @n `elem` [0..]@ (ecb encryption)+ decryptBlock :: k -> B.ByteString -> B.ByteString -- ^ decrypt data of size @n*blockSize@ where @n `elem` [0..]@ (ecb decryption)+ buildKey :: B.ByteString -> Maybe k -- ^ smart constructor for keys from a bytestring.+ keyLength :: Tagged k BitLength -- ^ length of the cryptographic key++ -- * Modes of operation over strict bytestrings+ -- | Electronic Cookbook (encryption)+ ecb :: k -> B.ByteString -> B.ByteString+ ecb = modeEcb'+ -- | Electronic Cookbook (decryption)+ unEcb :: k -> B.ByteString -> B.ByteString+ unEcb = modeUnEcb'+ -- | Cipherblock Chaining (encryption)+ cbc :: k -> IV k -> B.ByteString -> (B.ByteString, IV k)+ cbc = modeCbc'+ -- | Cipherblock Chaining (decryption)+ unCbc :: k -> IV k -> B.ByteString -> (B.ByteString, IV k)+ unCbc = modeUnCbc'++ -- | Counter (encryption)+ ctr :: k -> IV k -> B.ByteString -> (B.ByteString, IV k)+ ctr = modeCtr' incIV++ -- | Counter (decryption)+ unCtr :: k -> IV k -> B.ByteString -> (B.ByteString, IV k)+ unCtr = modeUnCtr' incIV++ -- | Counter (encryption)+ ctrLazy :: k -> IV k -> L.ByteString -> (L.ByteString, IV k)+ ctrLazy = modeCtr incIV++ -- | Counter (decryption)+ unCtrLazy :: k -> IV k -> L.ByteString -> (L.ByteString, IV k)+ unCtrLazy = modeUnCtr incIV++ -- | Ciphertext feedback (encryption)+ cfb :: k -> IV k -> B.ByteString -> (B.ByteString, IV k)+ cfb = modeCfb'+ -- | Ciphertext feedback (decryption)+ unCfb :: k -> IV k -> B.ByteString -> (B.ByteString, IV k)+ unCfb = modeUnCfb'+ -- | Output feedback (encryption)+ ofb :: k -> IV k -> B.ByteString -> (B.ByteString, IV k)+ ofb = modeOfb'++ -- | Output feedback (decryption)+ unOfb :: k -> IV k -> B.ByteString -> (B.ByteString, IV k)+ unOfb = modeUnOfb'++ -- |Cipher block chaining encryption for lazy bytestrings+ cbcLazy :: k -> IV k -> L.ByteString -> (L.ByteString, IV k)+ cbcLazy = modeCbc++ -- |Cipher block chaining decryption for lazy bytestrings+ unCbcLazy :: k -> IV k -> L.ByteString -> (L.ByteString, IV k)+ unCbcLazy = modeUnCbc++ -- |SIV (Synthetic IV) mode for lazy bytestrings. The third argument is+ -- the optional list of bytestrings to be authenticated but not+ -- encrypted As required by the specification this algorithm may+ -- return nothing when certain constraints aren't met.+ sivLazy :: k -> k -> [L.ByteString] -> L.ByteString -> Maybe L.ByteString+ sivLazy = modeSiv++ -- |SIV (Synthetic IV) for lazy bytestrings. The third argument is the+ -- optional list of bytestrings to be authenticated but not encrypted.+ -- As required by the specification this algorithm may return nothing+ -- when authentication fails.+ unSivLazy :: k -> k -> [L.ByteString] -> L.ByteString -> Maybe L.ByteString+ unSivLazy = modeUnSiv++ -- |SIV (Synthetic IV) mode for strict bytestrings. First argument is+ -- the optional list of bytestrings to be authenticated but not+ -- encrypted. As required by the specification this algorithm may+ -- return nothing when certain constraints aren't met.+ siv :: k -> k -> [B.ByteString] -> B.ByteString -> Maybe B.ByteString+ siv = modeSiv'++ -- |SIV (Synthetic IV) for strict bytestrings First argument is the+ -- optional list of bytestrings to be authenticated but not encrypted+ -- As required by the specification this algorithm may return nothing+ -- when authentication fails.+ unSiv :: k -> k -> [B.ByteString] -> B.ByteString -> Maybe B.ByteString+ unSiv = modeUnSiv'++ -- |Cook book mode - not really a mode at all. If you don't know what you're doing, don't use this mode^H^H^H^H library.+ ecbLazy :: k -> L.ByteString -> L.ByteString+ ecbLazy = modeEcb++ -- |ECB decrypt, complementary to `ecb`.+ unEcbLazy :: k -> L.ByteString -> L.ByteString+ unEcbLazy = modeUnEcb++ -- |Ciphertext feed-back encryption mode for lazy bytestrings (with s+ -- == blockSize)+ cfbLazy :: k -> IV k -> L.ByteString -> (L.ByteString, IV k)+ cfbLazy = modeCfb++ -- |Ciphertext feed-back decryption mode for lazy bytestrings (with s+ -- == blockSize)+ unCfbLazy :: k -> IV k -> L.ByteString -> (L.ByteString, IV k)+ unCfbLazy = modeUnCfb++ -- |Output feedback mode for lazy bytestrings+ ofbLazy :: k -> IV k -> L.ByteString -> (L.ByteString, IV k)+ ofbLazy = modeOfb++ -- |Output feedback mode for lazy bytestrings+ unOfbLazy :: k -> IV k -> L.ByteString -> (L.ByteString, IV k)+ unOfbLazy = modeUnOfb
Crypto/Classes/Exceptions.hs view
@@ -5,25 +5,34 @@ -- NB This module is experimental and might go away or be re-arranged. {-# LANGUAGE DeriveDataTypeable #-} module Crypto.Classes.Exceptions - ( C.Hash(..)+ ( -- * Classes+ C.Hash(..), C.AsymCipher, R.CryptoRandomGen, C.BlockCipher+ -- * Hashing Operations , C.hashFunc', C.hashFunc- , C.BlockCipher, C.blockSize, C.encryptBlock, C.decryptBlock- , C.keyLength- , C.getIVIO, C.blockSizeBytes, C.keyLengthBytes, C.buildKeyIO- , C.AsymCipher, C.publicKeyLength, C.privateKeyLength, C.buildKeyPairIO- , C.Signing, C.signingKeyLength, C.verifyingKeyLength, C.verify- , C.incIV, C.zeroIV, R.CryptoRandomGen, R.genSeedLength, R.reseedInfo, R.reseedPeriod, R.newGenIO- -- Types- , R.GenError(..), R.ReseedInfo(..), CipherError(..)- -- Modes+ -- * Symmetric Cryptographic Operations+ -- ** Helpers+ , C.blockSize, C.blockSizeBytes+ , C.keyLength, C.keyLengthBytes+ , C.incIV+ -- ** Primitives+ , C.encryptBlock, C.decryptBlock+ -- * Key and IV construction+ , buildKey, C.buildKeyIO, buildKeyGen+ , getIV ,C.getIVIO, C.zeroIV+ -- ** Block Cipher Modes of Operation , C.ecb, C.unEcb, C.cbc, C.unCbc, C.ctr, C.unCtr, C.ctrLazy, C.unCtrLazy , C.cfb, C.unCfb, C.ofb, C.unOfb, C.cbcLazy, C.unCbcLazy, C.sivLazy, C.unSivLazy , C.siv, C.unSiv, C.ecbLazy, C.unEcbLazy, C.cfbLazy, C.unCfbLazy, C.ofbLazy , C.unOfbLazy- -- Wrapped functions- , buildKey, getIV, buildKeyGen- , buildKeyPair, encryptAsym, decryptAsym+ -- * RNG Operations , newGen, genBytes, genBytesWithEntropy, reseed, splitGen+ , R.genSeedLength, R.reseedInfo, R.reseedPeriod, R.newGenIO+ -- * Info Types+ , R.GenError(..), R.ReseedInfo(..), CipherError(..)+ -- * Asymmetric cryptographic operations+ , buildKeyPair, encryptAsym, decryptAsym+ , C.Signing, C.signingKeyLength, C.verifyingKeyLength, C.verify+ , C.publicKeyLength, C.privateKeyLength, C.buildKeyPairIO ) where import qualified Crypto.Random as R
Crypto/Random.hs view
@@ -162,6 +162,7 @@ -- |By default this uses "System.Entropy" to obtain -- entropy for `newGen`.+ -- WARNING: The default implementation opens a file handle which will never be closed! newGenIO :: IO g newGenIO = go 0 where@@ -178,7 +179,8 @@ Left _ -> go (i+1) Right g -> return (g `asProxyTypeOf` p) --- |Get a random number generator based on the standard system entropy source+-- | Get a random number generator based on the standard system entropy source+-- WARNING: This function opens a file handle which will never be closed! getSystemGen :: IO SystemRandom getSystemGen = do ch <- openHandle
crypto-api.cabal view
@@ -1,5 +1,5 @@ name: crypto-api-version: 0.13.2+version: 0.13.3 license: BSD3 license-file: LICENSE copyright: Thomas DuBuisson <thomas.dubuisson@gmail.com>