diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..b3b7d45 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,2 @@ +// Builds a module using https://github.com/jenkins-infra/pipeline-library +buildPlugin(configurations: buildPlugin.recommendedConfigurations()) diff --git a/pom.xml b/pom.xml index 7adf212..94ccf02 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,8 @@ org.jenkins-ci.plugins plugin - 3.36 + 3.42 + org.jenkins-ci.modules @@ -18,13 +19,14 @@ MIT License - https://opensource.org/licenses/mit-license.php + https://opensource.org/licenses/MIT scm:git:git://github.com/jenkinsci/${project.artifactId}-module.git scm:git:ssh://git@github.com/jenkinsci/${project.artifactId}-module.git + https://github.com/jenkinsci/${project.artifactId}-module HEAD @@ -33,6 +35,19 @@ 8 + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public/ + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public/ + + + io.github.stephenc.crypto 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 01b6779..77bd23e 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 @@ -10,7 +10,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.security.GeneralSecurityException; import java.security.KeyPair; @@ -71,7 +70,7 @@ public InstanceIdentity(File keyFile) throws IOException { } } - private static KeyPair read(File keyFile, File oldKeyFile, KeyPairGenerator gen) throws IOException { + private KeyPair read(File keyFile, File oldKeyFile, KeyPairGenerator gen) throws IOException { byte[] enc; KeyPair keyPair = null; @@ -95,7 +94,7 @@ private static KeyPair read(File keyFile, File oldKeyFile, KeyPairGenerator gen) return keyPair; } - private static void write(KeyPair keys, File keyFile) throws IOException { + private void write(KeyPair keys, File keyFile) throws IOException { String pem = PEMHelper.encodePEM(keys); OutputStream os = new FileOutputStream(keyFile); try { @@ -109,7 +108,7 @@ private static void write(KeyPair keys, File keyFile) throws IOException { } // Would be neater to actually write an encrypted RSA key in PEM format, but could not wrangle BouncyCastle into reading the result, so just doing generic encryption instead: - private static final CryptoConfidentialKey KEY = new CryptoConfidentialKey(InstanceIdentity.class, "KEY"); + private final CryptoConfidentialKey KEY = new CryptoConfidentialKey(InstanceIdentity.class, "KEY"); /** * Try to make the key read-only. diff --git a/src/test/java/org/jenkinsci/main/modules/instance_identity/ReadWriteKeyTest.java b/src/test/java/org/jenkinsci/main/modules/instance_identity/ReadWriteKeyTest.java index ffa7a04..2715e6b 100644 --- a/src/test/java/org/jenkinsci/main/modules/instance_identity/ReadWriteKeyTest.java +++ b/src/test/java/org/jenkinsci/main/modules/instance_identity/ReadWriteKeyTest.java @@ -101,7 +101,7 @@ public void testCompareReadPKCS1AndPCKS8() throws Exception { private static String unifyEOL(String s) { // unify EOL for comparison purposes - return s.replaceAll("(\r|\n)", "\n"); + return s.replaceAll("\r\n", "\n"); } }