You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/05/01 10:20:44 UTC

[cxf] branch master updated (d6be151 -> e4b7097)

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git.


    from d6be151  fix: pass 'maxInactiveInterval' though overloaded methods (#667)
     new 1a71e4c  Some optimisations for TrustedAuthorityValidator
     new e4b7097  CXF-8275 - Support CRL/OCSP cert extensions in the XKMS TrustedAuthorityValidator

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/resources/OSGI-INF/blueprint/blueprint.xml  |  2 +-
 .../cxf/xkms/x509/validator/DirectTrustValidator.java    |  2 +-
 .../xkms/x509/validator/TrustedAuthorityValidator.java   | 16 +++++++---------
 .../x509/validator/TrustedAuthorityValidatorCRLTest.java |  1 +
 4 files changed, 10 insertions(+), 11 deletions(-)


[cxf] 02/02: CXF-8275 - Support CRL/OCSP cert extensions in the XKMS TrustedAuthorityValidator

Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit e4b7097b19388124883191bc32300ee6562849b4
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri May 1 11:17:16 2020 +0100

    CXF-8275 - Support CRL/OCSP cert extensions in the XKMS TrustedAuthorityValidator
---
 .../xkms-osgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml     | 2 +-
 .../org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java | 4 ++--
 .../cxf/xkms/x509/validator/TrustedAuthorityValidatorCRLTest.java     | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 7dd6461..d75c706 100644
--- a/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -16,7 +16,7 @@
             <cm:property name="xkms.logExceptions" value="false"/>
             <cm:property name="xkms.certificate.repo" value="file"/>
             <cm:property name="xkms.file.storageDir" value="data/xkms/certificates"/>
-            <cm:property name="xkms.enableRevocation" value="true"/>
+            <cm:property name="xkms.enableRevocation" value="false"/>
         </cm:default-properties>
     </cm:property-placeholder>
     <service interface="org.apache.cxf.xkms.x509.repo.CertificateRepo" activation="eager">
diff --git a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
index 9b31102..f13e9f9 100644
--- a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
+++ b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
@@ -53,7 +53,7 @@ public class TrustedAuthorityValidator implements Validator {
     private static final Logger LOG = LogUtils.getL7dLogger(TrustedAuthorityValidator.class);
 
     final CertificateRepo certRepo;
-    boolean enableRevocation = true;
+    boolean enableRevocation;
 
     public TrustedAuthorityValidator(CertificateRepo certRepo) {
         this.certRepo = certRepo;
@@ -84,10 +84,10 @@ public class TrustedAuthorityValidator implements Validator {
             CertPath certPath = builder.build(pkixParams).getCertPath();
 
             // Now validate the CertPath (including CRL checking)
+            pkixParams.setRevocationEnabled(enableRevocation);
             if (enableRevocation) {
                 List<X509CRL> crls = certRepo.getCRLs();
                 if (!crls.isEmpty()) {
-                    pkixParams.setRevocationEnabled(true);
                     CertStoreParameters crlParams = new CollectionCertStoreParameters(crls);
                     pkixParams.addCertStore(CertStore.getInstance("Collection", crlParams));
                 }
diff --git a/services/xkms/xkms-x509-handlers/src/test/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidatorCRLTest.java b/services/xkms/xkms-x509-handlers/src/test/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidatorCRLTest.java
index a34b5a6..e759f77 100644
--- a/services/xkms/xkms-x509-handlers/src/test/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidatorCRLTest.java
+++ b/services/xkms/xkms-x509-handlers/src/test/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidatorCRLTest.java
@@ -86,6 +86,7 @@ public class TrustedAuthorityValidatorCRLTest extends BasicValidationTest {
     @Test
     public void testIsCertChainValid() throws CertificateException {
         TrustedAuthorityValidator validator = new TrustedAuthorityValidator(certificateRepo);
+        validator.setEnableRevocation(true);
         Assert.assertTrue("Root should be valid",
                           validator.isCertificateChainValid(Arrays.asList(certificateRoot)));
         Assert.assertTrue("wss40rev should not be valid",


[cxf] 01/02: Some optimisations for TrustedAuthorityValidator

Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 1a71e4cb066071d09995f456d4a4525ffff5b9f9
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri May 1 10:11:04 2020 +0100

    Some optimisations for TrustedAuthorityValidator
---
 .../apache/cxf/xkms/x509/validator/DirectTrustValidator.java |  2 +-
 .../cxf/xkms/x509/validator/TrustedAuthorityValidator.java   | 12 +++++-------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/DirectTrustValidator.java b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/DirectTrustValidator.java
index 913f17a..fa0de1b 100644
--- a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/DirectTrustValidator.java
+++ b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/DirectTrustValidator.java
@@ -36,7 +36,7 @@ public class DirectTrustValidator implements Validator {
 
     private static final Logger LOG = LogUtils.getL7dLogger(DirectTrustValidator.class);
 
-    private CertificateRepo certRepo;
+    private final CertificateRepo certRepo;
 
     public DirectTrustValidator(CertificateRepo certRepo) {
         this.certRepo = certRepo;
diff --git a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
index 76a4314..9b31102 100644
--- a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
+++ b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
@@ -34,11 +34,11 @@ import java.security.cert.TrustAnchor;
 import java.security.cert.X509CRL;
 import java.security.cert.X509CertSelector;
 import java.security.cert.X509Certificate;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.util.stream.Collectors;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.xkms.handlers.Validator;
@@ -52,7 +52,7 @@ public class TrustedAuthorityValidator implements Validator {
 
     private static final Logger LOG = LogUtils.getL7dLogger(TrustedAuthorityValidator.class);
 
-    CertificateRepo certRepo;
+    final CertificateRepo certRepo;
     boolean enableRevocation = true;
 
     public TrustedAuthorityValidator(CertificateRepo certRepo) {
@@ -116,11 +116,9 @@ public class TrustedAuthorityValidator implements Validator {
     }
 
     private Set<TrustAnchor> asTrustAnchors(List<X509Certificate> trustedAuthorityCerts) {
-        Set<TrustAnchor> trustAnchors = new HashSet<>();
-        for (X509Certificate trustedAuthorityCert : trustedAuthorityCerts) {
-            trustAnchors.add(new TrustAnchor(trustedAuthorityCert, null));
-        }
-        return trustAnchors;
+        return trustedAuthorityCerts.stream()
+                .map(cert -> new TrustAnchor(cert, null))
+                .collect(Collectors.toSet());
     }
 
     @Override