Update to upstream version 1.7

This commit is contained in:
Michal Srb 2013-03-20 09:44:49 +01:00
parent 97d6393a28
commit 5156fc05b6
5 changed files with 15 additions and 123 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
plexus-cipher-1.5.tar.gz
/LICENSE-2.0.txt
/plexus-cipher-1.7.tar.gz

View File

@ -1,89 +0,0 @@
From f9975b549fcb2453b1127ceccfd1f8061e35a618 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Tue, 27 Nov 2012 15:32:10 +0100
Subject: [PATCH] Improve randomness of PBECipher salt
See: https://bugzilla.redhat.com/show_bug.cgi?id=880279
---
.../plexus/components/cipher/PBECipher.java | 43 +++-------------------
1 file changed, 5 insertions(+), 38 deletions(-)
diff --git a/src/main/java/org/sonatype/plexus/components/cipher/PBECipher.java b/src/main/java/org/sonatype/plexus/components/cipher/PBECipher.java
index ce6b173..c69e753 100644
--- a/src/main/java/org/sonatype/plexus/components/cipher/PBECipher.java
+++ b/src/main/java/org/sonatype/plexus/components/cipher/PBECipher.java
@@ -63,9 +63,8 @@ public class PBECipher
protected MessageDigest _digester;
- protected SecureRandom _secureRandom;
-
- protected boolean _onLinux = false;
+ private static final SecureRandom _secureRandom = new SecureRandom();
+
//---------------------------------------------------------------
public PBECipher()
throws PlexusCipherException
@@ -73,21 +72,6 @@ public class PBECipher
try
{
_digester = MessageDigest.getInstance( DIGEST_ALG );
-
- if( System.getProperty( "os.name", "blah" ).toLowerCase().indexOf( "linux" ) != -1 )
- {
- _onLinux = true;
- }
-
- if( _onLinux )
- {
- System.setProperty( "securerandom.source", "file:/dev/./urandom");
- }
- else
- {
- _secureRandom = new SecureRandom();
- }
-
}
catch ( NoSuchAlgorithmException e )
{
@@ -96,21 +80,10 @@ public class PBECipher
}
//---------------------------------------------------------------
private byte[] getSalt( final int sz )
- throws NoSuchAlgorithmException, NoSuchProviderException
{
- byte [] res = null;
-
- if( _secureRandom != null )
- {
- _secureRandom.setSeed( System.currentTimeMillis() );
- res = _secureRandom.generateSeed( sz );
- }
- else
- {
- res = new byte[ sz ];
- Random r = new Random( System.currentTimeMillis() );
- r.nextBytes( res );
- }
+ byte[] res = new byte[ sz ];
+
+ _secureRandom.nextBytes( res );
return res;
}
@@ -124,12 +97,6 @@ public class PBECipher
byte[] salt = getSalt( SALT_SIZE );
- // spin it :)
- if( _secureRandom != null )
- {
- new SecureRandom().nextBytes( salt );
- }
-
Cipher cipher = createCipher( password.getBytes( STRING_ENCODING ), salt, Cipher.ENCRYPT_MODE );
byte [] encryptedBytes = cipher.doFinal( clearBytes );
--
1.7.11.7

View File

@ -1,18 +0,0 @@
diff -Naur plexus-cipher-1.5.orig/pom.xml plexus-cipher-1.5/pom.xml
--- plexus-cipher-1.5.orig/pom.xml 2009-09-14 13:50:04.000000000 +0200
+++ plexus-cipher-1.5/pom.xml 2011-07-26 18:05:06.195978918 +0200
@@ -25,12 +25,11 @@
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-maven-plugin</artifactId>
- <version>1.3.5</version>
+ <artifactId>plexus-component-metadata</artifactId>
<executions>
<execution>
<goals>
- <goal>descriptor</goal>
+ <goal>generate-metadata</goal>
</goals>
</execution>
</executions>

View File

@ -1,6 +1,6 @@
Name: plexus-cipher
Version: 1.5
Release: 14%{?dist}
Version: 1.7
Release: 1%{?dist}
Summary: Plexus Cipher: encryption/decryption Component
Group: Development/Libraries
@ -9,13 +9,9 @@ License: ASL 2.0
URL: https://github.com/sonatype/plexus-cipher
# git clone https://github.com/sonatype/plexus-cipher.git
# cd plexus-cipher/
# there is no tag 1.5 in git repository
# git archive --format tar 6df2b65 | gzip -9 > plexus-cipher-1.5.tar.gz
# note this is version 1.7 + our patches which were incorporated by upstream maintainer
# git archive --format tar --prefix=plexus-cipher-1.7/ 0cff29e6b2e | gzip -9 > plexus-cipher-1.7.tar.gz
Source0: %{name}-%{version}.tar.gz
Source1: http://apache.org/licenses/LICENSE-2.0.txt
Patch0: %{name}-migration-to-component-metadata.patch
Patch1: 0001-Improve-randomness-of-PBECipher-salt.patch
BuildArch: noarch
@ -37,6 +33,8 @@ BuildRequires: plexus-containers-component-metadata
BuildRequires: junit
BuildRequires: maven-shared-reporting-impl
BuildRequires: plexus-digest
BuildRequires: sisu-maven-plugin
BuildRequires: sisu-inject-bean
Requires: jpackage-utils
Requires: java
@ -57,10 +55,8 @@ API documentation for %{name}.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
cp %{SOURCE1} .
# replace %{version}-SNAPSHOT with %{version}
%pom_xpath_replace pom:project/pom:version "<version>%{version}</version>"
%build
mvn-rpmbuild -Dmaven.test.failure.ignore=true \
@ -80,16 +76,19 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/plexus/%{name}/
%add_maven_depmap JPP.plexus-%{name}.pom plexus/%{name}.jar
%files
%doc LICENSE-2.0.txt NOTICE.txt
%doc LICENSE.txt NOTICE.txt
%{_javadir}/plexus/*
%{_mavenpomdir}/*
%{_mavendepmapfragdir}/*
%files javadoc
%doc LICENSE-2.0.txt NOTICE.txt
%doc LICENSE.txt NOTICE.txt
%{_javadocdir}/plexus/%{name}
%changelog
* Wed Mar 13 2013 Michal Srb <msrb@redhat.com> - 1.7-1
- Update to upstream version 1.7
* Fri Feb 08 2013 Michal Srb <msrb@redhat.com> - 1.5-14
- Remove unnecessary dependency on plexus-containers (#908586)

View File

@ -1,2 +1 @@
4c61273327f3b8cb02a5ae9ea1e491dc plexus-cipher-1.5.tar.gz
3b83ef96387f14655fc854ddc3c6bd57 LICENSE-2.0.txt
052bfc5cab808a1fe012a8f7d840f6b0 plexus-cipher-1.7.tar.gz