|
| 1 | +# This file is part of ssh-python. |
| 2 | +# Copyright (C) 2018 Panos Kittenis |
| 3 | +# |
| 4 | +# This library is free software; you can redistribute it and/or |
| 5 | +# modify it under the terms of the GNU Lesser General Public |
| 6 | +# License as published by the Free Software Foundation, version 2.1. |
| 7 | +# |
| 8 | +# This library is distributed in the hope that it will be useful, |
| 9 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | +# Lesser General Public License for more details. |
| 12 | +# |
| 13 | +# You should have received a copy of the GNU Lesser General Public |
| 14 | +# License along with this library; if not, write to the Free Software |
| 15 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 |
| 16 | + |
| 17 | +from c_ssh cimport uint8_t, ssh_keytypes_e, ssh_string, ssh_auth_callback, \ |
| 18 | + ssh_buffer, ssh_keycmp_e, ssh_session |
| 19 | +from c_pki cimport ssh_key_struct, ssh_signature |
| 20 | + |
| 21 | +cdef extern from "libssh/include/pki_priv.h" nogil: |
| 22 | + ctypedef ssh_key_struct *ssh_key |
| 23 | + int bcrypt_pbkdf(const char *, |
| 24 | + size_t passlen, |
| 25 | + const uint8_t *salt, |
| 26 | + size_t saltlen, |
| 27 | + uint8_t *key, |
| 28 | + size_t keylen, |
| 29 | + unsigned int rounds) |
| 30 | + |
| 31 | + int pki_key_ecdsa_nid_from_name(const char *name) |
| 32 | + const char *pki_key_ecdsa_nid_to_name(int nid) |
| 33 | + ssh_key pki_key_dup(const ssh_key key, int demote); |
| 34 | + int pki_key_generate_rsa(ssh_key key, int parameter); |
| 35 | + int pki_key_generate_dss(ssh_key key, int parameter); |
| 36 | + int pki_key_generate_ecdsa(ssh_key key, int parameter); |
| 37 | + int pki_key_generate_ed25519(ssh_key key); |
| 38 | + |
| 39 | + int pki_key_compare(const ssh_key k1, |
| 40 | + const ssh_key k2, |
| 41 | + ssh_keycmp_e what) |
| 42 | + |
| 43 | + ssh_keytypes_e pki_privatekey_type_from_string(const char *privkey); |
| 44 | + ssh_key pki_private_key_from_base64(const char *b64_key, |
| 45 | + const char *passphrase, |
| 46 | + ssh_auth_callback auth_fn, |
| 47 | + void *auth_data) |
| 48 | + ssh_string pki_private_key_to_pem(const ssh_key key, |
| 49 | + const char *passphrase, |
| 50 | + ssh_auth_callback auth_fn, |
| 51 | + void *auth_data) |
| 52 | + |
| 53 | + int pki_pubkey_build_dss(ssh_key key, |
| 54 | + ssh_string p, |
| 55 | + ssh_string q, |
| 56 | + ssh_string g, |
| 57 | + ssh_string pubkey) |
| 58 | + int pki_pubkey_build_rsa(ssh_key key, |
| 59 | + ssh_string e, |
| 60 | + ssh_string n) |
| 61 | + int pki_pubkey_build_ecdsa(ssh_key key, int nid, ssh_string e) |
| 62 | + ssh_string pki_publickey_to_blob(const ssh_key key) |
| 63 | + int pki_export_pubkey_rsa1(const ssh_key key, |
| 64 | + const char *host, |
| 65 | + char *rsa1, |
| 66 | + size_t rsa1_len) |
| 67 | + |
| 68 | + ssh_string pki_signature_to_blob(const ssh_signature sign); |
| 69 | + ssh_signature pki_signature_from_blob(const ssh_key pubkey, |
| 70 | + const ssh_string sig_blob, |
| 71 | + ssh_keytypes_e); |
| 72 | + int pki_signature_verify(ssh_session session, |
| 73 | + const ssh_signature sig, |
| 74 | + const ssh_key key, |
| 75 | + const unsigned char *hash, |
| 76 | + size_t hlen) |
| 77 | + |
| 78 | + ssh_signature pki_do_sign(const ssh_key privkey, |
| 79 | + const unsigned char *hash, |
| 80 | + size_t hlen) |
| 81 | + ssh_signature pki_do_sign_sessionid(const ssh_key key, |
| 82 | + const unsigned char *hash, |
| 83 | + size_t hlen) |
| 84 | + int pki_ed25519_sign(const ssh_key privkey, ssh_signature sig, |
| 85 | + const unsigned char *hash, size_t hlen) |
| 86 | + int pki_ed25519_verify(const ssh_key pubkey, ssh_signature sig, |
| 87 | + const unsigned char *hash, size_t hlen) |
| 88 | + int pki_ed25519_key_cmp(const ssh_key k1, |
| 89 | + const ssh_key k2, |
| 90 | + ssh_keycmp_e what) |
| 91 | + int pki_ed25519_key_dup(ssh_key, const ssh_key key) |
| 92 | + int pki_ed25519_public_key_to_blob(ssh_buffer buffer, ssh_key key) |
| 93 | + ssh_string pki_ed25519_sig_to_blob(ssh_signature sig) |
| 94 | + int pki_ed25519_sig_from_blob(ssh_signature sig, ssh_string sig_blob) |
| 95 | + ssh_key ssh_pki_openssh_privkey_import( |
| 96 | + const char *text_key, |
| 97 | + const char *passphrase, ssh_auth_callback auth_fn, void *auth_data) |
| 98 | + ssh_string ssh_pki_openssh_privkey_export( |
| 99 | + const ssh_key privkey, |
| 100 | + const char *passphrase, ssh_auth_callback auth_fn, void *auth_data) |
0 commit comments