summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-16 22:15:05 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-16 23:04:25 +0200
commit1a0fbedc2e7bc688ce380bbb465a5e1710355666 (patch)
tree3b6782150c8824829a4cbfc6cf66adf19f04cafa /src
parent254c30be2e97812a892c96210491720d63538994 (diff)
downloadlibssh-1a0fbedc2e7bc688ce380bbb465a5e1710355666.tar.gz
libssh-1a0fbedc2e7bc688ce380bbb465a5e1710355666.tar.xz
libssh-1a0fbedc2e7bc688ce380bbb465a5e1710355666.zip
pki: Fix and rename ssh_pki_publickey_to_base64().
Rename it to ssh_pki_export_publickey_base64().
Diffstat (limited to 'src')
-rw-r--r--src/pki.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pki.c b/src/pki.c
index 0fc36d0..867d124 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -725,19 +725,17 @@ ssh_string ssh_pki_publickey_to_blob(const ssh_key key)
*
* @param[out] b64_key A pointer to store the base64 hased key.
*
- * @param[out] ptype The type of the key.
- *
* @return SSH_OK on success, SSH_ERROR on error.
*
* @see ssh_string_free_char()
*/
-int ssh_pki_publickey_to_base64(const ssh_key key, unsigned char **b64_key,
- enum ssh_keytypes_e *ptype)
+int ssh_pki_export_publickey_base64(const ssh_key key,
+ char **b64_key)
{
ssh_string key_str;
unsigned char *b64;
- if (key == NULL || b64_key == NULL || ptype == NULL) {
+ if (key == NULL || b64_key == NULL) {
return SSH_ERROR;
}
@@ -748,9 +746,11 @@ int ssh_pki_publickey_to_base64(const ssh_key key, unsigned char **b64_key,
b64 = bin_to_base64(ssh_string_data(key_str), ssh_string_len(key_str));
ssh_string_free(key_str);
+ if (b64 == NULL) {
+ return SSH_ERROR;
+ }
- *ptype = key->type;
- *b64_key = b64;
+ *b64_key = (char *)b64;
return SSH_OK;
}