packages feed

x509-validation 1.5.2 → 1.6.0

raw patch · 3 files changed

+33/−28 lines, 3 filesdep +cryptonitedep +memorydep −crypto-pubkeydep −crypto-pubkey-typesdep −cryptohashdep ~x509dep ~x509-storePVP ok

version bump matches the API change (PVP)

Dependencies added: cryptonite, memory

Dependencies removed: crypto-pubkey, crypto-pubkey-types, cryptohash

Dependency ranges changed: x509, x509-store

API changes (from Hackage documentation)

Files

Data/X509/Validation/Fingerprint.hs view
@@ -8,12 +8,12 @@ module Data.X509.Validation.Fingerprint     ( Fingerprint(..)     , getFingerprint-    , toDescr     ) where -import Crypto.PubKey.HashDescr+import Crypto.Hash import Data.X509 import Data.ASN1.Types+import Data.ByteArray (convert) import Data.ByteString (ByteString) import Data.Byteable @@ -30,16 +30,12 @@                => SignedExact a -- ^ object to fingerprint                -> HashALG       -- ^ algorithm to compute the fingerprint                -> Fingerprint   -- ^ fingerprint in binary form-getFingerprint sobj halg = Fingerprint $ hashF $ encodeSignedObject sobj-  where hashDescr = toDescr halg-        hashF     = hashFunction hashDescr---- | Convert a hash algorithm into a Hash Description-toDescr :: HashALG -> HashDescr-toDescr HashMD2    = hashDescrMD2-toDescr HashMD5    = hashDescrMD5-toDescr HashSHA1   = hashDescrSHA1-toDescr HashSHA224 = hashDescrSHA224-toDescr HashSHA256 = hashDescrSHA256-toDescr HashSHA384 = hashDescrSHA384-toDescr HashSHA512 = hashDescrSHA512+getFingerprint sobj halg = Fingerprint $ mkHash halg $ encodeSignedObject sobj+  where+    mkHash HashMD2    = convert . hashWith MD2+    mkHash HashMD5    = convert . hashWith MD5+    mkHash HashSHA1   = convert . hashWith SHA1+    mkHash HashSHA224 = convert . hashWith SHA224+    mkHash HashSHA256 = convert . hashWith SHA256+    mkHash HashSHA384 = convert . hashWith SHA384+    mkHash HashSHA512 = convert . hashWith SHA512
Data/X509/Validation/Signature.hs view
@@ -16,11 +16,10 @@  import qualified Crypto.PubKey.RSA.PKCS15 as RSA import qualified Crypto.PubKey.DSA as DSA-import qualified Crypto.Hash.SHA1 as SHA1+import Crypto.Hash  import Data.ByteString (ByteString) import Data.X509-import Data.X509.Validation.Fingerprint import Data.ASN1.Types import Data.ASN1.Encoding import Data.ASN1.BinaryEncoding@@ -72,11 +71,11 @@                                                             else SignatureFailed SignatureInvalid     | otherwise                       = SignatureFailed SignaturePubkeyMismatch   where-        verifyF (PubKeyRSA key) = Just $ RSA.verify (toDescr hashALG) key+        verifyF (PubKeyRSA key) = Just $ rsaVerify hashALG key         verifyF (PubKeyDSA key)             | hashALG == HashSHA1 = Just $ \a b -> case dsaToSignature a of                                                     Nothing     -> False-                                                    Just dsaSig -> DSA.verify SHA1.hash key dsaSig b+                                                    Just dsaSig -> DSA.verify SHA1 key dsaSig b             | otherwise           = Nothing         verifyF _ = Nothing @@ -84,6 +83,17 @@         dsaToSignature b =             case decodeASN1' BER b of                 Left _     -> Nothing-                Right asn1 -> case fromASN1 asn1 of-                                Left _            -> Nothing-                                Right (dsaSig, _) -> Just dsaSig+                Right asn1 ->+                    case asn1 of+                        Start Sequence:IntVal r:IntVal s:End Sequence:_ ->+                            Just $ DSA.Signature { DSA.sign_r = r, DSA.sign_s = s }+                        _ ->+                            Nothing++        rsaVerify HashMD2    = RSA.verify (Just MD2)+        rsaVerify HashMD5    = RSA.verify (Just MD5)+        rsaVerify HashSHA1   = RSA.verify (Just SHA1)+        rsaVerify HashSHA224 = RSA.verify (Just SHA224)+        rsaVerify HashSHA256 = RSA.verify (Just SHA256)+        rsaVerify HashSHA384 = RSA.verify (Just SHA384)+        rsaVerify HashSHA512 = RSA.verify (Just SHA512)
x509-validation.cabal view
@@ -1,5 +1,5 @@ Name:                x509-validation-Version:             1.5.2+Version:             1.6.0 Description:         X.509 Certificate and CRL validation License:             BSD3 License-file:        LICENSE@@ -16,6 +16,7 @@ Library   Build-Depends:     base >= 3 && < 5                    , bytestring+                   , memory                    , byteable                    , network                    , mtl@@ -28,11 +29,9 @@                    , pem >= 0.1 && < 0.3                    , asn1-types >= 0.3 && < 0.4                    , asn1-encoding >= 0.9 && < 0.10-                   , x509 >= 1.5.0 && < 1.6-                   , x509-store >= 1.5 && < 1.6-                   , crypto-pubkey >= 0.1.4 && < 0.3-                   , crypto-pubkey-types >= 0.4 && < 0.5-                   , cryptohash >= 0.9 && < 0.12+                   , x509 >= 1.6 && < 1.7+                   , x509-store >= 1.6 && < 1.7+                   , cryptonite >= 0.3   Exposed-modules:   Data.X509.Validation   Other-modules:     Data.X509.Validation.Signature                      Data.X509.Validation.Fingerprint