camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject camel git commit: Upgrading BouncyCastle
Date Tue, 10 Mar 2015 14:38:54 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x 287443066 -> e20750cc0


Upgrading BouncyCastle


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e20750cc
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e20750cc
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e20750cc

Branch: refs/heads/camel-2.15.x
Commit: e20750cc0d6045299640474039611dd5ce58bab2
Parents: 2874430
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Tue Mar 10 14:36:14 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Tue Mar 10 14:37:54 2015 +0000

----------------------------------------------------------------------
 .../crypto/DefaultPGPPublicKeyAccessor.java     |  5 +++-
 .../crypto/DefaultPGPSecretKeyAccessor.java     |  5 +++-
 .../converter/crypto/PGPDataFormatUtil.java     | 24 ++++++++++++++------
 .../crypto/PGPKeyAccessDataFormat.java          |  7 +++---
 .../converter/crypto/PGPDataFormatTest.java     |  7 ++++--
 .../component/scp/ScpServerTestSupport.java     |  5 ++--
 parent/pom.xml                                  |  2 +-
 7 files changed, 37 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e20750cc/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccessor.java
----------------------------------------------------------------------
diff --git a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccessor.java
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccessor.java
index a1911fb..d88f087 100644
--- a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccessor.java
+++ b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPPublicKeyAccessor.java
@@ -28,6 +28,7 @@ import org.bouncycastle.openpgp.PGPException;
 import org.bouncycastle.openpgp.PGPPublicKey;
 import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
 import org.bouncycastle.openpgp.PGPUtil;
