x509-validation 1.5.0 → 1.5.1
raw patch · 2 files changed
+14/−13 lines, 2 filesdep +hourglassdep −timedep ~asn1-encodingdep ~asn1-typesdep ~x509
Dependencies added: hourglass
Dependencies removed: time
Dependency ranges changed: asn1-encoding, asn1-types, x509, x509-store
Files
- Data/X509/Validation.hs +8/−7
- x509-validation.cabal +6/−6
Data/X509/Validation.hs view
@@ -39,7 +39,8 @@ import Data.X509.Validation.Fingerprint import Data.X509.Validation.Cache import Data.X509.Validation.Types-import Data.Time.Clock+import Data.Hourglass+import System.Hourglass import Data.Maybe import Data.List @@ -77,7 +78,7 @@ checkTimeValidity :: Bool -- | The time when the validity check happens. When set to Nothing, -- the current time will be used- , checkAtTime :: Maybe UTCTime+ , checkAtTime :: Maybe DateTime -- | Check that no certificate is included that shouldn't be included. -- unfortunately despite the specification violation, a lots of -- real world server serves useless and usually old certificates@@ -120,7 +121,7 @@ -- of a certificate. hookMatchSubjectIssuer :: DistinguishedName -> Certificate -> Bool -- | validate that the parametrized time valide with the certificate in argument- , hookValidateTime :: UTCTime -> Certificate -> [FailedReason]+ , hookValidateTime :: DateTime -> Certificate -> [FailedReason] -- | validate the certificate leaf name with the DNS named used to connect , hookValidateName :: HostName -> Certificate -> [FailedReason] -- | user filter to modify the list of failure reasons@@ -190,7 +191,7 @@ ValidationCachePass -> return [] ValidationCacheDenied s -> return [CacheSaysNo s] ValidationCacheUnknown -> do- validationTime <- maybe getCurrentTime return $ checkAtTime checks+ validationTime <- maybe (timeConvert <$> timeCurrent) return $ checkAtTime checks failedReasons <- doValidate validationTime hooks checks store ident cc when (null failedReasons) $ (cacheAdd cache) ident fingerPrint (getCertificate top) return failedReasons@@ -198,7 +199,7 @@ -- | Validate a certificate chain with explicit parameters-doValidate :: UTCTime+doValidate :: DateTime -> ValidationHooks -> ValidationChecks -> CertificateStore@@ -308,7 +309,7 @@ SignatureFailed r -> [InvalidSignature r] -- | Validate that the current time is between validity bounds-validateTime :: UTCTime -> Certificate -> [FailedReason]+validateTime :: DateTime -> Certificate -> [FailedReason] validateTime currentTime cert | currentTime < before = [InFuture] | currentTime > after = [Expired]@@ -353,7 +354,7 @@ wildcardMatch l -- <star>.com or <star> is always invalid | length l < 2 = [InvalidWildcard]- -- some TLD like .uk got small subTLS like (.co.uk), and we don't want to accept *.co.uk+ -- some TLD like .uk got small subTLD like (.co.uk), and we don't want to accept *.co.uk | length (head l) <= 2 && length (head $ drop 1 l) <= 3 && length l < 3 = [InvalidWildcard] | l == take (length l) (reverse $ splitDot fqhn) = [] -- success: we got a match | otherwise = [NameMismatch fqhn]
x509-validation.cabal view
@@ -1,5 +1,5 @@ Name: x509-validation-Version: 1.5.0+Version: 1.5.1 Description: X.509 Certificate and CRL validation License: BSD3 License-file: LICENSE@@ -23,13 +23,13 @@ , directory , filepath , process- , time+ , hourglass , data-default-class , pem >= 0.1 && < 0.3- , asn1-types >= 0.2 && < 0.3- , asn1-encoding >= 0.8 && < 0.9- , x509 >= 1.4.7 && < 1.5- , x509-store >= 1.4 && < 1.5+ , 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