packages feed

tls-extra 0.2.1 → 0.2.2

raw patch · 2 files changed

+8/−9 lines, 2 filesdep ~certificatedep ~tls

Dependency ranges changed: certificate, tls

Files

Network/TLS/Extra/Certificate.hs view
@@ -24,7 +24,6 @@ import qualified Crypto.Cipher.RSA as RSA import qualified Crypto.Cipher.DSA as DSA -import Data.Text.Lazy (unpack) import Data.Certificate.X509Cert (oidCommonName)  #if defined(NOCERTVERIFY)@@ -70,7 +69,7 @@ 					then certificateVerifyChain $ tail l 					else return False 	where-		matchsysX509 (X509 cert _ _ _) (X509 syscert _ _ _) = do+		matchsysX509 (X509 cert _ _ _ _) (X509 syscert _ _ _ _) = do 			let x = certSubjectDN syscert 			let y = certIssuerDN cert 			x == y@@ -79,7 +78,7 @@ -- | verify a certificate against another one. -- the first certificate need to be signed by the second one for this function to succeed. certificateVerifyAgainst :: X509 -> X509 -> IO Bool-certificateVerifyAgainst ux509@(X509 _ _ sigalg sig) (X509 scert _ _ _) = do+certificateVerifyAgainst ux509@(X509 _ _ _ sigalg sig) (X509 scert _ _ _ _) = do 	let f = verifyF sigalg pk 	case f udata esig of 		Right True -> return True@@ -113,7 +112,7 @@ 			 verifyF _ _ = (\_ _ -> Left "unexpected/wrong signature") -dsaSHA1Verify pk a b = either (Left . show) (Right) $ DSA.verify asig SHA1.hash pk b+dsaSHA1Verify pk _ b = either (Left . show) (Right) $ DSA.verify asig SHA1.hash pk b 	where asig = (0,0) {- FIXME : need to work out how to get R/S from the bytestring a -}  rsaVerify h hdesc pk a b = either (Left . show) (Right) $ RSA.verify h hdesc pk a b@@ -124,10 +123,10 @@ -- | Verify that the given certificate chain is application to the given fully qualified host name. certificateVerifyDomain :: String -> [X509] -> Bool certificateVerifyDomain _      []                  = False-certificateVerifyDomain fqhn (X509 cert _ _ _:_) =+certificateVerifyDomain fqhn (X509 cert _ _ _ _:_) = 	case lookup oidCommonName $ certSubjectDN cert of 		Nothing       -> False-		Just (_, val) -> matchDomain (splitDot $ unpack val)+		Just (_, val) -> matchDomain (splitDot val) 	where 		matchDomain l 			| length (filter (== "") l) > 0 = False
tls-extra.cabal view
@@ -1,5 +1,5 @@ Name:                tls-extra-Version:             0.2.1+Version:             0.2.2 Description:    a set of extra definitions, default values and helpers for tls. License:             BSD3@@ -28,7 +28,7 @@  Library   Build-Depends:     base > 3 && < 5-                   , tls >= 0.6.2 && < 0.7+                   , tls >= 0.6.3 && < 0.7                    , mtl                    , network >= 2.3                    , cryptohash >= 0.6@@ -36,7 +36,7 @@                    , vector                    , crypto-api >= 0.5                    , cryptocipher >= 0.2.5-                   , certificate >= 0.7 && < 0.8+                   , certificate >= 0.8.1 && < 0.9                    , text >= 0.5 && < 1.0   Exposed-modules:   Network.TLS.Extra   other-modules:     Network.TLS.Extra.Certificate