From 54ca2c37bda02ff6f2579a20e122f3a893da705d Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Thu, 11 Apr 2013 20:45:22 -0700 Subject: Fix bug in EC point encoding --- lib/src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java | 5 +++-- lib/src/main/java/com/trilead/ssh2/transport/KexManager.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/src/main/java') diff --git a/lib/src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java b/lib/src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java index 97bda5f..4f3bae2 100644 --- a/lib/src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java +++ b/lib/src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java @@ -382,12 +382,13 @@ public class ECDSASHA2Verify { { byte[] affineX = removeLeadingZeroes(group.getAffineX().toByteArray()); - System.arraycopy(affineX, 0, M, 1, affineX.length); + System.arraycopy(affineX, 0, M, 1 + elementSize - affineX.length, affineX.length); } { byte[] affineY = removeLeadingZeroes(group.getAffineY().toByteArray()); - System.arraycopy(affineY, 0, M, 1 + elementSize, affineY.length); + System.arraycopy(affineY, 0, M, 1 + elementSize + elementSize - affineY.length, + affineY.length); } return M; diff --git a/lib/src/main/java/com/trilead/ssh2/transport/KexManager.java b/lib/src/main/java/com/trilead/ssh2/transport/KexManager.java index 04043e4..6e0d904 100644 --- a/lib/src/main/java/com/trilead/ssh2/transport/KexManager.java +++ b/lib/src/main/java/com/trilead/ssh2/transport/KexManager.java @@ -483,7 +483,7 @@ public class KexManager return; } - throw new IllegalStateException("Unkown KEX method!"); + throw new IllegalStateException("Unknown KEX method!"); } if (msg[0] == Packets.SSH_MSG_NEWKEYS) -- cgit v1.2.3