Skip to content

Commit

Permalink
Fix missing dependency on directly used trilead-api (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
olamy authored Mar 25, 2024
1 parent ff80157 commit c73117e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ THE SOFTWARE.
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ssh-credentials</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>trilead-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
Expand Down
21 changes: 9 additions & 12 deletions src/main/java/hudson/scm/SubversionSCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import hudson.init.InitMilestone;

import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
import java.security.KeyStore;
import java.security.KeyStoreException;
Expand Down Expand Up @@ -128,6 +129,7 @@
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
Expand All @@ -139,7 +141,6 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.UUID;
Expand Down Expand Up @@ -195,9 +196,7 @@

import com.trilead.ssh2.DebugLogger;
import com.trilead.ssh2.SCPClient;
import com.trilead.ssh2.crypto.Base64;
import static java.util.stream.Collectors.toList;
import edu.umd.cs.findbugs.annotations.NonNull;
import jenkins.MasterToSlaveFileCallable;
import jenkins.util.JenkinsJVM;
import org.kohsuke.stapler.interceptor.RequirePOST;
Expand Down Expand Up @@ -2070,20 +2069,16 @@ public static final class SslClientCertificateCredential extends Credential {

public SslClientCertificateCredential(File certificate, String password) throws IOException {
this.password = Secret.fromString(Scrambler.scramble(password));
this.certificate = Secret.fromString(new String(Base64.encode(FileUtils.readFileToByteArray(certificate))));
this.certificate = Secret.fromString(new String(Base64.getEncoder().encode(FileUtils.readFileToByteArray(certificate)), StandardCharsets.UTF_8));
}

@Override
public SVNAuthentication createSVNAuthentication(String kind) {
if(kind.equals(ISVNAuthenticationManager.SSL))
try {
return SVNSSLAuthentication.newInstance(
Base64.decode(certificate.getPlainText().toCharArray()),
Scrambler.descramble(Secret.toString(password)).toCharArray(),
false, null, false);
} catch (IOException e) {
throw new Error(e); // can't happen
}
return SVNSSLAuthentication.newInstance(
Base64.getDecoder().decode(certificate.getPlainText()),
Scrambler.descramble(Secret.toString(password)).toCharArray(),
false, null, false);
else
return null; // unexpected authentication type
}
Expand Down Expand Up @@ -3324,6 +3319,8 @@ public FormValidation doCheckLocal(@QueryParameter String value) throws IOExcept
* Enables trace logging of Ganymed SSH library.
* <p>
* Intended to be invoked from Groovy console.
* @deprecated
* Logging all goes to JDK java.util.logging
*/
public static void enableSshDebug(Level level) {
if(level==null) level= Level.FINEST; // default
Expand Down

0 comments on commit c73117e

Please sign in to comment.