From c36f336e6f294313cdab84352b108beea4607e48 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Tue, 26 Aug 2008 05:10:04 +0000 Subject: Update Trilead SSH-2 for Java from build 211 to build 213 --- lib/src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java | 8 ++++---- .../java/com/trilead/ssh2/crypto/cipher/BlockCipherFactory.java | 4 ++-- lib/src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java | 9 +++++---- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'lib/src/main/java/com/trilead/ssh2/crypto') diff --git a/lib/src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java b/lib/src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java index c6f1a4e..ac1b842 100644 --- a/lib/src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java +++ b/lib/src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java @@ -15,12 +15,11 @@ import com.trilead.ssh2.crypto.digest.MD5; import com.trilead.ssh2.signature.DSAPrivateKey; import com.trilead.ssh2.signature.RSAPrivateKey; - /** * PEM Support. * * @author Christian Plattner, plattner@trilead.com - * @version $Id: PEMDecoder.java,v 1.1 2007/10/15 12:49:56 cplattne Exp $ + * @version $Id: PEMDecoder.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $ */ public class PEMDecoder { @@ -82,7 +81,8 @@ public class PEMDecoder while (true) { md5.update(password, 0, password.length); - md5.update(salt, 0, 8); // ARGH we only use the first 8 bytes of the salt in this step. + md5.update(salt, 0, 8); // ARGH we only use the first 8 bytes of the + // salt in this step. // This took me two hours until I got AES-xxx running. int copy = (keyLen < tmp.length) ? keyLen : tmp.length; @@ -317,7 +317,7 @@ public class PEMDecoder if (password == null) throw new IOException("PEM is encrypted, but no password was specified"); - decryptPEM(ps, password.getBytes()); + decryptPEM(ps, password.getBytes("ISO-8859-1")); } if (ps.pemType == PEM_DSA_PRIVATE_KEY) diff --git a/lib/src/main/java/com/trilead/ssh2/crypto/cipher/BlockCipherFactory.java b/lib/src/main/java/com/trilead/ssh2/crypto/cipher/BlockCipherFactory.java index 5cc37ac..cf18f43 100644 --- a/lib/src/main/java/com/trilead/ssh2/crypto/cipher/BlockCipherFactory.java +++ b/lib/src/main/java/com/trilead/ssh2/crypto/cipher/BlockCipherFactory.java @@ -7,7 +7,7 @@ import java.util.Vector; * BlockCipherFactory. * * @author Christian Plattner, plattner@trilead.com - * @version $Id: BlockCipherFactory.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $ + * @version $Id: BlockCipherFactory.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $ */ public class BlockCipherFactory { @@ -36,7 +36,7 @@ public class BlockCipherFactory ciphers.addElement(new CipherEntry("aes256-ctr", 16, 32, "com.trilead.ssh2.crypto.cipher.AES")); ciphers.addElement(new CipherEntry("aes192-ctr", 16, 24, "com.trilead.ssh2.crypto.cipher.AES")); ciphers.addElement(new CipherEntry("aes128-ctr", 16, 16, "com.trilead.ssh2.crypto.cipher.AES")); - ciphers.addElement(new CipherEntry("blowfish-ctr", 8, 16, "com.trileadssh2.crypto.cipher.BlowFish")); + ciphers.addElement(new CipherEntry("blowfish-ctr", 8, 16, "com.trilead.ssh2.crypto.cipher.BlowFish")); ciphers.addElement(new CipherEntry("aes256-cbc", 16, 32, "com.trilead.ssh2.crypto.cipher.AES")); ciphers.addElement(new CipherEntry("aes192-cbc", 16, 24, "com.trilead.ssh2.crypto.cipher.AES")); diff --git a/lib/src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java b/lib/src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java index 85a7696..5622a72 100644 --- a/lib/src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java +++ b/lib/src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java @@ -1,6 +1,7 @@ package com.trilead.ssh2.crypto.dh; +import java.io.UnsupportedEncodingException; import java.math.BigInteger; import java.security.SecureRandom; @@ -12,7 +13,7 @@ import com.trilead.ssh2.log.Logger; * DhExchange. * * @author Christian Plattner, plattner@trilead.com - * @version $Id: DhExchange.java,v 1.1 2007/10/15 12:49:57 cplattne Exp $ + * @version $Id: DhExchange.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $ */ public class DhExchange { @@ -122,14 +123,14 @@ public class DhExchange } public byte[] calculateH(byte[] clientversion, byte[] serverversion, byte[] clientKexPayload, - byte[] serverKexPayload, byte[] hostKey) + byte[] serverKexPayload, byte[] hostKey) throws UnsupportedEncodingException { HashForSSH2Types hash = new HashForSSH2Types("SHA1"); if (log.isEnabled()) { - log.log(90, "Client: '" + new String(clientversion) + "'"); - log.log(90, "Server: '" + new String(serverversion) + "'"); + log.log(90, "Client: '" + new String(clientversion, "ISO-8859-1") + "'"); + log.log(90, "Server: '" + new String(serverversion, "ISO-8859-1") + "'"); } hash.updateByteString(clientversion); -- cgit v1.2.3