[jenkins-instance-identity] Update to upstream version 1.4

Michal Srb msrb at fedoraproject.org
Wed Feb 4 13:12:54 UTC 2015


commit 04c2dd85dc17e4c29ad4ef9feaec767cbb44cf28
Author: Michal Srb <msrb at redhat.com>
Date:   Wed Feb 4 13:36:24 2015 +0100

    Update to upstream version 1.4

 .gitignore                             |    1 +
 0001-Update-bouncycastle-to-1.50.patch |   89 +++++++++++++++++++-------------
 jenkins-instance-identity.spec         |    7 ++-
 sources                                |    2 +-
 4 files changed, 60 insertions(+), 39 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f9950c2..d75d34c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 /instance-identity-1.3.tar.gz
+/instance-identity-1.4.tar.gz
diff --git a/0001-Update-bouncycastle-to-1.50.patch b/0001-Update-bouncycastle-to-1.50.patch
index 44a6291..41bc499 100644
--- a/0001-Update-bouncycastle-to-1.50.patch
+++ b/0001-Update-bouncycastle-to-1.50.patch
@@ -1,18 +1,18 @@
-From b778048a262d7bccbb3521c19c627b0d0b944fa5 Mon Sep 17 00:00:00 2001
+From 1e2a5b0b7272b010a4ea742d38da7253d84ccac1 Mon Sep 17 00:00:00 2001
 From: Michal Srb <msrb at redhat.com>
-Date: Tue, 25 Feb 2014 11:02:00 +0100
+Date: Wed, 4 Feb 2015 14:04:44 +0100
 Subject: [PATCH] Update bouncycastle to 1.50
 
 ---
- pom.xml                                                    |  2 +-
- .../main/modules/instance_identity/InstanceIdentity.java   | 14 +++++++-------
- 2 files changed, 8 insertions(+), 8 deletions(-)
+ pom.xml                                                 |  2 +-
+ .../modules/instance_identity/InstanceIdentity.java     | 17 ++++++++++-------
+ 2 files changed, 11 insertions(+), 8 deletions(-)
 
 diff --git a/pom.xml b/pom.xml
-index 9aabe6f..0cc9e47 100644
+index c648eb2..e8c7bb7 100644
 --- a/pom.xml
 +++ b/pom.xml
-@@ -40,7 +40,7 @@
+@@ -29,7 +29,7 @@
      <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcpkix-jdk15on</artifactId>
@@ -22,45 +22,62 @@ index 9aabe6f..0cc9e47 100644
    </dependencies>
  </project>
 diff --git a/src/main/java/org/jenkinsci/main/modules/instance_identity/InstanceIdentity.java b/src/main/java/org/jenkinsci/main/modules/instance_identity/InstanceIdentity.java
-index 4feedad..b3e534c 100644
+index 5e4d225..c60e7c8 100644
 --- a/src/main/java/org/jenkinsci/main/modules/instance_identity/InstanceIdentity.java
 +++ b/src/main/java/org/jenkinsci/main/modules/instance_identity/InstanceIdentity.java
-@@ -3,8 +3,11 @@ package org.jenkinsci.main.modules.instance_identity;
+@@ -3,9 +3,11 @@ package org.jenkinsci.main.modules.instance_identity;
  import hudson.FilePath;
- import hudson.model.Hudson;
+ import hudson.Util;
  import hudson.model.PageDecorator;
--import org.bouncycastle.openssl.PEMReader;
 +
+ import java.io.File;
+ import java.io.FileOutputStream;
+ import java.io.FileReader;
++import java.io.FileWriter;
+ import java.io.IOException;
+ import java.io.OutputStream;
+ import java.io.Reader;
+@@ -19,11 +21,15 @@ import java.security.interfaces.RSAPrivateKey;
+ import java.security.interfaces.RSAPublicKey;
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
++
+ import jenkins.model.Jenkins;
+ import jenkins.security.CryptoConfidentialKey;
++
+ import org.apache.commons.io.FileUtils;
+-import org.bouncycastle.openssl.PEMReader;
 +import org.bouncycastle.openssl.PEMKeyPair;
 +import org.bouncycastle.openssl.PEMParser;
  import org.bouncycastle.openssl.PEMWriter;
 +import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
  
