Correct documentation mistakes
This commit is contained in:
parent
aa2129e617
commit
3fd3fe7a73
@ -1,3 +1,6 @@
|
|||||||
|
# 0.1.0.1
|
||||||
|
- Correct mistakes in the documentation
|
||||||
|
|
||||||
# 0.1.0
|
# 0.1.0
|
||||||
- Switch to using 'MonadThrow' instead of 'MonadError'
|
- Switch to using 'MonadThrow' instead of 'MonadError'
|
||||||
- Introduce 'readKeyFile'
|
- Introduce 'readKeyFile'
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: cryptoids
|
name: cryptoids
|
||||||
version: 0.1.0
|
version: 0.1.0.1
|
||||||
synopsis: Reversable and secure encoding of object ids as a bytestring
|
synopsis: Reversable and secure encoding of object ids as a bytestring
|
||||||
license: BSD3
|
license: BSD3
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
|
|||||||
@ -4,14 +4,13 @@
|
|||||||
Description: Encryption of bytestrings using a type level nonce for determinism
|
Description: Encryption of bytestrings using a type level nonce for determinism
|
||||||
License: BSD3
|
License: BSD3
|
||||||
|
|
||||||
Given a value of a serializable type (like 'Int') we perform serialization and
|
Given a strict 'ByteString' we compute a cryptographic hash of the associated
|
||||||
compute a cryptographic hash of the associated namespace (carried as a phantom
|
namespace (carried as a phantom type of kind 'Symbol').
|
||||||
type of kind 'Symbol').
|
The payload is then encrypted using the symmetric cipher in CBC mode using the
|
||||||
The serialized payload is then encrypted using the symmetric cipher in CBC mode
|
hashed namespace as an initialization vector (IV).
|
||||||
using the hashed namespace as an initialization vector (IV).
|
|
||||||
|
|
||||||
The probability of detecting a namespace mismatch is thus \(1 - 2^{128-l}\)
|
The probability of detecting a namespace mismatch is thus the density of valid
|
||||||
where \(l\) is the length of the serialized payload.
|
payloads within all 'ByteString's of the correct length.
|
||||||
-}
|
-}
|
||||||
module Data.CryptoID.Poly
|
module Data.CryptoID.Poly
|
||||||
( CryptoID(..)
|
( CryptoID(..)
|
||||||
@ -184,7 +183,7 @@ namespace' p = case makeIV namespaceHash of
|
|||||||
cryptoFailable :: MonadThrow m => CryptoFailable a -> m a
|
cryptoFailable :: MonadThrow m => CryptoFailable a -> m a
|
||||||
cryptoFailable = either (throwM . AlgorithmError) return . eitherCryptoError
|
cryptoFailable = either (throwM . AlgorithmError) return . eitherCryptoError
|
||||||
|
|
||||||
-- | Encrypt an arbitrary serializable value
|
-- | Encrypt a serialized value
|
||||||
encrypt :: forall m namespace.
|
encrypt :: forall m namespace.
|
||||||
( KnownSymbol namespace
|
( KnownSymbol namespace
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
@ -195,7 +194,7 @@ encrypt (keyMaterial -> key) plaintext = do
|
|||||||
return . CryptoID . cbcEncrypt cipher namespace $ pad (blockSize cipher) plaintext
|
return . CryptoID . cbcEncrypt cipher namespace $ pad (blockSize cipher) plaintext
|
||||||
|
|
||||||
|
|
||||||
-- | Decrypt an arbitrary serializable value
|
-- | Decrypt a serialized value
|
||||||
decrypt :: forall m namespace.
|
decrypt :: forall m namespace.
|
||||||
( KnownSymbol namespace
|
( KnownSymbol namespace
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user