aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2016-03-14 00:18:55 -0700
committerKenny Root <kenny@the-b.org>2016-03-14 00:41:09 -0700
commitc69a7e4a6992fa9d2a4ea0d3bbd052e0709b07f7 (patch)
treeb12b6912e23d4eb4b1c5e3f7a268313575633688 /app
parentd4e9b80b5bcbf55091c79c434df4352af63fa065 (diff)
downloadconnectbot-c69a7e4a6992fa9d2a4ea0d3bbd052e0709b07f7.tar.gz
connectbot-c69a7e4a6992fa9d2a4ea0d3bbd052e0709b07f7.tar.bz2
connectbot-c69a7e4a6992fa9d2a4ea0d3bbd052e0709b07f7.zip
Handle EC keys in auth agent scenarios
The fact that each key type has to be handled here probably shows that this interface is defined at the wrong level of abstraction. However, before EC keys were not being returned as possible identities which might have caused #378.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/org/connectbot/transport/SSH.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/src/main/java/org/connectbot/transport/SSH.java b/app/src/main/java/org/connectbot/transport/SSH.java
index cb6703e..7892165 100644
--- a/app/src/main/java/org/connectbot/transport/SSH.java
+++ b/app/src/main/java/org/connectbot/transport/SSH.java
@@ -28,6 +28,8 @@ import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.DSAPrivateKey;
import java.security.interfaces.DSAPublicKey;
+import java.security.interfaces.ECPrivateKey;
+import java.security.interfaces.ECPublicKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
@@ -69,6 +71,7 @@ import com.trilead.ssh2.LocalPortForwarder;
import com.trilead.ssh2.Session;
import com.trilead.ssh2.crypto.PEMDecoder;
import com.trilead.ssh2.signature.DSASHA1Verify;
+import com.trilead.ssh2.signature.ECDSASHA2Verify;
import com.trilead.ssh2.signature.RSASHA1Verify;
/**
@@ -897,6 +900,9 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
} else if (privKey instanceof DSAPrivateKey) {
DSAPublicKey pubkey = (DSAPublicKey) pair.getPublic();
pubKeys.put(entry.getKey(), DSASHA1Verify.encodeSSHDSAPublicKey(pubkey));
+ } else if (privKey instanceof ECPrivateKey) {
+ ECPublicKey pubkey = (ECPublicKey) pair.getPublic();
+ pubKeys.put(entry.getKey(), ECDSASHA2Verify.encodeSSHECDSAPublicKey(pubkey));
} else
continue;
} catch (IOException e) {