24#include "libssh/pki.h"
31int bcrypt_pbkdf(
const char *pass,
39#define RSA_HEADER_BEGIN "-----BEGIN RSA PRIVATE KEY-----"
40#define RSA_HEADER_END "-----END RSA PRIVATE KEY-----"
41#define ECDSA_HEADER_BEGIN "-----BEGIN EC PRIVATE KEY-----"
42#define ECDSA_HEADER_END "-----END EC PRIVATE KEY-----"
43#define OPENSSH_HEADER_BEGIN "-----BEGIN OPENSSH PRIVATE KEY-----"
44#define OPENSSH_HEADER_END "-----END OPENSSH PRIVATE KEY-----"
46#define OPENSSH_AUTH_MAGIC "openssh-key-v1"
54void pki_key_clean(ssh_key key);
56int pki_key_ecdsa_nid_from_name(
const char *name);
57const char *pki_key_ecdsa_nid_to_name(
int nid);
59 enum ssh_digest_e hash_type);
61 enum ssh_keytypes_e type);
64ssh_key pki_key_dup(
const ssh_key key,
int demote);
65int pki_key_generate_rsa(ssh_key key,
int parameter);
66int pki_key_generate_ecdsa(ssh_key key,
int parameter);
67int pki_key_generate_ed25519(ssh_key key);
69int pki_key_compare(
const ssh_key k1,
71 enum ssh_keycmp_e what);
73int pki_key_check_hash_compatible(ssh_key key,
74 enum ssh_digest_e hash_type);
76enum ssh_keytypes_e pki_privatekey_type_from_string(
const char *privkey);
77ssh_key pki_private_key_from_base64(
const char *b64_key,
78 const char *passphrase,
82ssh_string pki_private_key_to_pem(
const ssh_key key,
83 const char *passphrase,
86int pki_import_privkey_buffer(
enum ssh_keytypes_e type,
91int pki_pubkey_build_rsa(ssh_key key,
94int pki_pubkey_build_ecdsa(ssh_key key,
int nid, ssh_string e);
95ssh_string pki_key_to_blob(
const ssh_key key,
enum ssh_key_e type);
98int pki_privkey_build_rsa(ssh_key key,
105int pki_privkey_build_ecdsa(ssh_key key,
111ssh_signature pki_sign_data(
const ssh_key privkey,
112 enum ssh_digest_e hash_type,
113 const unsigned char *input,
115int pki_verify_data_signature(ssh_signature signature,
116 const ssh_key pubkey,
117 const unsigned char *input,
119ssh_string pki_signature_to_blob(
const ssh_signature sign);
120ssh_signature pki_signature_from_blob(
const ssh_key pubkey,
121 const ssh_string sig_blob,
122 enum ssh_keytypes_e type,
123 enum ssh_digest_e hash_type);
126ssh_signature pki_do_sign(
const ssh_key privkey,
127 const unsigned char *input,
129 enum ssh_digest_e hash_type);
130ssh_signature pki_do_sign_hash(
const ssh_key privkey,
131 const unsigned char *hash,
133 enum ssh_digest_e hash_type);
134#ifndef HAVE_LIBCRYPTO
135int pki_ed25519_sign(
const ssh_key privkey, ssh_signature sig,
136 const unsigned char *hash,
size_t hlen);
137int pki_ed25519_verify(
const ssh_key pubkey, ssh_signature sig,
138 const unsigned char *hash,
size_t hlen);
140int pki_ed25519_key_cmp(
const ssh_key k1,
142 enum ssh_keycmp_e what);
143int pki_ed25519_key_dup(ssh_key new_key,
const ssh_key key);
144int pki_ed25519_public_key_to_blob(ssh_buffer buffer, ssh_key key);
145int pki_ed25519_private_key_to_blob(ssh_buffer buffer,
const ssh_key privkey);
146ssh_string pki_ed25519_signature_to_blob(ssh_signature sig);
147int pki_signature_from_ed25519_blob(ssh_signature sig, ssh_string sig_blob);
148int pki_privkey_build_ed25519(ssh_key key,
153ssh_key ssh_pki_openssh_pubkey_import(
const char *text_key);
154ssh_key ssh_pki_openssh_privkey_import(
const char *text_key,
156ssh_string ssh_pki_openssh_privkey_export(
const ssh_key privkey,
159#ifdef WITH_PKCS11_URI
161int pki_uri_import(
const char *uri_name, ssh_key *key,
enum ssh_key_e key_type);
164bool ssh_key_size_allowed_rsa(
int min_size, ssh_key key);
int(* ssh_auth_callback)(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata)
SSH authentication callback for password and publickey auth.
Definition libssh.h:699
const char * ssh_key_signature_to_char(enum ssh_keytypes_e type, enum ssh_digest_e hash_type)
Convert a signature type to a string.
Definition pki.c:216
enum ssh_digest_e ssh_key_type_to_hash(ssh_session session, enum ssh_keytypes_e type)
Convert a key type to a hash type. This is usually unambiguous for all the key types,...
Definition pki.c:424