[java-identity-provider] branch maint-4 updated: JPAR-205 - Update Bouncy Castle components

Ian Young ian at iay.org.uk
Wed Dec 21 14:46:02 UTC 2022


This is an automated email from the git hooks/post-receive script.

iay pushed a commit to branch maint-4
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=508e08769f6c0e89dfcffdeaba0d0364fbc5e83c

The following commit(s) were added to refs/heads/maint-4 by this push:
     new 508e08769 JPAR-205 - Update Bouncy Castle components
508e08769 is described below

commit 508e08769f6c0e89dfcffdeaba0d0364fbc5e83c
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Wed Dec 21 14:39:29 2022 +0000

    JPAR-205 - Update Bouncy Castle components
    
    https://shibboleth.atlassian.net/browse/JPAR-205
---
 idp-distribution/pom.xml                           |  6 +-
 idp-installer/pom.xml                              |  6 +-
 .../idp/installer/plugin/impl/TrustStore.java      | 65 +++++++++-------------
 idp-parent/pom.xml                                 |  4 ++
 idp-profile-spring/pom.xml                         |  2 +-
 5 files changed, 36 insertions(+), 47 deletions(-)

diff --git a/idp-distribution/pom.xml b/idp-distribution/pom.xml
index 0fe588676..1d9bbb3a6 100644
--- a/idp-distribution/pom.xml
+++ b/idp-distribution/pom.xml
@@ -43,7 +43,7 @@
         <!-- Required if you're using classes from the security package. -->
         <dependency>
             <groupId>org.bouncycastle</groupId>
-            <artifactId>bcpkix-jdk15on</artifactId>
+            <artifactId>bcpkix-jdk18on</artifactId>
             <optional>true</optional>
             <scope>runtime</scope>
         </dependency>
@@ -51,7 +51,7 @@
         <!--  For the installers -->
         <dependency>
             <groupId>org.bouncycastle</groupId>
-            <artifactId>bcpg-jdk15on</artifactId>
+            <artifactId>bcpg-jdk18on</artifactId>
             <scope>runtime</scope>
         </dependency>
 
@@ -185,7 +185,7 @@
                                 </artifactItem>
                                 <artifactItem>
                                     <groupId>org.bouncycastle</groupId>
-                                    <artifactId>bcpg-jdk15on</artifactId>
+                                    <artifactId>bcpg-jdk18on</artifactId>
                                 </artifactItem>
                                 <artifactItem>
                                     <groupId>org.apache.commons</groupId>
diff --git a/idp-installer/pom.xml b/idp-installer/pom.xml
index 7e82a8090..7e4e8d7c4 100644
--- a/idp-installer/pom.xml
+++ b/idp-installer/pom.xml
@@ -122,12 +122,12 @@
 
         <dependency>
             <groupId>org.bouncycastle</groupId>
-            <artifactId>bcpg-jdk15on</artifactId>
+            <artifactId>bcpg-jdk18on</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.bouncycastle</groupId>
-            <artifactId>bcprov-jdk15on</artifactId>
+            <artifactId>bcprov-jdk18on</artifactId>
             <scope>provided</scope>
         </dependency>
 
@@ -175,7 +175,7 @@
         </dependency>
         <dependency>
             <groupId>org.bouncycastle</groupId>
-            <artifactId>bcpkix-jdk15on</artifactId>
+            <artifactId>bcpkix-jdk18on</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java
index 8603e6574..ec472b0ef 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java
@@ -132,8 +132,6 @@ import net.shibboleth.utilities.java.support.component.ComponentSupport;
                pgpFact = new PGPObjectFactory(decoded, new JcaKeyFingerprintCalculator());
            }
            return new PGPPublicKeyRingCollection(listr);
-       } catch (final PGPException e) {
-           throw new IOException("Error reading key ring", e);
        }
     }
 
@@ -156,11 +154,7 @@ import net.shibboleth.utilities.java.support.component.ComponentSupport;
      *  has problems.
      */
     protected void createNewStore() throws IOException {
-        try {        
-            keyRings = new PGPPublicKeyRingCollection(Collections.emptyList());
-        } catch (final PGPException e) {
-            throw new IOException("Bad keystore", e);
-        }
+        keyRings = new PGPPublicKeyRingCollection(Collections.emptyList());
         saveStoreInternal();
     }
 
