diff options
author | Julien Lepiller <julien@lepiller.eu> | 2018-04-18 17:19:12 +0200 |
---|---|---|
committer | Julien Lepiller <julien@lepiller.eu> | 2018-04-29 23:23:14 +0200 |
commit | f1f4a4f016291509ed97034af0216573cdacf36c (patch) | |
tree | 17375ff502cee15077fb90162eb77ff9eaa444d5 /gnu/packages/patches | |
parent | b0fbf59656442a44e18672a6b0ddfb9fb9c659a0 (diff) | |
download | guix-f1f4a4f016291509ed97034af0216573cdacf36c.tar.gz |
gnu: Add java-apache-ivy.
* gnu/package/java.scm (java-apache-ivy): New variable. * gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r-- | gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch b/gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch new file mode 100644 index 0000000000..506de833dd --- /dev/null +++ b/gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch @@ -0,0 +1,81 @@ +From 29055a825af5405e44ffcd59a776f8952bdc7203 Mon Sep 17 00:00:00 2001 +From: Julien Lepiller <julien@lepiller.eu> +Date: Fri, 15 Dec 2017 16:03:23 +0100 +Subject: [PATCH] Port to latest bouncycastle. + +--- + .../bouncycastle/OpenPGPSignatureGenerator.java | 34 ++++++++++------------ + 1 file changed, 16 insertions(+), 18 deletions(-) + +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..34c204f 100644 +--- a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java ++++ b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java +@@ -41,6 +41,11 @@ 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.PBESecretKeyDecryptor; ++import org.bouncycastle.openpgp.operator.bc.BcPBESecretKeyDecryptorBuilder; ++import org.bouncycastle.openpgp.operator.bc.BcPGPDigestCalculatorProvider; ++import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder; ++import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator; + + public class OpenPGPSignatureGenerator implements SignatureGenerator { + +@@ -101,11 +106,15 @@ 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); ++ BcPGPContentSignerBuilder builder = new BcPGPContentSignerBuilder( ++ pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1); ++ ++ PGPSignatureGenerator sGen = new PGPSignatureGenerator(builder); ++ sGen.init(PGPSignature.BINARY_DOCUMENT, pgpPrivKey); + + in = new FileInputStream(src); + out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest))); +@@ -116,22 +125,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 +153,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();) { +-- +2.15.1 |