From e823570e3e995c19984064eac5b854463472eb12 Mon Sep 17 00:00:00 2001
From: xzl
Date: Mon, 22 Apr 2024 21:07:12 +0800
Subject: [PATCH] feat: update plexus-cipher to 2.0
Plexus Cipher Component used by Maven
Issue: https://github.com/deepin-community/sig-deepin-sysdev-team/issues/547
Log: update repo
---
.gitignore | 5 -
.travis.yml | 23 ----
README.md | 2 +-
debian/changelog | 9 ++
debian/control | 2 +-
debian/copyright | 1 +
debian/patches/series | 2 -
pom.xml | 67 ++++++------
.../plexus/components/cipher/Base64.java | 4 +-
.../cipher/DefaultPlexusCipher.java | 103 ++++++++----------
.../plexus/components/cipher/PBECipher.java | 37 ++-----
.../components/cipher/PlexusCipher.java | 27 +++--
.../cipher/PlexusCipherException.java | 4 +-
.../resources/META-INF/plexus/components.xml | 12 --
.../cipher/DefaultPlexusCipherTest.java | 36 ++++--
.../components/cipher/PBECipherTest.java | 17 ++-
16 files changed, 157 insertions(+), 194 deletions(-)
delete mode 100644 .gitignore
delete mode 100644 .travis.yml
delete mode 100644 debian/patches/series
delete mode 100644 src/main/resources/META-INF/plexus/components.xml
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 5a78575..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-target/
-.project
-.classpath
-.settings/
-bin
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 40289b1..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-language: java
-jdk:
- - openjdk8
- - openjdk11
- - openjdk13
- - openjdk14
-
-# No need for preliminary install step.
-install: true
-#
-# Run all integration tests.
-script:
- - "mvn --show-version --errors --batch-mode clean verify"
-#
-cache:
- directories:
- - $HOME/.m2
-branches:
- except:
- - gh-pages
-notifications:
- email:
- - khmarbaise@apache.org
diff --git a/README.md b/README.md
index edeb2f6..4f20502 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@ Plexus-Cipher
============
[](https://travis-ci.org/codehaus-plexus/plexus-cipher)
-[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.codehaus.plexus%22%20a%3A%plexus-cipher%22)
+[](https://search.maven.org/artifact/org.codehaus.plexus/plexus-cipher)
The current master is now at https://github.com/codehaus-plexus/plexus-cipher
diff --git a/debian/changelog b/debian/changelog
index cb00b7e..ccc716d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+plexus-cipher (2.0-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release
+ - Removed the patches
+ * Standards-Version updated to 4.6.0.1
+
+ -- Emmanuel Bourg Wed, 04 May 2022 01:31:06 +0200
+
plexus-cipher (1.8-2) unstable; urgency=medium
* Team upload.
diff --git a/debian/control b/debian/control
index 7c546cc..533ce0d 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Build-Depends:
libeclipse-sisu-maven-plugin-java,
libplexus-container-default1.5-java,
maven-debian-helper (>= 2.2)
-Standards-Version: 4.5.1
+Standards-Version: 4.6.0.1
Vcs-Git: https://salsa.debian.org/java-team/plexus-cipher.git
Vcs-Browser: https://salsa.debian.org/java-team/plexus-cipher
Homepage: https://github.com/codehaus-plexus/plexus-cipher
diff --git a/debian/copyright b/debian/copyright
index c36bf29..adb6600 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -2,6 +2,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Plexus Cipher Component
Upstream-Contact: Sonatype
Source: http://www.sonatype.org
+Files-Excluded: .github/*
Files: *
Copyright: 2008, Sonatype Inc.
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index d698f2a..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1,2 +0,0 @@
-sisu-maven-plugin.patch
-eclipse-sisu.patch
diff --git a/pom.xml b/pom.xml
index 21124f2..7039728 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,19 +5,19 @@
org.codehaus.plexus
plexus
- 5.1
+ 8
plexus-cipher
- 1.8
+ 2.0
Plexus Cipher: encryption/decryption Component
- scm:git:git@github.com:codehaus-plexus/plexus-cipher.git
- scm:git:git@github.com:codehaus-plexus/plexus-cipher.git
+ scm:git:https://github.com/codehaus-plexus/plexus-cipher.git
+ scm:git:https://github.com/codehaus-plexus/plexus-cipher.git
http://github.com/codehaus-plexus/plexus-cipher
- plexus-cipher-1.8
+ plexus-cipher-2.0
jira
@@ -32,15 +32,37 @@
7
+ 0.3.4
+ 2021-09-08T19:26:12Z
-
+
+
+
+ javax.inject
+ javax.inject
+ 1
+
+
+ org.eclipse.sisu
+ org.eclipse.sisu.inject
+ ${sisuVersion}
+ provided
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+
org.apache.maven.plugins
maven-surefire-plugin
- 2.22.1
+ 2.22.2
org.eclipse.m2e
@@ -51,9 +73,9 @@
- org.sonatype.plugins
+ org.eclipse.sisu
sisu-maven-plugin
- [1.1,)
+ [0.3.4,)
test-index
main-index
@@ -82,9 +104,7 @@
test
-
- utf8
-
+ -Dfile.encoding=utf8
@@ -94,18 +114,16 @@
test
-
- iso8859-1
-
+ -Dfile.encoding=iso8859-1
- org.sonatype.plugins
+ org.eclipse.sisu
sisu-maven-plugin
- 1.1
+ ${sisuVersion}
@@ -118,19 +136,4 @@
-
-
- org.sonatype.sisu
- sisu-inject-bean
- 2.6.0
- provided
-
-
- junit
- junit
- 4.12
- test
-
-
-
diff --git a/src/main/java/org/sonatype/plexus/components/cipher/Base64.java b/src/main/java/org/sonatype/plexus/components/cipher/Base64.java
index 8420278..1ee726a 100644
--- a/src/main/java/org/sonatype/plexus/components/cipher/Base64.java
+++ b/src/main/java/org/sonatype/plexus/components/cipher/Base64.java
@@ -95,7 +95,7 @@ public class Base64
* The value of undefined encodings is -1
.
*
*/
- private static byte[] base64Alphabet = new byte[BASELENGTH];
+ private static final byte[] base64Alphabet = new byte[BASELENGTH];
/**
*
@@ -110,7 +110,7 @@ public class Base64
* For example, lookUpBase64Alphabet[62]
returns '+'
.
*
*/
- private static byte[] lookUpBase64Alphabet = new byte[LOOKUPLENGTH];
+ private static final byte[] lookUpBase64Alphabet = new byte[LOOKUPLENGTH];
// Populating the lookup and character arrays
static {
diff --git a/src/main/java/org/sonatype/plexus/components/cipher/DefaultPlexusCipher.java b/src/main/java/org/sonatype/plexus/components/cipher/DefaultPlexusCipher.java
index 379eedd..db5a9b6 100644
--- a/src/main/java/org/sonatype/plexus/components/cipher/DefaultPlexusCipher.java
+++ b/src/main/java/org/sonatype/plexus/components/cipher/DefaultPlexusCipher.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2008 Sonatype, Inc. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
@@ -15,35 +15,38 @@
import java.security.Provider;
import java.security.Security;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.enterprise.inject.Typed;
import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.eclipse.sisu.Typed;
/**
+ * Default implementation of {@link PlexusCipher}. This class is thread safe.
+ *
* @author Oleg Gusakov
*/
+@Singleton
@Named( "default" )
@Typed( PlexusCipher.class )
public class DefaultPlexusCipher
implements PlexusCipher
{
-
private static final Pattern ENCRYPTED_STRING_PATTERN = Pattern.compile( ".*?[^\\\\]?\\{(.*?[^\\\\])\\}.*" );
private final PBECipher _cipher;
// ---------------------------------------------------------------
public DefaultPlexusCipher()
- throws PlexusCipherException
{
_cipher = new PBECipher();
}
// ---------------------------------------------------------------
+ @Override
public String encrypt( final String str, final String passPhrase )
throws PlexusCipherException
{
@@ -56,6 +59,7 @@ public String encrypt( final String str, final String passPhrase )
}
// ---------------------------------------------------------------
+ @Override
public String encryptAndDecorate( final String str, final String passPhrase )
throws PlexusCipherException
{
@@ -63,6 +67,7 @@ public String encryptAndDecorate( final String str, final String passPhrase )
}
// ---------------------------------------------------------------
+ @Override
public String decrypt( final String str, final String passPhrase )
throws PlexusCipherException
{
@@ -75,6 +80,7 @@ public String decrypt( final String str, final String passPhrase )
}
// ---------------------------------------------------------------
+ @Override
public String decryptDecorated( final String str, final String passPhrase )
throws PlexusCipherException
{
@@ -92,6 +98,7 @@ public String decryptDecorated( final String str, final String passPhrase )
}
// ----------------------------------------------------------------------------
+ @Override
public boolean isEncryptedString( final String str )
{
if ( str == null || str.length() < 1 )
@@ -105,7 +112,7 @@ public boolean isEncryptedString( final String str )
}
// ----------------------------------------------------------------------------
- // -------------------
+ @Override
public String unDecorate( final String str )
throws PlexusCipherException
{
@@ -122,43 +129,39 @@ public String unDecorate( final String str )
}
// ----------------------------------------------------------------------------
- // -------------------
+ @Override
public String decorate( final String str )
{
return ENCRYPTED_STRING_DECORATION_START + ( str == null ? "" : str ) + ENCRYPTED_STRING_DECORATION_STOP;
}
// ---------------------------------------------------------------
- // ---------------------------------------------------------------
- // ***************************************************************
+
/**
* Exploratory part. This method returns all available services types
*/
public static String[] getServiceTypes()
{
- Set result = new HashSet();
+ Set result = new HashSet<>();
// All all providers
Provider[] providers = Security.getProviders();
- for ( int i = 0; i < providers.length; i++ )
- {
+ for (Provider provider : providers) {
// Get services provided by each provider
- Set keys = providers[i].keySet();
- for ( Iterator it = keys.iterator(); it.hasNext(); )
- {
- String key = (String) it.next();
- key = key.split( " " )[0];
-
- if ( key.startsWith( "Alg.Alias." ) )
- {
+ Set