From e5d6c550a254c48304b1a077c9dc6f72270077f1 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 11 Oct 2017 00:06:34 +0200 Subject: [PATCH] Fix decryption --- uuid-crypto/changes.md | 3 +++ uuid-crypto/src/Data/UUID/Cryptographic.hs | 7 +------ uuid-crypto/uuid-crypto.cabal | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/uuid-crypto/changes.md b/uuid-crypto/changes.md index b4c879b..85329de 100644 --- a/uuid-crypto/changes.md +++ b/uuid-crypto/changes.md @@ -1,3 +1,6 @@ +# 1.3.0.0 + - Fix decryption + # 1.2.0.0 - Pad plaintext before encryption, allowing encryption of payloads shorter than 128 bits diff --git a/uuid-crypto/src/Data/UUID/Cryptographic.hs b/uuid-crypto/src/Data/UUID/Cryptographic.hs index 185b07d..f8d3e52 100644 --- a/uuid-crypto/src/Data/UUID/Cryptographic.hs +++ b/uuid-crypto/src/Data/UUID/Cryptographic.hs @@ -66,9 +66,4 @@ decrypt :: forall a m namespace. , Binary a , MonadThrow m ) => CryptoIDKey -> CryptoUUID namespace -> m a -decrypt = Poly.decrypt $ check . decodeOrFail . toByteString - where - check (Left _) = throwM DeserializationError - check (Right (rem, _, res)) - | Lazy.ByteString.all (== 0) rem = return res - | otherwise = throwM InvalidNamespaceDetected +decrypt = Poly.decrypt $ return . Lazy.ByteString.toStrict . toByteString diff --git a/uuid-crypto/uuid-crypto.cabal b/uuid-crypto/uuid-crypto.cabal index 110fd7b..a0334d5 100644 --- a/uuid-crypto/uuid-crypto.cabal +++ b/uuid-crypto/uuid-crypto.cabal @@ -1,5 +1,5 @@ name: uuid-crypto -version: 1.2.0.0 +version: 1.3.0.0 synopsis: Reversable and secure encoding of object ids as uuids license: BSD3 license-file: LICENSE