msrb pushed to apache-ivy (master). "Port to bouncycastle 1.52"
notifications at fedoraproject.org
notifications at fedoraproject.org
Mon May 4 11:40:45 UTC 2015
>From a58e0a3b3edc75e94d01deaa486589116daede3e Mon Sep 17 00:00:00 2001
From: Michal Srb <msrb at redhat.com>
Date: Mon, 4 May 2015 13:38:29 +0200
Subject: Port to bouncycastle 1.52
diff --git a/apache-ivy.spec b/apache-ivy.spec
index 996c0c4..68c56c1 100644
--- a/apache-ivy.spec
+++ b/apache-ivy.spec
@@ -1,10 +1,10 @@
Name: apache-ivy
Version: 2.4.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Java-based dependency manager
License: ASL 2.0
-URL: http://ant.apache.org/ivy/
+URL: http://ant.apache.org/ivy
Source0: http://www.apache.org/dist/ant/ivy/%{version}/%{name}-%{version}-src.tar.gz
BuildArch: noarch
@@ -12,6 +12,8 @@ BuildArch: noarch
# settings files Ivy tries to load. This file will be used only as
# last resort, when no other setting files exist.
Patch0: %{name}-global-settings.patch
+# probably upstreamable, missing test case
+Patch1: port-to-bc-1.52.patch
Provides: ivy = %{version}-%{release}
@@ -51,6 +53,7 @@ JavaDoc documentation for %{name}
%prep
%setup -q
%patch0
+%patch1 -p1
%mvn_alias : jayasoft:ivy
%mvn_file : %{name}/ivy ivy
@@ -96,6 +99,9 @@ echo "apache-ivy/ivy" > $RPM_BUILD_ROOT%{_sysconfdir}/ant.d/%{name}
%license LICENSE NOTICE
%changelog
+* Mon May 04 2015 Michal Srb <msrb at redhat.com> - 2.4.0-2
+- Port to bouncycastle 1.52
+
* Wed Apr 1 2015 Mikolaj Izdebski <mizdebsk at redhat.com> - 2.4.0-1
- Update to upstream version 2.4.0
diff --git a/port-to-bc-1.52.patch b/port-to-bc-1.52.patch
new file mode 100644
index 0000000..0bdddab
--- /dev/null
+++ b/port-to-bc-1.52.patch
@@ -0,0 +1,93 @@
+diff --git a/ivy.xml b/ivy.xml
+index d448897..7d8896a 100644
+--- a/ivy.xml
++++ b/ivy.xml
+@@ -50,8 +50,8 @@
+ <dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.6" conf="default,sftp->default"/>
+ <dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.6" conf="default,sftp->default"/>
+ <dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.6" conf="default,sftp->default"/>
+- <dependency org="org.bouncycastle" name="bcpg-jdk14" rev="1.45" conf="default"/>
+- <dependency org="org.bouncycastle" name="bcprov-jdk14" rev="1.45" conf="default"/>
++ <dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.52" conf="default"/>
++ <dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.52" conf="default"/>
+
+ <!-- Test dependencies -->
+ <dependency org="junit" name="junit" rev="3.8.2" conf="test->default"/>
+diff --git a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
+index af7beae..bec8ae4 100644
+--- a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
++++ b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
+@@ -23,16 +23,18 @@ import java.io.FileOutputStream;
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.OutputStream;
+-import java.security.NoSuchAlgorithmException;
+-import java.security.NoSuchProviderException;
+ import java.security.Security;
+-import java.security.SignatureException;
+ import java.util.Iterator;
+
+ import org.apache.ivy.plugins.signer.SignatureGenerator;
+ import org.bouncycastle.bcpg.ArmoredOutputStream;
+ import org.bouncycastle.bcpg.BCPGOutputStream;
+ import org.bouncycastle.jce.provider.BouncyCastleProvider;
++import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
++import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
++import org.bouncycastle.openpgp.operator.bc.BcPBESecretKeyDecryptorBuilder;
++import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder;
++import org.bouncycastle.openpgp.operator.bc.BcPGPDigestCalculatorProvider;
+ import org.bouncycastle.openpgp.PGPException;
+ import org.bouncycastle.openpgp.PGPPrivateKey;
+ import org.bouncycastle.openpgp.PGPSecretKey;
+@@ -101,11 +103,13 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator {
+ pgpSec = readSecretKey(keyIn);
+ }
+
+- PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(password.toCharArray(),
+- BouncyCastleProvider.PROVIDER_NAME);
+- PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec.getPublicKey()
+- .getAlgorithm(), PGPUtil.SHA1, BouncyCastleProvider.PROVIDER_NAME);
+- sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
++ PBESecretKeyDecryptor decryptor = new BcPBESecretKeyDecryptorBuilder(
++ new BcPGPDigestCalculatorProvider()).build(password.toCharArray());
++ PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(decryptor);
++ PGPSignatureGenerator sGen = new PGPSignatureGenerator(
++ new BcPGPContentSignerBuilder(pgpSec.getPublicKey()
++ .getAlgorithm(), PGPUtil.SHA1));
++ sGen.init(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
+
+ in = new FileInputStream(src);
+ out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest)));
+@@ -116,22 +120,10 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator {
+ }
+
+ sGen.generate().encode(out);
+- } catch (SignatureException e) {
+- IOException ioexc = new IOException();
+- ioexc.initCause(e);
+- throw ioexc;
+ } catch (PGPException e) {
+ IOException ioexc = new IOException();
+ ioexc.initCause(e);
+ throw ioexc;
+- } catch (NoSuchAlgorithmException e) {
+- IOException ioexc = new IOException();
+- ioexc.initCause(e);
+- throw ioexc;
+- } catch (NoSuchProviderException e) {
+- IOException ioexc = new IOException();
+- ioexc.initCause(e);
+- throw ioexc;
+ } finally {
+ if (out != null) {
+ try {
+@@ -156,7 +148,8 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator {
+
+ private PGPSecretKey readSecretKey(InputStream in) throws IOException, PGPException {
+ in = PGPUtil.getDecoderStream(in);
+- PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in);
++ PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in,
++ new BcKeyFingerprintCalculator());
+
+ PGPSecretKey key = null;
+ for (Iterator it = pgpSec.getKeyRings(); key == null && it.hasNext();) {
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/apache-ivy.git/commit/?h=master&id=a58e0a3b3edc75e94d01deaa486589116daede3e
More information about the scm-commits
mailing list