- import java.io.File;
- import java.io.FileReader;
-@@ -40,11 +43,8 @@ public class InstanceIdentity {
-             if (keyFile.exists()) {
-                 FileReader in = new FileReader(keyFile);
-                 try {
--                    // a hack to work around a problem in PEMReader (or JCE, depending on how you look at it.)
--                    // I can't just pass in null as a provider --- JCE doesn't default to the default provider,
--                    // but it chokes that I passed in null. Urgh.
--                    final String provider = KeyPairGenerator.getInstance("RSA").getProvider().getName();
--                    keys = (KeyPair)new PEMReader(in,null,provider).readObject();
-+                    PEMKeyPair kp = (PEMKeyPair) new PEMParser(in).readObject();
-+                    keys = new JcaPEMKeyConverter().getKeyPair(kp);
-                 } finally {
-                     in.close();
-                 }
-@@ -53,7 +53,7 @@ public class InstanceIdentity {
-                 gen.initialize(2048,new SecureRandom()); // going beyond 2048 requires crypto extension
-                 keys = gen.generateKeyPair();
+ /**
+  * Captures the RSA key pair that identifies/authenticates this instance.
+@@ -70,12 +76,9 @@ public class InstanceIdentity {
+     }
+ 
+     private static KeyPair read(Reader in, KeyPairGenerator gen) throws IOException {
+-        // a hack to work around a problem in PEMReader (or JCE, depending on how you look at it.)
+-        // I can't just pass in null as a provider --- JCE doesn't default to the default provider,
+-        // but it chokes that I passed in null. Urgh.
+-        String provider = gen.getProvider().getName();
+         try {
+-            return (KeyPair) new PEMReader(in, null, provider).readObject();
++            PEMKeyPair kp = (PEMKeyPair) new PEMParser(in).readObject();
++            return new JcaPEMKeyConverter().getKeyPair(kp);
+         } finally {
+             in.close();
+         }
+@@ -83,7 +86,7 @@ public class InstanceIdentity {
  
--                PEMWriter w = new PEMWriter(new FileWriter(keyFile),"SunJCE");
-+                PEMWriter w = new PEMWriter(new FileWriter(keyFile));
-                 try {
-                     w.writeObject(keys);
-                 } finally {
+     private static void write(KeyPair keys, File keyFile) throws IOException {
+         StringWriter sw = new StringWriter();
+-        PEMWriter w = new PEMWriter(sw, "SunJCE");
++        PEMWriter w = new PEMWriter(new FileWriter(keyFile));
+         try {
+             w.writeObject(keys);
+         } finally {
 -- 
-1.9.0
+2.1.0
 
diff --git a/jenkins-instance-identity.spec b/jenkins-instance-identity.spec
index e378ed4..4854752 100644
--- a/jenkins-instance-identity.spec
+++ b/jenkins-instance-identity.spec
@@ -2,8 +2,8 @@
 %global short_name instance-identity
 
 Name:           jenkins-instance-identity
-Version:        1.3
-Release:        4%{?dist}
+Version:        1.4
+Release:        1%{?dist}
 Summary:        Jenkins identity instance
 
 License:        MIT
@@ -57,6 +57,9 @@ This package contains the API documentation for %{name}.
 %doc LICENSE.txt
 
 %changelog
+* Wed Feb 04 2015 Michal Srb <msrb at redhat.com> - 1.4-1
+- Update to upstream version 1.4
+
 * Mon Jun 09 2014 Michal Srb <msrb at redhat.com> - 1.3-4
 - Install only JAR files
 
diff --git a/sources b/sources
index c42e0de..9bb9e3f 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-98b3eba5b41e84545c12e232c4a4878a  instance-identity-1.3.tar.gz
+a53fe58aacabf91e464abfac1f8bb70f  instance-identity-1.4.tar.gz


More information about the scm-commits mailing list