diff options
-rw-r--r-- | lib/src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java b/lib/src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java index 894a31f..99d62ca 100644 --- a/lib/src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java +++ b/lib/src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java @@ -161,6 +161,14 @@ public class AuthenticationManager implements MessageHandler public boolean authenticatePublicKey(String user, char[] PEMPrivateKey, String password, SecureRandom rnd)
throws IOException
{
+ Object key = PEMDecoder.decode(PEMPrivateKey, password);
+
+ return authenticatePublicKey(user, key, rnd);
+ }
+
+ public boolean authenticatePublicKey(String user, Object key, SecureRandom rnd)
+ throws IOException
+ {
try
{
initialize(user);
@@ -168,8 +176,6 @@ public class AuthenticationManager implements MessageHandler if (methodPossible("publickey") == false)
throw new IOException("Authentication method publickey not supported by the server at this stage.");
- Object key = PEMDecoder.decode(PEMPrivateKey, password);
-
if (key instanceof DSAPrivateKey)
{
DSAPrivateKey pk = (DSAPrivateKey) key;
|