diff options
author | Kenny Root <kenny@the-b.org> | 2013-04-10 18:43:35 -0700 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2013-04-10 20:14:43 -0700 |
commit | 1e98217978aaccfcf62097266f699acf5b22493e (patch) | |
tree | 6105f3632913e61d836fd047349e67d8f9d55f7a /src/com/trilead/ssh2/crypto/KeyMaterial.java | |
parent | d36f48b37697e8f7797a9a8435647577675a6a5b (diff) | |
download | connectbot-1e98217978aaccfcf62097266f699acf5b22493e.tar.gz connectbot-1e98217978aaccfcf62097266f699acf5b22493e.tar.bz2 connectbot-1e98217978aaccfcf62097266f699acf5b22493e.zip |
Add ECDH support
Add support for the ECDH methods required by RFC 5656
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
Diffstat (limited to 'src/com/trilead/ssh2/crypto/KeyMaterial.java')
-rw-r--r-- | src/com/trilead/ssh2/crypto/KeyMaterial.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/com/trilead/ssh2/crypto/KeyMaterial.java b/src/com/trilead/ssh2/crypto/KeyMaterial.java index 5dfb55e..035717d 100644 --- a/src/com/trilead/ssh2/crypto/KeyMaterial.java +++ b/src/com/trilead/ssh2/crypto/KeyMaterial.java @@ -3,6 +3,8 @@ package com.trilead.ssh2.crypto; import java.math.BigInteger;
+import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import com.trilead.ssh2.crypto.digest.HashForSSH2Types;
@@ -66,13 +68,18 @@ public class KeyMaterial return res;
}
- public static KeyMaterial create(String hashType, byte[] H, BigInteger K, byte[] SessionID, int keyLengthCS,
+ public static KeyMaterial create(String hashAlgo, byte[] H, BigInteger K, byte[] SessionID, int keyLengthCS, int blockSizeCS, int macLengthCS, int keyLengthSC, int blockSizeSC, int macLengthSC)
throws IllegalArgumentException
{
KeyMaterial km = new KeyMaterial();
- HashForSSH2Types sh = new HashForSSH2Types(hashType);
+ HashForSSH2Types sh; + try { + sh = new HashForSSH2Types(MessageDigest.getInstance(hashAlgo)); + } catch (NoSuchAlgorithmException e) { + throw new IllegalArgumentException(e); + } km.initial_iv_client_to_server = calculateKey(sh, K, H, (byte) 'A', SessionID, blockSizeCS);
|