24 #ifdef HAVE_OPENSSL_EC_H
25 #include <openssl/ec.h>
27 #ifdef HAVE_OPENSSL_ECDSA_H
28 #include <openssl/ecdsa.h>
31 #include "libssh/crypto.h"
33 #define MAX_PUBKEY_SIZE 0x100000
34 #define MAX_PRIVKEY_SIZE 0x400000
36 #define SSH_KEY_FLAG_EMPTY 0x0
37 #define SSH_KEY_FLAG_PUBLIC 0x0001
38 #define SSH_KEY_FLAG_PRIVATE 0x0002
40 struct ssh_key_struct {
41 enum ssh_keytypes_e type;
52 #ifdef HAVE_OPENSSL_ECC
61 struct ssh_signature_struct {
62 enum ssh_keytypes_e type;
68 #elif defined HAVE_LIBCRYPTO
71 # ifdef HAVE_OPENSSL_ECC
79 typedef struct ssh_signature_struct *ssh_signature;
82 ssh_key ssh_key_dup(
const ssh_key key);
86 ssh_signature ssh_signature_new(
void);
87 void ssh_signature_free(ssh_signature sign);
89 int ssh_pki_export_signature_blob(
const ssh_signature sign,
90 ssh_string *sign_blob);
91 int ssh_pki_import_signature_blob(
const ssh_string sig_blob,
94 int ssh_pki_signature_verify_blob(ssh_session session,
97 unsigned char *digest,
101 int ssh_pki_export_pubkey_blob(
const ssh_key key,
103 int ssh_pki_import_pubkey_blob(
const ssh_string key_blob,
105 int ssh_pki_export_pubkey_rsa1(
const ssh_key key,
111 ssh_string ssh_pki_do_sign(ssh_session session, ssh_buffer sigbuf,
112 const ssh_key privatekey);
113 ssh_string ssh_pki_do_sign_agent(ssh_session session,
114 struct ssh_buffer_struct *buf,
115 const ssh_key pubkey);
116 ssh_string ssh_srv_pki_do_sign_sessionid(ssh_session session,
117 const ssh_key privkey);
120 ssh_public_key ssh_pki_convert_key_to_publickey(
const ssh_key key);
121 ssh_private_key ssh_pki_convert_key_to_privatekey(
const ssh_key key);