aboutsummaryrefslogtreecommitdiff
path: root/src/pki_gcrypt.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-28 14:21:56 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-28 14:21:56 +0200
commitbce2c22e454504aa5586e815f01c5989b84ea9f8 (patch)
treeba1505a1218f4d0ac67e77e03c3efe1fbf976e4a /src/pki_gcrypt.c
parent29ecccb96d495c5a99481fea19a4906d596ed925 (diff)
downloadlibssh-bce2c22e454504aa5586e815f01c5989b84ea9f8.tar.gz
libssh-bce2c22e454504aa5586e815f01c5989b84ea9f8.tar.xz
libssh-bce2c22e454504aa5586e815f01c5989b84ea9f8.zip
keyfiles: Make ssh_try_publickey_from_file() legacy.
Diffstat (limited to 'src/pki_gcrypt.c')
-rw-r--r--src/pki_gcrypt.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/src/pki_gcrypt.c b/src/pki_gcrypt.c
index 9e2bd44e..4935deeb 100644
--- a/src/pki_gcrypt.c
+++ b/src/pki_gcrypt.c
@@ -1544,69 +1544,6 @@ ssh_signature pki_do_sign_sessionid(const ssh_key key,
* @return 0 on success, -1 on error or the private key doesn't
* exist, 1 if the public key doesn't exist.
*/
-int ssh_try_publickey_from_file(ssh_session session, const char *keyfile,
- ssh_string *publickey, int *type) {
- char *pubkey_file;
- size_t len;
- ssh_string pubkey_string;
- int pubkey_type;
-
- if (session == NULL || keyfile == NULL || publickey == NULL || type == NULL) {
- return -1;
- }
-
- if (session->sshdir == NULL) {
- if (ssh_options_apply(session) < 0) {
- return -1;
- }
- }
-
- ssh_log(session, SSH_LOG_PACKET, "Trying to open privatekey %s", keyfile);
- if (!ssh_file_readaccess_ok(keyfile)) {
- ssh_log(session, SSH_LOG_PACKET, "Failed to open privatekey %s", keyfile);
- return -1;
- }
-
- len = strlen(keyfile) + 5;
- pubkey_file = malloc(len);
- if (pubkey_file == NULL) {
- return -1;
- }
- snprintf(pubkey_file, len, "%s.pub", keyfile);
-
- ssh_log(session, SSH_LOG_PACKET, "Trying to open publickey %s",
- pubkey_file);
- if (!ssh_file_readaccess_ok(pubkey_file)) {
- ssh_log(session, SSH_LOG_PACKET, "Failed to open publickey %s",
- pubkey_file);
- SAFE_FREE(pubkey_file);
- return 1;
- }
-
- ssh_log(session, SSH_LOG_PACKET, "Success opening public and private key");
-
- /*
- * We are sure both the private and public key file is readable. We return
- * the public as a string, and the private filename as an argument
- */
- pubkey_string = publickey_from_file(session, pubkey_file, &pubkey_type);
- if (pubkey_string == NULL) {
- ssh_log(session, SSH_LOG_PACKET,
- "Wasn't able to open public key file %s: %s",
- pubkey_file,
- ssh_get_error(session));
- SAFE_FREE(pubkey_file);
- return -1;
- }
-
- SAFE_FREE(pubkey_file);
-
- *publickey = pubkey_string;
- *type = pubkey_type;
-
- return 0;
-}
-
ssh_string try_publickey_from_file(ssh_session session, struct ssh_keys_struct keytab,
char **privkeyfile, int *type) {
const char *priv;