@@ -215,34 +209,30 @@ import net.shibboleth.utilities.java.support.component.ComponentSupport;
                             final Predicate<String> accept) throws IOException {
         final PGPPublicKeyRingCollection providedStore = loadStoreFrom(keyStream);
 
-        try {
-            final PGPPublicKey key = providedStore.getPublicKey(sigForKey.getSignature().getKeyID());
-            if (key == null) {
-                log.info("Provided key stream did not contain a key for {}", sigForKey);
-                return;
-            }
-            final StringBuilder builder = new StringBuilder("Signature:\t").
-                    append(sigForKey.toString()).
-                    append("\nFingerPrint:\t").
-                    append((new String(Hex.encode(key.getFingerprint()))).toUpperCase());
-            final Iterator<String> namesIterator = key.getUserIDs();
-            while (namesIterator.hasNext()) {
-                builder.append("\nUsername:\t").append(namesIterator.next());
-            }
-            builder.append('\n');
-            final String keyInfo = builder.toString();
-            log.debug("Asking to import key\n{}", keyInfo);
-            if (!accept.test(keyInfo)) {
-                log.info("Key import barred by user");
-                return;
-            }
-            keyRings = PGPPublicKeyRingCollection.addPublicKeyRing(
-                    keyRings,
-                    new PGPPublicKeyRing(Collections.singletonList(key)));
-            saveStoreInternal();
-        } catch (final PGPException e) {
-            log.warn("Couldn't locate key", e);
+        final PGPPublicKey key = providedStore.getPublicKey(sigForKey.getSignature().getKeyID());
+        if (key == null) {
+            log.info("Provided key stream did not contain a key for {}", sigForKey);
+            return;
         }
+        final StringBuilder builder = new StringBuilder("Signature:\t").
+                append(sigForKey.toString()).
+                append("\nFingerPrint:\t").
+                append((new String(Hex.encode(key.getFingerprint()))).toUpperCase());
+        final Iterator<String> namesIterator = key.getUserIDs();
+        while (namesIterator.hasNext()) {
+            builder.append("\nUsername:\t").append(namesIterator.next());
+        }
+        builder.append('\n');
+        final String keyInfo = builder.toString();
+        log.debug("Asking to import key\n{}", keyInfo);
+        if (!accept.test(keyInfo)) {
+            log.info("Key import barred by user");
+            return;
+        }
+        keyRings = PGPPublicKeyRingCollection.addPublicKeyRing(
+                keyRings,
+                new PGPPublicKeyRing(Collections.singletonList(key)));
+        saveStoreInternal();
     }
 
     /** Provide an opaque signature object from an input stream.
@@ -264,12 +254,7 @@ import net.shibboleth.utilities.java.support.component.ComponentSupport;
 
         log.debug("Looking for key with Id {}", signature);
 
-        try {
-            return keyRings.getPublicKey(sig.getKeyID()) != null;
-        } catch (final PGPException e) {
-            log.warn("Error looking for key {}", signature, e);
-            return false;
-        }
+        return keyRings.getPublicKey(sig.getKeyID()) != null;
     }
 
     /** Run a signature check over the streams.
diff --git a/idp-parent/pom.xml b/idp-parent/pom.xml
index 6008b5c1f..97f01dabc 100644
--- a/idp-parent/pom.xml
+++ b/idp-parent/pom.xml
@@ -257,6 +257,10 @@
                                         <exclude>javax.mail:mail</exclude>
                                         <exclude>javax.xml.bind:jaxb-api</exclude>
                                         <exclude>com.sun.mail:javax.mail</exclude>
+                                        <!--
+                                            Ban use of older coordinates for Bouncy Castle components.
+                                        -->
+                                        <exclude>org.bouncycastle:*-jdk15on</exclude>
                                     </excludes>
                                     <includes>
                                         <!--
diff --git a/idp-profile-spring/pom.xml b/idp-profile-spring/pom.xml
index 0e2997fe8..6bd015134 100644
--- a/idp-profile-spring/pom.xml
+++ b/idp-profile-spring/pom.xml
@@ -130,7 +130,7 @@
     
         <dependency>
             <groupId>org.bouncycastle</groupId>
-            <artifactId>bcprov-jdk15on</artifactId>
+            <artifactId>bcprov-jdk18on</artifactId>
         </dependency>
     
         <dependency>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list