aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-09-18 22:04:03 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-10-29 19:58:28 +0200
commit2c04994443384224161d895d00255b5788e8376d (patch)
treed07f4eb26408d4e0f8b76d96212e11f23b20f699 /include
parente799c0ce7d046606d9391d826461c2782f072fa0 (diff)
downloadlibssh-2c04994443384224161d895d00255b5788e8376d.tar.gz
libssh-2c04994443384224161d895d00255b5788e8376d.tar.xz
libssh-2c04994443384224161d895d00255b5788e8376d.zip
pki: Add a ssh_key_cmp() function.
Diffstat (limited to 'include')
-rw-r--r--include/libssh/libssh.h8
-rw-r--r--include/libssh/pki_priv.h3
-rw-r--r--include/libssh/server.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index d09d9331..30e31de4 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -242,6 +242,11 @@ enum ssh_keytypes_e{
SSH_KEYTYPE_ECDSA
};
+enum ssh_keycmp_e {
+ SSH_KEY_CMP_PUBLIC = 0,
+ SSH_KEY_CMP_PRIVATE
+};
+
/* Error return codes */
#define SSH_OK 0 /* No error */
#define SSH_ERROR -1 /* Error of some kind */
@@ -458,6 +463,9 @@ LIBSSH_API const char *ssh_key_type_to_char(enum ssh_keytypes_e type);
LIBSSH_API enum ssh_keytypes_e ssh_key_type_from_name(const char *name);
LIBSSH_API int ssh_key_is_public(const ssh_key k);
LIBSSH_API int ssh_key_is_private(const ssh_key k);
+LIBSSH_API int ssh_key_cmp(const ssh_key k1,
+ const ssh_key k2,
+ enum ssh_keycmp_e what);
LIBSSH_API int ssh_pki_generate(enum ssh_keytypes_e type, int parameter,
ssh_key *pkey);
diff --git a/include/libssh/pki_priv.h b/include/libssh/pki_priv.h
index 6be297ed..7a664cf1 100644
--- a/include/libssh/pki_priv.h
+++ b/include/libssh/pki_priv.h
@@ -36,6 +36,9 @@ void _ssh_pki_log(const char *function,
ssh_key pki_key_dup(const ssh_key key, int demote);
int pki_key_generate_rsa(ssh_key key, int parameter);
int pki_key_generate_dss(ssh_key key, int parameter);
+int pki_key_compare(const ssh_key k1,
+ const ssh_key k2,
+ enum ssh_keycmp_e what);
/* SSH Private Key Functions */
enum ssh_keytypes_e pki_privatekey_type_from_string(const char *privkey);
diff --git a/include/libssh/server.h b/include/libssh/server.h
index 9ad53e42..f3e0bb53 100644
--- a/include/libssh/server.h
+++ b/include/libssh/server.h
@@ -307,6 +307,7 @@ LIBSSH_API const char *ssh_message_auth_password(ssh_message msg);
* @return The public key or NULL.
*
* @see ssh_key_dup()
+ * @see ssh_key_cmp()
* @see ssh_message_get()
* @see ssh_message_type()
*/