diff options
author | Kenny Root <kenny@the-b.org> | 2013-02-04 23:38:41 -0800 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2013-02-04 23:43:55 -0800 |
commit | ebec6db1083652b898b1e382712b59fe1e99e5f4 (patch) | |
tree | c91cffe18164b845f1353d3ebca6bd2ce4519deb /lib/src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java | |
parent | adabbacc18acd44182702d74aa7a4eac338fc43d (diff) | |
download | sshlib-ebec6db1083652b898b1e382712b59fe1e99e5f4.tar.gz sshlib-ebec6db1083652b898b1e382712b59fe1e99e5f4.tar.bz2 sshlib-ebec6db1083652b898b1e382712b59fe1e99e5f4.zip |
Use RSA CRT keys for speed
Diffstat (limited to 'lib/src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java')
-rw-r--r-- | lib/src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java b/lib/src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java index f04c412..c6831e6 100644 --- a/lib/src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java +++ b/lib/src/main/java/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"; |