mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 15:20:54 +03:00
Useless indirection
This commit is contained in:
@@ -139,8 +139,4 @@ public class ByteArrayUtils {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] copyOf(byte[] array) {
|
|
||||||
return Arrays.copyOf(array, array.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
package net.schmizz.sshj.transport.kex;
|
package net.schmizz.sshj.transport.kex;
|
||||||
|
|
||||||
import net.schmizz.sshj.common.Buffer;
|
import net.schmizz.sshj.common.Buffer;
|
||||||
import net.schmizz.sshj.common.ByteArrayUtils;
|
|
||||||
import net.schmizz.sshj.common.DisconnectReason;
|
import net.schmizz.sshj.common.DisconnectReason;
|
||||||
import net.schmizz.sshj.common.Factory;
|
import net.schmizz.sshj.common.Factory;
|
||||||
import net.schmizz.sshj.common.KeyType;
|
import net.schmizz.sshj.common.KeyType;
|
||||||
@@ -53,6 +52,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for DHG key exchange algorithms. Implementations will only have to configure the required data on the
|
* Base class for DHG key exchange algorithms. Implementations will only have to configure the required data on the
|
||||||
@@ -80,12 +80,12 @@ public abstract class AbstractDHG
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] getH() {
|
public byte[] getH() {
|
||||||
return ByteArrayUtils.copyOf(H);
|
return Arrays.copyOf(H, H.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] getK() {
|
public byte[] getK() {
|
||||||
return ByteArrayUtils.copyOf(K);
|
return Arrays.copyOf(K, K.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -102,10 +102,10 @@ public abstract class AbstractDHG
|
|||||||
public void init(Transport trans, byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C)
|
public void init(Transport trans, byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C)
|
||||||
throws GeneralSecurityException, TransportException {
|
throws GeneralSecurityException, TransportException {
|
||||||
this.trans = trans;
|
this.trans = trans;
|
||||||
this.V_S = ByteArrayUtils.copyOf(V_S);
|
this.V_S = Arrays.copyOf(V_S, V_S.length);
|
||||||
this.V_C = ByteArrayUtils.copyOf(V_C);
|
this.V_C = Arrays.copyOf(V_C, V_C.length);
|
||||||
this.I_S = ByteArrayUtils.copyOf(I_S);
|
this.I_S = Arrays.copyOf(I_S, I_S.length);
|
||||||
this.I_C = ByteArrayUtils.copyOf(I_C);
|
this.I_C = Arrays.copyOf(I_C, I_C.length);
|
||||||
sha.init();
|
sha.init();
|
||||||
initDH(dh);
|
initDH(dh);
|
||||||
e = dh.getE();
|
e = dh.getE();
|
||||||
|
|||||||
Reference in New Issue
Block a user