Skip to content

Commit 03575a1

Browse files
author
Pan
committed
Added kex, keys, knownhosts and legacy definition files.
1 parent 3a700eb commit 03575a1

File tree

5 files changed

+136
-0
lines changed

5 files changed

+136
-0
lines changed

ssh/c_kex.pxd

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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 ssh_session, ssh_kex_types_e, uint32_t
18+
19+
cdef extern from "libssh/include/kex.h" nogil:
20+
enum:
21+
SSH_KEX_METHODS
22+
struct ssh_kex_struct:
23+
unsigned char cookie[16]
24+
char *methods[SSH_KEX_METHODS]
25+
int ssh_send_kex(ssh_session session, int server_kex)
26+
void ssh_list_kex(ssh_kex_struct *kex)
27+
int ssh_set_client_kex(ssh_session session)
28+
int ssh_kex_select_methods(ssh_session session)
29+
int ssh_verify_existing_algo(ssh_kex_types_e algo, const char *name)
30+
char *ssh_keep_known_algos(ssh_kex_types_e algo, const char *list)
31+
char **ssh_space_tokenize(const char *chain)
32+
int ssh_get_kex1(ssh_session session)
33+
char *ssh_find_matching(const char *in_d, const char *what_d)
34+
const char *ssh_kex_get_supported_method(uint32_t algo)
35+
const char *ssh_kex_get_description(uint32_t algo)

ssh/c_keys.pxd

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 ssh_session, ssh_string
18+
19+
cdef extern from "libssh/include/keys.h" nogil:
20+
struct ssh_public_key_struct:
21+
int type
22+
const char *type_c
23+
struct ssh_private_key_struct:
24+
int type
25+
ctypedef ssh_public_key_struct* ssh_public_key
26+
const char *ssh_type_to_char(int type)
27+
int ssh_type_from_name(const char *name)
28+
ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s)

ssh/c_knownhosts.pxd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 ssh_session
18+
19+
cdef extern from "libssh/include/knownhosts.h" nogil:
20+
char **ssh_knownhosts_algorithms(ssh_session session)

ssh/c_legacy.pxd

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 ssh_session, ssh_string, ssh_message, uint32_t, ssh_keytypes_e
18+
from c_keys cimport ssh_private_key_struct, ssh_public_key_struct
19+
20+
cdef extern from "libssh/include/legacy.h" nogil:
21+
ctypedef ssh_private_key_struct* ssh_private_key
22+
ctypedef ssh_public_key_struct* ssh_public_key
23+
int ssh_auth_list(ssh_session session)
24+
int ssh_userauth_offer_pubkey(ssh_session session, const char *username,
25+
int type, ssh_string publickey)
26+
int ssh_userauth_pubkey(ssh_session session, const char *username,
27+
ssh_string publickey, ssh_private_key privatekey)
28+
# IF not _WIN32:
29+
int ssh_userauth_agent_pubkey(ssh_session session, const char *username,
30+
ssh_public_key publickey)
31+
int ssh_userauth_autopubkey(ssh_session session, const char *passphrase)
32+
int ssh_userauth_privatekey_file(ssh_session session, const char *username,
33+
const char *filename, const char *passphrase)
34+
void privatekey_free(ssh_private_key prv)
35+
ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
36+
int type, const char *passphrase)
37+
void publickey_free(ssh_public_key key)
38+
int ssh_publickey_to_file(ssh_session session, const char *file,
39+
ssh_string pubkey, int type)
40+
ssh_string publickey_from_file(ssh_session session, const char *filename,
41+
int *type)
42+
ssh_public_key publickey_from_privatekey(ssh_private_key prv)
43+
ssh_string publickey_to_string(ssh_public_key key)
44+
int ssh_try_publickey_from_file(ssh_session session, const char *keyfile,
45+
ssh_string *publickey, int *type)
46+
ssh_keytypes_e ssh_privatekey_type(ssh_private_key privatekey)
47+
ssh_string ssh_get_pubkey(ssh_session session)
48+
ssh_message ssh_message_retrieve(ssh_session session, uint32_t packettype)
49+
ssh_public_key ssh_message_auth_publickey(ssh_message msg)

ssh/ssh.pyx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ cimport c_channels
2222
cimport c_misc
2323
cimport c_crypto
2424
cimport c_wrapper
25+
cimport c_kex
26+
cimport c_keys
27+
cimport c_knownhosts
28+
cimport c_legacy

0 commit comments

Comments
 (0)