comparison src/ch/ethz/ssh2/channel/AuthAgentForwardThread.java @ 302:beaccc9df37b ganymed

add ecdsa key support everywhere
author Carl Byington <carl@five-ten-sg.com>
date Tue, 29 Jul 2014 20:23:00 -0700
parents 349847b2e318
children a218d9cd725b
comparison
equal deleted inserted replaced
301:ca5dd224a87b 302:beaccc9df37b
26 import java.security.NoSuchAlgorithmException; 26 import java.security.NoSuchAlgorithmException;
27 import java.security.PrivateKey; 27 import java.security.PrivateKey;
28 import java.security.PublicKey; 28 import java.security.PublicKey;
29 import java.security.SecureRandom; 29 import java.security.SecureRandom;
30 import java.security.interfaces.DSAPrivateKey; 30 import java.security.interfaces.DSAPrivateKey;
31 import java.security.interfaces.ECPrivateKey;
31 import java.security.interfaces.RSAPrivateKey; 32 import java.security.interfaces.RSAPrivateKey;
32 import java.security.spec.DSAPrivateKeySpec; 33 import java.security.spec.DSAPrivateKeySpec;
33 import java.security.spec.DSAPublicKeySpec; 34 import java.security.spec.DSAPublicKeySpec;
34 import java.security.spec.ECParameterSpec; 35 import java.security.spec.ECParameterSpec;
35 import java.security.spec.ECPoint; 36 import java.security.spec.ECPoint;
458 response = RSASHA1Verify.encodeSSHRSASignature(signature); 459 response = RSASHA1Verify.encodeSSHRSASignature(signature);
459 } 460 }
460 else if (privKey instanceof DSAPrivateKey) { 461 else if (privKey instanceof DSAPrivateKey) {
461 byte[] signature = DSASHA1Verify.generateSignature(challenge, 462 byte[] signature = DSASHA1Verify.generateSignature(challenge,
462 (DSAPrivateKey) privKey, new SecureRandom()); 463 (DSAPrivateKey) privKey, new SecureRandom());
463 response = DSASHA1Verify.encodeSSHDSASignature(signature); 464 response = DSASHA1Verify.encodeSSHDSASignature(signature, );
464 } 465 }
465 else if (privKey instanceof ECPrivateKey) { 466 else if (privKey instanceof ECPrivateKey) {
467 ECPrivateKey pk = (ECPrivateKey) privKey;
466 byte[] signature = ECDSASHA2Verify.generateSignature(challenge, 468 byte[] signature = ECDSASHA2Verify.generateSignature(challenge,
467 (ECPrivateKey) privKey); 469 (ECPrivateKey) privKey, pk.getParams());
468 response = ECDSASHA2Verify.encodeSSHECDSASignature(signature); 470 response = ECDSASHA2Verify.encodeSSHECDSASignature(signature);
469 } 471 }
470 else { 472 else {
471 os.write(SSH_AGENT_FAILURE); 473 os.write(SSH_AGENT_FAILURE);
472 return; 474 return;