<!DOCTYPE html>
<html lang='en'>
<head>
<title>gnu: Add u-boot-qemu-riscv64. - guix - Wojtek's customized Guix</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='noindex, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/better-cgit-markdown-heading-color.css'/>
<link rel='shortcut icon' href='/cgit-static/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://git.koszko.org/guix/atom/etc/snippets/text-mode?h=koszko' type='application/atom+xml'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='https://git.koszko.org/cgit-static/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/guix/'>guix</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='10f31af9e36061e1fb7df8c394eecc1c1136b4bc'/><select name='h' onchange='this.form.submit();'>
<option value='koszko' selected='selected'>koszko</option>
<option value='koszko-scripts'>koszko-scripts</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Wojtek's customized Guix</td><td class='sub right'>tr></table>
<table class='tabs'><tr><td>
<a class='active' href='/guix/about/'>about</a><a href='/guix/'>summary</a><a href='/guix/refs/?id=887dec8a51604408214d28290ce857451dcd7192'>refs</a><a href='/guix/log/'>log</a><a href='/guix/tree/?id=887dec8a51604408214d28290ce857451dcd7192'>tree</a><a href='/guix/commit/?id=887dec8a51604408214d28290ce857451dcd7192'>commit</a><a href='/guix/diff/?id=887dec8a51604408214d28290ce857451dcd7192'>diff</a></td><td class='form'><form class='right' method='get' action='/guix/log/'>
<input type='hidden' name='id' value='887dec8a51604408214d28290ce857451dcd7192'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div id='summary'><pre>
From 29055a825af5405e44ffcd59a776f8952bdc7203 Mon Sep 17 00:00:00 2001
From: Julien Lepiller &lt;julien@lepiller.eu&gt;
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 &amp;&amp; it.hasNext();) {
-- 
2.15.1
</pre>
</div></div> <!-- class=content -->
                         <div class=footer>generated by
                             <a href="https://git.zx2c4.com/cgit/about/">
                                 cgit
                             </a>
                         </div>
                        </div> <!-- id=cgit -->
</body>
</html>
