aboutsummaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2013-02-04 23:38:41 -0800
committerKenny Root <kenny@the-b.org>2013-02-04 23:43:55 -0800
commitaee3c2fdf1d32edec258cb5fb1c25357dde5183e (patch)
tree8919aba57fa14b5b556218d40cfb343452f46f53 /src/com
parenta0bba552cbca7fd9ef01d16cdf86f9a0837e4266 (diff)
downloadconnectbot-aee3c2fdf1d32edec258cb5fb1c25357dde5183e.tar.gz
connectbot-aee3c2fdf1d32edec258cb5fb1c25357dde5183e.tar.bz2
connectbot-aee3c2fdf1d32edec258cb5fb1c25357dde5183e.zip
Use RSA CRT keys for speed
Diffstat (limited to 'src/com')
-rw-r--r--src/com/trilead/ssh2/channel/AuthAgentForwardThread.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/com/trilead/ssh2/channel/AuthAgentForwardThread.java b/src/com/trilead/ssh2/channel/AuthAgentForwardThread.java
index f04c412..c6831e6 100644
--- a/src/com/trilead/ssh2/channel/AuthAgentForwardThread.java
+++ b/src/com/trilead/ssh2/channel/AuthAgentForwardThread.java
@@ -37,7 +37,7 @@ import java.security.spec.ECPrivateKeySpec;
import java.security.spec.ECPublicKeySpec;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
-import java.security.spec.RSAPrivateKeySpec;
+import java.security.spec.RSAPrivateCrtKeySpec;
import java.security.spec.RSAPublicKeySpec;
import java.util.Map;
import java.util.Map.Entry;
@@ -293,13 +293,17 @@ public class AuthAgentForwardThread extends Thread implements IChannelWorkerThre
BigInteger n = tr.readMPINT();
BigInteger e = tr.readMPINT();
BigInteger d = tr.readMPINT();
- tr.readMPINT(); // iqmp
- tr.readMPINT(); // p
- tr.readMPINT(); // q
+ BigInteger iqmp = tr.readMPINT();
+ BigInteger p = tr.readMPINT();
+ BigInteger q = tr.readMPINT();
comment = tr.readString();
+ // Derive the extra values Java needs.
+ BigInteger dmp1 = d.mod(p.subtract(BigInteger.ONE));
+ BigInteger dmq1 = d.mod(q.subtract(BigInteger.ONE));
+
pubSpec = new RSAPublicKeySpec(n, e);
- privSpec = new RSAPrivateKeySpec(n, d);
+ privSpec = new RSAPrivateCrtKeySpec(n, e, d, p, q, dmp1, dmq1, iqmp);
} else if (type.equals("ssh-dss")) {
keyType = "DSA";