Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package ghc-crypton-x509-validation for
openSUSE:Factory checked in at 2026-11-27 19:45:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-crypton-x509-validation (Old)
and /work/SRC/openSUSE:Factory/.ghc-crypton-x509-validation.new.1340718
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-crypton-x509-validation"
Fri Nov 27 19:45:05 2026 rev:8 rq:1401150 version:1.11.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-crypton-x509-validation/ghc-crypton-x509-validation.changes
2026-11-24 12:32:58.564083740 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-crypton-x509-validation.new.1340718/ghc-crypton-x509-validation.changes
2026-11-27 19:49:17.718716547 +0100
@@ -1,0 +2,26 @@
+Fri Nov 20 00:43:24 UTC 2026 - Peter Simons <[email protected]>
+
+- Update crypton-x509-validation to version 1.11.0 revision 1.
+ ## 1.11.0
+
+ The constructors of `ValidationChecks` and `ValidationHooks` are hidden;
+ use `defaultChecks` and `defaultHooks` with record update syntax.
+ RSA-PSS signatures are verified with their own parameters and the
+ restrictions of RSASSA-PSS keys, and SHA-3 signatures are supported.
+
+ * Hide the constructors of ValidationChecks and ValidationHooks
+ [#51](https://github.com/kazu-yamamoto/crypton-certificate/pull/51)
+ * Add checkRejectSHA1 and OtherReason
+ [#52](https://github.com/kazu-yamamoto/crypton-certificate/pull/52)
+ * Keep RSA-PSS parameters
+ [#53](https://github.com/kazu-yamamoto/crypton-certificate/pull/53)
+ * Keep multi-valued RDNs
+ [#54](https://github.com/kazu-yamamoto/crypton-certificate/pull/54)
+ * Keep all GeneralName forms
+ [#57](https://github.com/kazu-yamamoto/crypton-certificate/pull/57)
+ * Support RSASSA-PSS keys
+ [#61](https://github.com/kazu-yamamoto/crypton-certificate/pull/61)
+ * Support SHA-3 signature algorithms
+ [#62](https://github.com/kazu-yamamoto/crypton-certificate/pull/62)
+
+-------------------------------------------------------------------
Old:
----
crypton-x509-validation-1.10.3.tar.gz
New:
----
crypton-x509-validation-1.11.0.tar.gz
crypton-x509-validation.cabal
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-crypton-x509-validation.spec ++++++
--- /var/tmp/diff_new_pack.aVTva3/_old 2026-11-27 19:49:18.558752047 +0100
+++ /var/tmp/diff_new_pack.aVTva3/_new 2026-11-27 19:49:18.562752216 +0100
@@ -20,13 +20,14 @@
%bcond_with ghc_prof
%bcond_with tests
Name: ghc-%pkg_name
-Version: 1.10.3
+Version: 1.11.0
Release: 0
%global pkgver %pkg_name-%{version}
Summary: X.509 Certificate and CRL validation
License: BSD-3-Clause
URL: https://hackage.haskell.org/package/%pkg_name
Source0:
https://hackage.haskell.org/package/%pkg_name-%{version}/%pkg_name-%{version}.tar.gz
+Source1:
https://hackage.haskell.org/package/%pkg_name-%{version}/revision/1.cabal#/%{pkg_name}.cabal
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-base-devel
BuildRequires: ghc-bytestring-devel
@@ -104,6 +105,7 @@
%prep
%autosetup -p1 -n %pkg_name-%{version}
+cp -p %{SOURCE1} %pkg_name.cabal
%build
%ghc_lib_build
++++++ crypton-x509-validation-1.10.3.tar.gz ->
crypton-x509-validation-1.11.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/crypton-x509-validation-1.10.3/ChangeLog.md
new/crypton-x509-validation-1.11.0/ChangeLog.md
--- old/crypton-x509-validation-1.10.3/ChangeLog.md 2001-09-09
03:46:40.000000000 +0200
+++ new/crypton-x509-validation-1.11.0/ChangeLog.md 2001-09-09
03:46:40.000000000 +0200
@@ -1,5 +1,27 @@
# ChangeLog for crypton-x509-validation
+## 1.11.0
+
+The constructors of `ValidationChecks` and `ValidationHooks` are hidden;
+use `defaultChecks` and `defaultHooks` with record update syntax.
+RSA-PSS signatures are verified with their own parameters and the
+restrictions of RSASSA-PSS keys, and SHA-3 signatures are supported.
+
+* Hide the constructors of ValidationChecks and ValidationHooks
+ [#51](https://github.com/kazu-yamamoto/crypton-certificate/pull/51)
+* Add checkRejectSHA1 and OtherReason
+ [#52](https://github.com/kazu-yamamoto/crypton-certificate/pull/52)
+* Keep RSA-PSS parameters
+ [#53](https://github.com/kazu-yamamoto/crypton-certificate/pull/53)
+* Keep multi-valued RDNs
+ [#54](https://github.com/kazu-yamamoto/crypton-certificate/pull/54)
+* Keep all GeneralName forms
+ [#57](https://github.com/kazu-yamamoto/crypton-certificate/pull/57)
+* Support RSASSA-PSS keys
+ [#61](https://github.com/kazu-yamamoto/crypton-certificate/pull/61)
+* Support SHA-3 signature algorithms
+ [#62](https://github.com/kazu-yamamoto/crypton-certificate/pull/62)
+
## 1.10.3
MD2 and MD5 signatures are rejected, and certification paths are built
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/crypton-x509-validation-1.10.3/Data/X509/Validation/Fingerprint.hs
new/crypton-x509-validation-1.11.0/Data/X509/Validation/Fingerprint.hs
--- old/crypton-x509-validation-1.10.3/Data/X509/Validation/Fingerprint.hs
2001-09-09 03:46:40.000000000 +0200
+++ new/crypton-x509-validation-1.11.0/Data/X509/Validation/Fingerprint.hs
2001-09-09 03:46:40.000000000 +0200
@@ -40,3 +40,7 @@
mkHash HashSHA256 = convert . hashWith SHA256
mkHash HashSHA384 = convert . hashWith SHA384
mkHash HashSHA512 = convert . hashWith SHA512
+ mkHash HashSHA3_224 = convert . hashWith SHA3_224
+ mkHash HashSHA3_256 = convert . hashWith SHA3_256
+ mkHash HashSHA3_384 = convert . hashWith SHA3_384
+ mkHash HashSHA3_512 = convert . hashWith SHA3_512
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/crypton-x509-validation-1.10.3/Data/X509/Validation/Signature.hs
new/crypton-x509-validation-1.11.0/Data/X509/Validation/Signature.hs
--- old/crypton-x509-validation-1.10.3/Data/X509/Validation/Signature.hs
2001-09-09 03:46:40.000000000 +0200
+++ new/crypton-x509-validation-1.11.0/Data/X509/Validation/Signature.hs
2001-09-09 03:46:40.000000000 +0200
@@ -1,3 +1,5 @@
+{-# LANGUAGE RankNTypes #-}
+
-- |
-- Module : Data.X509.Validation.Signature
-- License : BSD-style
@@ -22,6 +24,7 @@
import qualified Crypto.PubKey.Ed25519 as Ed25519
import qualified Crypto.PubKey.Ed448 as Ed448
import qualified Crypto.PubKey.MLDSA as MLDSA
+import Crypto.PubKey.MaskGenFunction (mgf1)
import qualified Crypto.PubKey.RSA as RSA
import qualified Crypto.PubKey.RSA.PKCS15 as RSA
import qualified Crypto.PubKey.RSA.PSS as PSS
@@ -99,8 +102,8 @@
-- | Reject key parameters that are invalid or too costly to verify with.
acceptablePubKey :: PubKey -> Bool
-acceptablePubKey (PubKeyRSA (RSA.PublicKey _ n e)) =
- n > 1 && numBits n <= 16384 && e > 1 && numBits e <= 64
+acceptablePubKey (PubKeyRSA key) = acceptableRSA key
+acceptablePubKey (PubKeyRSAPSS key _) = acceptableRSA key
acceptablePubKey (PubKeyDSA (DSA.PublicKey (DSA.Params p g q) y)) =
p > 2
&& numBits p <= 8192
@@ -113,24 +116,17 @@
&& y < p
acceptablePubKey _ = True
+acceptableRSA :: RSA.PublicKey -> Bool
+acceptableRSA (RSA.PublicKey _ n e) =
+ n > 1 && numBits n <= 16384 && e > 1 && numBits e <= 64
+
verifySignature'
:: SignatureALG -> PubKey -> ByteString -> ByteString ->
SignatureVerification
verifySignature' (SignatureALG_Unknown _) _ _ _ = SignatureFailed
SignatureUnimplemented
-verifySignature' (SignatureALG hashALG PubKeyALG_RSAPSS) pubkey cdata
signature = case verifyF pubkey of
- Nothing -> SignatureFailed SignatureUnimplemented
- Just f ->
- if f cdata signature
- then SignaturePass
- else SignatureFailed SignatureInvalid
- where
- verifyF (PubKeyRSA key)
- | hashALG == HashSHA256 = Just $ PSS.verify (PSS.defaultPSSParams
SHA256) key
- | hashALG == HashSHA384 = Just $ PSS.verify (PSS.defaultPSSParams
SHA384) key
- | hashALG == HashSHA512 = Just $ PSS.verify (PSS.defaultPSSParams
SHA512) key
- | hashALG == HashSHA224 = Just $ PSS.verify (PSS.defaultPSSParams
SHA224) key
- | hashALG == HashSHA1 = Just $ PSS.verify (PSS.defaultPSSParams SHA1)
key
- | otherwise = Nothing
- verifyF _ = Nothing
+verifySignature' (SignatureALG hashALG PubKeyALG_RSAPSS) pubkey cdata
signature =
+ verifyPSS (defaultPSSParams hashALG) pubkey cdata signature
+verifySignature' (SignatureALG_RSAPSS params) pubkey cdata signature =
+ verifyPSS params pubkey cdata signature
verifySignature' (SignatureALG hashALG pubkeyALG) pubkey cdata signature
| pubkeyToAlg pubkey == pubkeyALG = case verifyF pubkey of
Nothing -> SignatureFailed SignatureUnimplemented
@@ -168,6 +164,10 @@
rsaVerify HashSHA256 = rsaVerifyWith SHA256
rsaVerify HashSHA384 = rsaVerifyWith SHA384
rsaVerify HashSHA512 = rsaVerifyWith SHA512
+ rsaVerify HashSHA3_224 = rsaVerifyWith SHA3_224
+ rsaVerify HashSHA3_256 = rsaVerifyWith SHA3_256
+ rsaVerify HashSHA3_384 = rsaVerifyWith SHA3_384
+ rsaVerify HashSHA3_512 = rsaVerifyWith SHA3_512
rsaVerifyWith h key msg = RSA.verifyDigest key (hashWith h msg)
verifySignature' (SignatureALG_IntrinsicHash pubkeyALG) pubkey cdata signature
| pubkeyToAlg pubkey == pubkeyALG = doVerify pubkey
@@ -196,6 +196,45 @@
| otherwise -> SignatureFailed SignatureInvalid
CryptoFailed _ -> SignatureFailed SignatureInvalid
+verifyPSS
+ :: PSSParams -> PubKey -> ByteString -> ByteString -> SignatureVerification
+verifyPSS params (PubKeyRSAPSS key mkp) cdata signature
+ -- RFC 4055 3.3: the hash and MGF must match and the salt is not shorter
+ | Just kp <- mkp
+ , pssHash params /= pssHash kp
+ || pssMGFHash params /= pssMGFHash kp
+ || pssSaltLength params < pssSaltLength kp =
+ SignatureFailed SignaturePubkeyMismatch
+ | otherwise = verifyPSS params (PubKeyRSA key) cdata signature
+verifyPSS params (PubKeyRSA key) cdata signature =
+ case withPSSHash (pssHash params) $ \h -> withPSSHash (pssMGFHash params)
$ \m ->
+ Just (PSS.verify (pssParams h m) key cdata signature) of
+ Nothing -> SignatureFailed SignatureUnimplemented
+ Just True -> SignaturePass
+ Just False -> SignatureFailed SignatureInvalid
+ where
+ pssParams h m =
+ PSS.PSSParams
+ { PSS.pssHash = h
+ , PSS.pssMaskGenAlg = mgf1 m
+ , PSS.pssSaltLength = pssSaltLength params
+ , PSS.pssTrailerField = 0xbc
+ }
+verifyPSS _ _ _ _ = SignatureFailed SignaturePubkeyMismatch
+
+withPSSHash
+ :: HashALG -> (forall a. HashAlgorithm a => a -> Maybe r) -> Maybe r
+withPSSHash HashSHA1 f = f SHA1
+withPSSHash HashSHA224 f = f SHA224
+withPSSHash HashSHA256 f = f SHA256
+withPSSHash HashSHA384 f = f SHA384
+withPSSHash HashSHA512 f = f SHA512
+withPSSHash HashSHA3_224 f = f SHA3_224
+withPSSHash HashSHA3_256 f = f SHA3_256
+withPSSHash HashSHA3_384 f = f SHA3_384
+withPSSHash HashSHA3_512 f = f SHA3_512
+withPSSHash _ _ = Nothing
+
verifyECDSA :: HashALG -> PubKeyEC -> Maybe (ByteString -> ByteString -> Bool)
verifyECDSA hashALG key =
ecPubKeyCurveName key >>= verifyCurve (pubkeyEC_pub key)
@@ -219,3 +258,7 @@
ecdsaVerify HashSHA256 = ECDSA.verify SHA256
ecdsaVerify HashSHA384 = ECDSA.verify SHA384
ecdsaVerify HashSHA512 = ECDSA.verify SHA512
+ ecdsaVerify HashSHA3_224 = ECDSA.verify SHA3_224
+ ecdsaVerify HashSHA3_256 = ECDSA.verify SHA3_256
+ ecdsaVerify HashSHA3_384 = ECDSA.verify SHA3_384
+ ecdsaVerify HashSHA3_512 = ECDSA.verify SHA3_512
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/crypton-x509-validation-1.10.3/Data/X509/Validation.hs
new/crypton-x509-validation-1.11.0/Data/X509/Validation.hs
--- old/crypton-x509-validation-1.10.3/Data/X509/Validation.hs 2001-09-09
03:46:40.000000000 +0200
+++ new/crypton-x509-validation-1.11.0/Data/X509/Validation.hs 2001-09-09
03:46:40.000000000 +0200
@@ -20,8 +20,24 @@
SignatureFailure (..),
-- * Validation configuration types
- ValidationChecks (..),
- ValidationHooks (..),
+
+ -- the constructors are hidden so that fields can be added
+ ValidationChecks,
+ checkTimeValidity,
+ checkAtTime,
+ checkStrictOrdering,
+ checkCAConstraints,
+ checkExhaustive,
+ checkLeafV3,
+ checkLeafKeyUsage,
+ checkLeafKeyPurpose,
+ checkFQHN,
+ checkRejectSHA1,
+ ValidationHooks,
+ hookMatchSubjectIssuer,
+ hookValidateTime,
+ hookValidateName,
+ hookFilterReason,
defaultChecks,
defaultHooks,
@@ -104,12 +120,14 @@
CacheSaysNo String
| -- | signature failed
InvalidSignature SignatureFailure
+ | -- | a reason given by a hook, e.g. a revocation check
+ OtherReason String
deriving (Show, Eq)
-- | A set of checks to activate or parametrize to perform on certificates.
--
--- It's recommended to use 'defaultChecks' to create the structure,
--- to better cope with future changes or expansion of the structure.
+-- Values are made by updating 'defaultChecks', e.g.
+-- @defaultChecks{checkFQHN = False}@.
data ValidationChecks = ValidationChecks
{ checkTimeValidity :: Bool
-- ^ check time validity of every certificate in the chain.
@@ -149,11 +167,16 @@
, checkFQHN :: Bool
-- ^ Check the top certificate names matching the fully qualified hostname
(FQHN).
-- it's not recommended to turn this check off, if no other name checks
are performed.
+ , checkRejectSHA1 :: Bool
+ -- ^ Reject certificates signed with SHA-1. The signatures of trust
+ -- anchors are not checked. MD2 and MD5 are always rejected.
}
deriving (Show, Eq)
-- | A set of hooks to manipulate the way the verification works.
--
+-- Values are made by updating 'defaultHooks'.
+--
-- BEWARE, it's easy to change behavior leading to compromised security.
data ValidationHooks = ValidationHooks
{ hookMatchSubjectIssuer :: DistinguishedName -> Certificate -> Bool
@@ -188,6 +211,7 @@
, checkLeafKeyUsage = []
, checkLeafKeyPurpose = []
, checkFQHN = True
+ , checkRejectSHA1 = False
}
instance Default ValidationChecks where
@@ -473,6 +497,8 @@
checkSignature signedCert signingCert
| signedAlg (getSigned signedCert) /= certSignatureAlg (getCertificate
signedCert) =
[InvalidSignature SignatureInvalid]
+ | checkRejectSHA1 checks && isSHA1 (signedAlg (getSigned signedCert)) =
+ [InvalidSignature SignatureUnimplemented]
| otherwise =
case verifySignedSignature signedCert (certPubKey $ getCertificate
signingCert) of
SignaturePass -> []
@@ -490,6 +516,10 @@
-- the level counts from the leaf
spec level c = getNameConstSpec (getCertificate c) (level == 0 &&
checkFQHN checks)
+isSHA1 :: SignatureALG -> Bool
+isSHA1 (SignatureALG HashSHA1 _) = True
+isSHA1 alg = maybe False ((== HashSHA1) . pssHash) $ signatureALGPSSParams alg
+
-- | Whether BasicConstraints says the certificate is not a CA.
notCA :: Certificate -> Bool
notCA cert = case extensionGetE (certExtensions cert) of
@@ -754,6 +784,11 @@
(AltNameURI n, AltNameURI c) -> maybe Unsupported (toMatch .
(`hostInSubtree` c)) $ uriHost n
(AltNameXMPP _, AltNameXMPP _) -> Unsupported
(AltNameDNSSRV _, AltNameDNSSRV _) -> Unsupported
+ (AltNameOther o1 _, AltNameOther o2 _)
+ | o1 == o2 -> Unsupported
+ (AltNameX400 _, AltNameX400 _) -> Unsupported
+ (AltNameEDIParty _, AltNameEDIParty _) -> Unsupported
+ (AltNameRegisteredID _, AltNameRegisteredID _) -> Unsupported
_ -> NotApplicable
where
toMatch b = if b then Matched else NotMatched
@@ -814,16 +849,12 @@
else Just host
_ -> Nothing
--- | The subtree is a prefix of the name. Attribute values are compared
--- case-insensitively with whitespace folded.
+-- | The subtree is a prefix of the name, comparing RDNs in the canonical
+-- form.
dnInSubtree :: DistinguishedName -> DistinguishedName -> Bool
-dnInSubtree (DistinguishedName n) (DistinguishedName c) =
- length c <= length n && and (zipWith eq n c)
+dnInSubtree n c = canon c `isPrefixOf` canon n
where
- eq (o1, v1) (o2, v2) = o1 == o2 && norm v1 == norm v2
- norm v = case safeCharacterToString v of
- Just str -> Right $ unwords $ words $ map toLower str
- Nothing -> Left v
+ canon = getRDNs . canonicalDistinguishedName
-- | An IPv4 or IPv6 address against an address with a mask.
ipInSubtree :: ByteString -> ByteString -> NameMatch
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/crypton-x509-validation-1.10.3/Tests/Certificate.hs
new/crypton-x509-validation-1.11.0/Tests/Certificate.hs
--- old/crypton-x509-validation-1.10.3/Tests/Certificate.hs 2001-09-09
03:46:40.000000000 +0200
+++ new/crypton-x509-validation-1.11.0/Tests/Certificate.hs 2001-09-09
03:46:40.000000000 +0200
@@ -11,6 +11,8 @@
hashSHA256,
hashSHA384,
hashSHA512,
+ hashSHA3_256,
+ hashSHA3_384,
-- * Key and signature utilities
Alg (..),
@@ -80,6 +82,11 @@
hashSHA384 = GHash HashSHA384 SHA384
hashSHA512 = GHash HashSHA512 SHA512
+hashSHA3_256 :: GHash SHA3_256
+hashSHA3_384 :: GHash SHA3_384
+hashSHA3_256 = GHash HashSHA3_256 SHA3_256
+hashSHA3_384 = GHash HashSHA3_384 SHA3_384
+
-- | Signature and hash algorithms instantiated with parameters.
data Alg pub priv where
AlgRSA
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/crypton-x509-validation-1.10.3/Tests/Tests.hs
new/crypton-x509-validation-1.11.0/Tests/Tests.hs
--- old/crypton-x509-validation-1.10.3/Tests/Tests.hs 2001-09-09
03:46:40.000000000 +0200
+++ new/crypton-x509-validation-1.11.0/Tests/Tests.hs 2001-09-09
03:46:40.000000000 +0200
@@ -8,6 +8,7 @@
import qualified Crypto.PubKey.DSA as DSA
import qualified Crypto.PubKey.ECC.ECDSA as ECDSA
import qualified Crypto.PubKey.ECC.Types as ECC
+import Crypto.PubKey.MaskGenFunction (mgf1)
import qualified Crypto.PubKey.RSA as RSA
import qualified Crypto.PubKey.RSA.PSS as PSS
@@ -833,6 +834,42 @@
@?= SignatureFailed SignatureInvalid
]
+-- | RSA-PSS signatures are verified with their own parameters.
+testPSSParams :: TestTree
+testPSSParams = testCase "RSA-PSS parameters" $ do
+ (pub, priv) <- RSA.generate 128 3
+ let msg = BS.pack [1, 2, 3]
+ params :: PSS.PSSParams SHA384 BS.ByteString BS.ByteString
+ params =
+ PSS.PSSParams
+ { PSS.pssHash = SHA384
+ , PSS.pssMaskGenAlg = mgf1 SHA256
+ , PSS.pssSaltLength = 0
+ , PSS.pssTrailerField = 0xbc
+ }
+ alg =
+ rsaPSSSignatureALG $
+ (defaultPSSParams HashSHA384){pssMGFHash = HashSHA256,
pssSaltLength = 0}
+ sig <- either (error . show) id <$> PSS.signSafer params priv msg
+ verifySignature alg (PubKeyRSA pub) msg sig @?= SignaturePass
+ verifySignature
+ (SignatureALG HashSHA384 PubKeyALG_RSAPSS)
+ (PubKeyRSA pub)
+ msg
+ sig
+ @?= SignatureFailed SignatureInvalid
+ -- RSASSA-PSS keys restrict the parameters (RFC 4055 3.3)
+ let restricted p = PubKeyRSAPSS pub (Just p)
+ custom = (defaultPSSParams HashSHA384){pssMGFHash = HashSHA256,
pssSaltLength = 0}
+ verifySignature alg (PubKeyRSAPSS pub Nothing) msg sig @?= SignaturePass
+ verifySignature alg (restricted custom) msg sig @?= SignaturePass
+ verifySignature alg (restricted (defaultPSSParams HashSHA384)) msg sig
+ @?= SignatureFailed SignaturePubkeyMismatch
+ verifySignature alg (restricted custom{pssMGFHash = HashSHA384}) msg sig
+ @?= SignatureFailed SignaturePubkeyMismatch
+ verifySignature (SignatureALG HashSHA384 PubKeyALG_RSA) (PubKeyRSAPSS pub
Nothing) msg sig
+ @?= SignatureFailed SignaturePubkeyMismatch
+
-- | Validity period around the current date.
currentValidity :: IO (DateTime, DateTime)
currentValidity = do
@@ -1040,6 +1077,53 @@
actual <- validateExample (mkStore [rootPair]) [leaf]
actual @?= []
+-- | SHA-1 signatures are accepted by default and rejected on request.
+testRejectSHA1 :: TestTree
+testRejectSHA1 = testCase "SHA-1 signature" $ do
+ validity <- currentValidity
+ keys <- generateKeys (AlgRSA 1024 hashSHA1)
+ rootPair <- mkCA 1 "SHA1 Root" validity (Just bc) Nothing Self keys
+ leaf <- mkCertificate 2 2 (mkDn "leaf") validity [exampleSAN] (CA
rootPair) keys
+ let run checks =
+ validate
+ HashSHA256
+ defaultHooks
+ checks
+ (mkStore [rootPair])
+ defaultValidationCache
+ ("www.example.com", fromString ":443")
+ (CertificateChain [pairSignedCert leaf])
+ accepted <- run defaultChecks
+ accepted @?= []
+ rejected <- run defaultChecks{checkRejectSHA1 = True}
+ rejected @?= [InvalidSignature SignatureUnimplemented]
+ where
+ bc = ExtBasicConstraints True Nothing
+
+-- | A hook can return its own reason.
+testOtherReason :: IO (RData pub priv) -> TestTree
+testOtherReason res = testWithRes res "other reason" $ \rd -> do
+ leaf <-
+ mkCertificate
+ 2
+ 53
+ (mkDn "leaf")
+ (present rd)
+ [exampleSAN]
+ (CA (root rd))
+ (keys1 rd)
+ let hooks = defaultHooks{hookValidateName = \_ _ -> [OtherReason
"revoked"]}
+ actual <-
+ validate
+ HashSHA256
+ hooks
+ defaultChecks
+ (rootStore rd)
+ defaultValidationCache
+ ("www.example.com", fromString ":443")
+ (CertificateChain [pairSignedCert leaf])
+ actual @?= [OtherReason "revoked"]
+
-- | Regression tests that do not depend on the signature algorithm.
treeRegression :: TestTree
treeRegression = withResource (initData AlgEd25519) freeData $ \res ->
@@ -1050,6 +1134,8 @@
[ testNonCAAnchor res
, testSignatureAlgMismatch
, testWeakHash
+ , testRejectSHA1
+ , testOtherReason res
]
, testGroup
"path building"
@@ -1143,6 +1229,24 @@
False
, testNameConstraints
res
+ "excluded otherName"
+ [nameConstraints [] [upn "[email protected]"]]
+ Nothing
+ leafDN
+ [sanExt [dns "www.example.com", upn "[email protected]"]]
+ "www.example.com"
+ False
+ , testNameConstraints
+ res
+ "otherName under DNS constraints"
+ [nameConstraints [dns "example.com"] []]
+ Nothing
+ leafDN
+ [sanExt [dns "www.example.com", upn "[email protected]"]]
+ "www.example.com"
+ True
+ , testNameConstraints
+ res
"excluded by wildcard"
[nameConstraints [] [dns "www.example.com"]]
Nothing
@@ -1324,10 +1428,16 @@
, testLongChain res "too long" 25 False
]
, testBadKeys
+ , testPSSParams
]
where
dns = AltNameDNS
ip = AltNameIP . BS.pack
+ -- Microsoft UPN otherName
+ upn u =
+ AltNameOther
+ [1, 3, 6, 1, 4, 1, 311, 20, 2, 3]
+ (encodeASN1' DER [ASN1String $ asn1CharacterString UTF8 u])
leafDN = mkDn "leaf"
ncEx = nameConstraints [dns "example.com"] []
raw oid asn1 = ExtensionRaw oid True (encodeASN1' DER asn1)
@@ -1792,6 +1902,9 @@
, treeWithAlg "RSAPSS" (AlgRSAPSS 2048 pssParams hashSHA224)
, treeWithAlg "DSA" (AlgDSA dsaParams hashSHA1)
, treeWithAlg "ECDSA" (AlgEC curveName hashSHA512)
+ , treeWithAlg "RSA SHA3" (AlgRSA 2048 hashSHA3_256)
+ , treeWithAlg "RSAPSS SHA3" (AlgRSAPSS 2048 (PSS.defaultPSSParams
SHA3_256) hashSHA3_256)
+ , treeWithAlg "ECDSA SHA3" (AlgEC curveName hashSHA3_384)
, treeWithAlg "Ed25519" AlgEd25519
, treeWithAlg "Ed448" AlgEd448
, treeWithAlg "ML-DSA-44" AlgMLDSA44
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/crypton-x509-validation-1.10.3/crypton-x509-validation.cabal
new/crypton-x509-validation-1.11.0/crypton-x509-validation.cabal
--- old/crypton-x509-validation-1.10.3/crypton-x509-validation.cabal
2001-09-09 03:46:40.000000000 +0200
+++ new/crypton-x509-validation-1.11.0/crypton-x509-validation.cabal
2001-09-09 03:46:40.000000000 +0200
@@ -1,6 +1,6 @@
cabal-version: >=1.10
name: crypton-x509-validation
-version: 1.10.3
+version: 1.11.0
license: BSD3
license-file: LICENSE
copyright: Vincent Hanquez <[email protected]>
@@ -34,11 +34,11 @@
base >=3 && <5,
bytestring,
containers,
- crypton >=2.2.0 && <2.3,
+ crypton >=2.2.0 && <2.4,
crypton-asn1-types >=0.4.1 && <0.5,
crypton-asn1-encoding >=0.10.0 && <0.11,
crypton-pem >=0.2.4 && <0.4,
- crypton-x509 >=1.10.3 && <1.11,
+ crypton-x509 >=1.11 && <1.12,
crypton-x509-store >=1.10.1 && <1.11,
data-default,
iproute >=1.2.2,
++++++ crypton-x509-validation.cabal ++++++
cabal-version: >=1.10
name: crypton-x509-validation
version: 1.11.0
x-revision: 1
license: BSD3
license-file: LICENSE
copyright: Vincent Hanquez <[email protected]>
maintainer: Kazu Yamamoto <[email protected]>
author: Vincent Hanquez <[email protected]>
stability: experimental
homepage: https://github.com/kazu-yamamoto/crypton-certificate
synopsis: X.509 Certificate and CRL validation
description: X.509 Certificate and CRL validation. please see README
category: Data
build-type: Simple
extra-source-files: ChangeLog.md
source-repository head
type: git
location: https://github.com/kazu-yamamoto/crypton-certificate
subdir: crypton-x509-validation
library
exposed-modules: Data.X509.Validation
other-modules:
Data.X509.Validation.Signature
Data.X509.Validation.Fingerprint
Data.X509.Validation.Cache
Data.X509.Validation.Types
Data.X509.Validation.Internal
default-language: Haskell2010
ghc-options: -Wall
build-depends:
base >=3 && <5,
bytestring,
containers,
crypton >=2.2.0 && <2.4,
crypton-asn1-types >=0.4.1 && <0.5,
crypton-asn1-encoding >=0.10.0 && <0.12,
crypton-pem >=0.2.4 && <0.4,
crypton-x509 >=1.11 && <1.12,
crypton-x509-store >=1.10.1 && <1.11,
data-default,
iproute >=1.2.2,
mtl,
ram,
time-hourglass
test-suite test-x509-validation
type: exitcode-stdio-1.0
main-is: Tests.hs
hs-source-dirs: Tests
other-modules: Certificate
default-language: Haskell2010
ghc-options: -Wall
build-depends:
base >=3 && <5,
bytestring,
crypton,
crypton-asn1-encoding,
crypton-asn1-types,
crypton-x509,
crypton-x509-store,
crypton-x509-validation,
data-default,
ram,
tasty,
tasty-hunit,
time-hourglass