+import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
 
 /**
  * Caches a public key ring.
@@ -40,7 +41,9 @@ public class DefaultPGPPublicKeyAccessor implements PGPPublicKeyAccessor
{
 
     public DefaultPGPPublicKeyAccessor(byte[] publicKeyRing) throws IOException, PGPException
{
         ObjectHelper.notNull(publicKeyRing, "publicKeyRing");
-        pgpPublicKeyRing = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(new ByteArrayInputStream(publicKeyRing)));
+        pgpPublicKeyRing = 
+            new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(new ByteArrayInputStream(publicKeyRing)),
+                                           new BcKeyFingerprintCalculator());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/e20750cc/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccessor.java
----------------------------------------------------------------------
diff --git a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccessor.java
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccessor.java
index 06e0185..cd1e14a 100644
--- a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccessor.java
+++ b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/DefaultPGPSecretKeyAccessor.java
@@ -30,6 +30,7 @@ import org.bouncycastle.openpgp.PGPException;
 import org.bouncycastle.openpgp.PGPPrivateKey;
 import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
 import org.bouncycastle.openpgp.PGPUtil;
+import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
 
 /**
  * Caches a Secret Keyring. Assumes that the password for all private keys is
@@ -64,7 +65,9 @@ public class DefaultPGPSecretKeyAccessor implements PGPSecretKeyAccessor
{
         ObjectHelper.notNull(secretKeyRing, "secretKeyRing");
         ObjectHelper.notEmpty(password, "password");
         ObjectHelper.notEmpty(provider, "provider");
-        pgpSecretKeyring = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(new ByteArrayInputStream(secretKeyRing)));
+        pgpSecretKeyring = 
+            new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(new ByteArrayInputStream(secretKeyRing)),
+                                           new BcKeyFingerprintCalculator());
         this.password = password;
         this.provider = provider;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/e20750cc/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java
----------------------------------------------------------------------
diff --git a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java
index 8713c3e..864337c 100644
--- a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java
+++ b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java
@@ -45,6 +45,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
 import org.bouncycastle.openpgp.PGPSignature;
 import org.bouncycastle.openpgp.PGPSignatureSubpacketVector;
 import org.bouncycastle.openpgp.PGPUtil;
+import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
 import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -114,7 +115,7 @@ public final class PGPDataFormatUtil {
     public static PGPPublicKeyRingCollection getPublicKeyRingCollection(CamelContext context,
String filename, byte[] keyRing, boolean forEncryption) throws IOException, PGPException {
         InputStream is = determineKeyRingInputStream(context, filename, keyRing, forEncryption);
         try {
-            return new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(is));
+            return new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(is), new BcKeyFingerprintCalculator());
         } finally {
             IOHelper.close(is);
         }
@@ -133,7 +134,8 @@ public final class PGPDataFormatUtil {
 
     private static PGPPrivateKey findPrivateKeyWithKeyId(InputStream keyringInput, long keyid,
String passphrase,
             PGPPassphraseAccessor passphraseAccessor, String provider) throws IOException,
PGPException {
-        PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyringInput));
+        PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyringInput),
+                                                                           new BcKeyFingerprintCalculator());
         return findPrivateKeyWithkeyId(keyid, passphrase, passphraseAccessor, provider, pgpSec);
     }
 
@@ -190,14 +192,17 @@ public final class PGPDataFormatUtil {
 
     private static PGPPublicKey findPublicKeyWithKeyId(InputStream input, long keyid) throws
IOException, PGPException,
             NoSuchProviderException {
-        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));
+        PGPPublicKeyRingCollection pgpSec = 
+            new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input),
+                                           new BcKeyFingerprintCalculator());
         return pgpSec.getPublicKey(keyid);
     }
 
     private static List<PGPPublicKey> findPublicKeys(InputStream input, List<String>
userids, boolean forEncryption) throws IOException,
             PGPException, NoSuchProviderException {
 
-        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));
+        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input),
+                                                                           new BcKeyFingerprintCalculator());
 
         return findPublicKeys(userids, forEncryption, pgpSec);
     }
@@ -310,8 +315,11 @@ public final class PGPDataFormatUtil {
     @Deprecated
     private static PGPPrivateKey findPrivateKey(InputStream keyringInput, InputStream encryptedInput,
String passphrase,
             PGPPassphraseAccessor passphraseAccessor, String provider) throws IOException,
PGPException, NoSuchProviderException {
-        PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyringInput));
-        PGPObjectFactory factory = new PGPObjectFactory(PGPUtil.getDecoderStream(encryptedInput));
+        PGPSecretKeyRingCollection pgpSec = 
+            new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyringInput),
+                                           new BcKeyFingerprintCalculator());
+        PGPObjectFactory factory = new PGPObjectFactory(PGPUtil.getDecoderStream(encryptedInput),
+                                                        new BcKeyFingerprintCalculator());
         PGPEncryptedDataList enc;
         Object o = factory.nextObject();
         if (o == null) {
@@ -390,7 +398,9 @@ public final class PGPDataFormatUtil {
 
     private static List<PGPSecretKeyAndPrivateKeyAndUserId> findSecretKeysWithPrivateKeyAndUserId(InputStream
keyringInput,
             Map<String, String> sigKeyUserId2Password, String provider) throws IOException,
PGPException, NoSuchProviderException {
-        PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyringInput));
+        PGPSecretKeyRingCollection pgpSec = 
+            new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyringInput),
+                                           new BcKeyFingerprintCalculator());
         return findSecretKeysWithPrivateKeyAndUserId(sigKeyUserId2Password, provider, pgpSec);
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/e20750cc/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
index 1a3d8da..88c0261 100644
--- a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
+++ b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPKeyAccessDataFormat.java
@@ -59,6 +59,7 @@ import org.bouncycastle.openpgp.PGPSignatureGenerator;
 import org.bouncycastle.openpgp.PGPSignatureList;
 import org.bouncycastle.openpgp.PGPSignatureSubpacketGenerator;
 import org.bouncycastle.openpgp.PGPUtil;
+import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
 import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
 import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider;
 import org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder;
@@ -361,7 +362,7 @@ public class PGPKeyAccessDataFormat extends ServiceSupport implements
DataFormat
             in = PGPUtil.getDecoderStream(encryptedStream);
             encData = getDecryptedData(exchange, in);
             uncompressedData = getUncompressedData(encData);
-            PGPObjectFactory pgpFactory = new PGPObjectFactory(uncompressedData);
+            PGPObjectFactory pgpFactory = new PGPObjectFactory(uncompressedData, new BcKeyFingerprintCalculator());
             Object object = pgpFactory.nextObject();
 
             PGPOnePassSignature signature;
@@ -418,7 +419,7 @@ public class PGPKeyAccessDataFormat extends ServiceSupport implements
DataFormat
     }
 
     private InputStream getUncompressedData(InputStream encData) throws IOException, PGPException
{
-        PGPObjectFactory pgpFactory = new PGPObjectFactory(encData);
+        PGPObjectFactory pgpFactory = new PGPObjectFactory(encData, new BcKeyFingerprintCalculator());
         Object compObj = pgpFactory.nextObject();
         if (!(compObj instanceof PGPCompressedData)) {
             throw getFormatException();
@@ -429,7 +430,7 @@ public class PGPKeyAccessDataFormat extends ServiceSupport implements
DataFormat
     }
 
     private InputStream getDecryptedData(Exchange exchange, InputStream encryptedStream)
throws Exception, PGPException {
-        PGPObjectFactory pgpFactory = new PGPObjectFactory(encryptedStream);
+        PGPObjectFactory pgpFactory = new PGPObjectFactory(encryptedStream, new BcKeyFingerprintCalculator());
         Object firstObject = pgpFactory.nextObject();
         // the first object might be a PGP marker packet 
         PGPEncryptedDataList enc = getEcryptedDataList(pgpFactory, firstObject);

http://git-wip-us.apache.org/repos/asf/camel/blob/e20750cc/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
index 3a8abc1..f24d40e 100644
--- a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
+++ b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/PGPDataFormatTest.java
@@ -59,6 +59,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
 import org.bouncycastle.openpgp.PGPSignature;
 import org.bouncycastle.openpgp.PGPSignatureGenerator;
 import org.bouncycastle.openpgp.PGPUtil;
+import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
 import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
 import org.bouncycastle.openpgp.operator.jcajce.JcePBEKeyEncryptionMethodGenerator;
 import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
@@ -369,7 +370,8 @@ public class PGPDataFormatTest extends AbstractPGPDataFormatTest {
 
     static PGPSecretKey readSecretKey() throws Exception {
         InputStream input = new ByteArrayInputStream(getSecKeyRing());
-        PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(input));
+        PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(input),
+                                                                           new BcKeyFingerprintCalculator());
 
         @SuppressWarnings("rawtypes")
         Iterator keyRingIter = pgpSec.getKeyRings();
@@ -392,7 +394,8 @@ public class PGPDataFormatTest extends AbstractPGPDataFormatTest {
 
     static PGPPublicKey readPublicKey(String keyringPath) throws Exception {
         InputStream input = new ByteArrayInputStream(getKeyRing(keyringPath));
-        PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));
+        PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input),
+                                                                           new BcKeyFingerprintCalculator());
 
         @SuppressWarnings("rawtypes")
         Iterator keyRingIter = pgpPub.getKeyRings();

http://git-wip-us.apache.org/repos/asf/camel/blob/e20750cc/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpServerTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpServerTestSupport.java
b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpServerTestSupport.java
index b5b25f8..acb2f15 100644
--- a/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpServerTestSupport.java
+++ b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpServerTestSupport.java
@@ -116,7 +116,6 @@ public abstract class ScpServerTestSupport extends CamelTestSupport {
         return "scp://localhost:" + getPort() + "/" + getScpPath();
     }
 
-    @SuppressWarnings("unchecked")
     protected boolean startSshd() {
         sshd = SshServer.setUpDefaultServer();
         sshd.setPort(getPort());
@@ -153,7 +152,7 @@ public abstract class ScpServerTestSupport extends CamelTestSupport {
 
         // For security reasons (avoiding man in the middle attacks),
         // camel-jsch will only connect to known hosts. For unit testing
-        // we use a known key, but since the port it dynamic, the 
+        // we use a known key, but since the port is dynamic, the 
         // known_hosts file will be generated by the following code and 
         // should contain a line like below (if 
         // "HashKnownHosts"=="yes" the hostname:port part will be 
@@ -171,7 +170,7 @@ public abstract class ScpServerTestSupport extends CamelTestSupport {
             Session s = jsch.getSession("admin", "localhost", getPort());
             s.setConfig("StrictHostKeyChecking",  "ask");
 
-            // TODO: by the current jsch (0.1.50) setting "HashKnownHosts" to "no" is a workaround
+            // TODO: by the current jsch (0.1.51) setting "HashKnownHosts" to "no" is a workaround
             // to make the tests run green, see also http://sourceforge.net/p/jsch/bugs/63/
             s.setConfig("HashKnownHosts",  "no");
             s.setUserInfo(new UserInfo() {

http://git-wip-us.apache.org/repos/asf/camel/blob/e20750cc/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 70c6c44..b515871 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -72,7 +72,7 @@
     <beanio-version>2.1.0</beanio-version>
     <beanstalkd-client-version>1.4.6</beanstalkd-client-version>
     <bsh-version>2.0b5</bsh-version>
-    <bouncycastle-version>1.51</bouncycastle-version>
+    <bouncycastle-version>1.52</bouncycastle-version>
     <boxjavalibv2.version>3.2.1</boxjavalibv2.version>
     <build-helper-maven-plugin-version>1.8</build-helper-maven-plugin-version>
     <c3p0-version>0.9.1.2</c3p0-version>


Mime
View raw message