24 #include "libssh/pki.h" 27 int bcrypt_pbkdf(
const char *pass,
35 #define RSA_HEADER_BEGIN "-----BEGIN RSA PRIVATE KEY-----" 36 #define RSA_HEADER_END "-----END RSA PRIVATE KEY-----" 37 #define DSA_HEADER_BEGIN "-----BEGIN DSA PRIVATE KEY-----" 38 #define DSA_HEADER_END "-----END DSA PRIVATE KEY-----" 39 #define ECDSA_HEADER_BEGIN "-----BEGIN EC PRIVATE KEY-----" 40 #define ECDSA_HEADER_END "-----END EC PRIVATE KEY-----" 41 #define OPENSSH_HEADER_BEGIN "-----BEGIN OPENSSH PRIVATE KEY-----" 42 #define OPENSSH_HEADER_END "-----END OPENSSH PRIVATE KEY-----" 44 #define OPENSSH_AUTH_MAGIC "openssh-key-v1" 46 int pki_key_ecdsa_nid_from_name(
const char *name);
47 const char *pki_key_ecdsa_nid_to_name(
int nid);
50 ssh_key pki_key_dup(
const ssh_key key,
int demote);
51 int pki_key_generate_rsa(ssh_key key,
int parameter);
52 int pki_key_generate_dss(ssh_key key,
int parameter);
53 int pki_key_generate_ecdsa(ssh_key key,
int parameter);
54 int pki_key_generate_ed25519(ssh_key key);
56 int pki_key_compare(
const ssh_key k1,
58 enum ssh_keycmp_e what);
61 enum ssh_keytypes_e pki_privatekey_type_from_string(
const char *privkey);
62 ssh_key pki_private_key_from_base64(
const char *b64_key,
63 const char *passphrase,
64 ssh_auth_callback auth_fn,
67 ssh_string pki_private_key_to_pem(
const ssh_key key,
68 const char *passphrase,
69 ssh_auth_callback auth_fn,
73 int pki_pubkey_build_dss(ssh_key key,
78 int pki_pubkey_build_rsa(ssh_key key,
81 int pki_pubkey_build_ecdsa(ssh_key key,
int nid, ssh_string e);
82 ssh_string pki_publickey_to_blob(
const ssh_key key);
83 int pki_export_pubkey_rsa1(
const ssh_key key,
89 ssh_string pki_signature_to_blob(
const ssh_signature sign);
90 ssh_signature pki_signature_from_blob(
const ssh_key pubkey,
91 const ssh_string sig_blob,
92 enum ssh_keytypes_e type);
93 int pki_signature_verify(ssh_session session,
94 const ssh_signature sig,
96 const unsigned char *hash,
100 ssh_signature pki_do_sign(
const ssh_key privkey,
101 const unsigned char *hash,
103 ssh_signature pki_do_sign_sessionid(
const ssh_key key,
104 const unsigned char *hash,
106 int pki_ed25519_sign(
const ssh_key privkey, ssh_signature sig,
107 const unsigned char *hash,
size_t hlen);
108 int pki_ed25519_verify(
const ssh_key pubkey, ssh_signature sig,
109 const unsigned char *hash,
size_t hlen);
110 int pki_ed25519_key_cmp(
const ssh_key k1,
112 enum ssh_keycmp_e what);
113 int pki_ed25519_key_dup(ssh_key
new,
const ssh_key key);
114 int pki_ed25519_public_key_to_blob(ssh_buffer buffer, ssh_key key);
115 ssh_string pki_ed25519_sig_to_blob(ssh_signature sig);
116 int pki_ed25519_sig_from_blob(ssh_signature sig, ssh_string sig_blob);
119 ssh_key ssh_pki_openssh_privkey_import(
const char *text_key,
120 const char *passphrase, ssh_auth_callback auth_fn,
void *auth_data);
121 ssh_string ssh_pki_openssh_privkey_export(
const ssh_key privkey,
122 const char *passphrase, ssh_auth_callback auth_fn,
void *auth_data);