Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/ttssh2/ttxssh/hostkey.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10509 - (show annotations) (download) (as text)
Tue Jan 17 23:13:14 2023 UTC (14 months, 3 weeks ago) by nmaya
File MIME type: text/x-chdr
File size: 3695 byte(s)
rsa-sha2-256/512 対応

ticket: #36109
merge from 4-stable:
  RSA 鍵を用いた公開鍵認証の署名アルゴリズムの優先度の設定: r10384, r10386, r10416, r10465
  About ダイアログ: r10387
1 /*
2 * (C) 2021- TeraTerm Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef HOSTKEY_H
30 #define HOSTKEY_H
31
32 typedef struct Key Key;
33
34 typedef enum {
35 KEY_NONE,
36 KEY_RSA1,
37 KEY_RSA,
38 KEY_DSA,
39 KEY_ECDSA256,
40 KEY_ECDSA384,
41 KEY_ECDSA521,
42 KEY_ED25519,
43 KEY_UNSPEC,
44 KEY_MAX = KEY_UNSPEC,
45 } ssh_keytype;
46
47 typedef enum {
48 KEY_ALGO_NONE,
49 KEY_ALGO_RSA1,
50 KEY_ALGO_RSA,
51 KEY_ALGO_DSA,
52 KEY_ALGO_ECDSA256,
53 KEY_ALGO_ECDSA384,
54 KEY_ALGO_ECDSA521,
55 KEY_ALGO_ED25519,
56 KEY_ALGO_RSASHA256,
57 KEY_ALGO_RSASHA512,
58 KEY_ALGO_UNSPEC,
59 KEY_ALGO_MAX = KEY_ALGO_UNSPEC,
60 } ssh_keyalgo;
61
62 typedef enum {
63 SSH_AGENT_SIGN_DEFAULT = 0,
64 SSH_AGENT_RSA_SHA2_256 = 2,
65 SSH_AGENT_RSA_SHA2_512 = 4,
66 } ssh_agentflag;
67 #define isFixedLengthKey(type) ((type) >= KEY_DSA && (type) <= KEY_ED25519)
68
69 // fingerprint������
70 typedef enum {
71 SSH_FP_DEFAULT = 0,
72 SSH_FP_HEX,
73 SSH_FP_BASE64,
74 SSH_FP_BUBBLEBABBLE,
75 SSH_FP_RANDOMART
76 } fp_rep;
77
78 /*
79 enum fp_type {
80 SSH_FP_MD5,
81 SSH_FP_SHA1,
82 SSH_FP_SHA256
83 };
84 */
85
86 typedef enum {
87 SSH_DIGEST_MD5,
88 SSH_DIGEST_RIPEMD160,
89 SSH_DIGEST_SHA1,
90 SSH_DIGEST_SHA256,
91 SSH_DIGEST_SHA384,
92 SSH_DIGEST_SHA512,
93 SSH_DIGEST_MAX,
94 } digest_algorithm;
95
96 typedef enum {
97 RSA_PUBKEY_SIGN_ALGO_NONE,
98 RSA_PUBKEY_SIGN_ALGO_RSA,
99 RSA_PUBKEY_SIGN_ALGO_RSASHA256,
100 RSA_PUBKEY_SIGN_ALGO_RSASHA512,
101 RSA_PUBKEY_SIGN_ALGO_MAX,
102 } ssh_rsapubkeysignalgo;
103
104
105 ssh_keytype get_hostkey_type_from_name(char *name);
106 char* get_ssh2_hostkey_type_name(ssh_keytype type);
107 char *get_ssh2_hostkey_type_name_from_key(Key *key);
108 ssh_keyalgo get_ssh2_hostkey_algorithm_from_name(const char *name);
109 char* get_ssh2_hostkey_algorithm_name(ssh_keyalgo algo);
110 int get_ssh2_key_hashtype(ssh_keyalgo algo);
111 int get_ssh2_agent_flag(ssh_keyalgo algo);
112 ssh_keytype get_ssh2_hostkey_type_from_algorithm(ssh_keyalgo algo);
113 const char* get_ssh2_hostkey_type_name_from_algorithm(ssh_keyalgo algo);
114 char* get_digest_algorithm_name(digest_algorithm id);
115
116 void normalize_host_key_order(char *buf);
117 void normalize_rsa_pubkey_sign_algo_order(char *buf);
118 ssh_keyalgo choose_SSH2_host_key_algorithm(char *server_proposal, char *my_proposal);
119 ssh_keyalgo choose_SSH2_keysign_algorithm(PTInstVar pvar, ssh_keytype keytype);
120 void SSH2_update_host_key_myproposal(PTInstVar pvar);
121 char* get_ssh2_hostkey_algorithm_digest_name(ssh_keyalgo algo);
122
123 #endif /* SSHCMAC_H */

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26