aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-13 12:21:23 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-13 12:21:23 +0200
commit481522cf630833733d96fe19ef2876a467c113a6 (patch)
treea40d0718a7279afa32a3af7bb0d0323b637145ef
parent0523adf95cdc89c18b28cef3815b0e9f32a759f2 (diff)
downloadlibssh-481522cf630833733d96fe19ef2876a467c113a6.tar.gz
libssh-481522cf630833733d96fe19ef2876a467c113a6.tar.xz
libssh-481522cf630833733d96fe19ef2876a467c113a6.zip
agent: Use new pki functions.
-rw-r--r--src/agent.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/agent.c b/src/agent.c
index a457d5e3..38ceee9a 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -54,6 +54,7 @@
#include "libssh/session.h"
#include "libssh/keys.h"
#include "libssh/poll.h"
+#include "libssh/pki.h"
/* macro to check for "agent failure" message */
#define agent_failed(x) \
@@ -348,9 +349,10 @@ struct ssh_public_key_struct *agent_get_first_ident(struct ssh_session_struct *s
/* caller has to free commment */
struct ssh_public_key_struct *agent_get_next_ident(struct ssh_session_struct *session,
char **comment) {
- struct ssh_public_key_struct *pubkey = NULL;
+ struct ssh_key_struct *key;
struct ssh_string_struct *blob = NULL;
struct ssh_string_struct *tmp = NULL;
+ int rc;
if (session->agent->count == 0) {
return NULL;
@@ -385,14 +387,17 @@ struct ssh_public_key_struct *agent_get_next_ident(struct ssh_session_struct *se
ssh_string_free(tmp);
/* get key from blob */
- pubkey = publickey_from_string(session, blob);
+ rc = ssh_pki_import_pubkey_string(session, blob, &key);
ssh_string_free(blob);
+ if (rc == SSH_ERROR) {
+ return NULL;
+ }
break;
default:
return NULL;
}
- return pubkey;
+ return ssh_pki_convert_key_to_publickey(key);
}
ssh_string agent_sign_data(struct ssh_session_struct *session,