| 1 |
maya |
4304 |
/* |
| 2 |
doda |
6841 |
* (C) 2011-2017 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 |
maya |
4304 |
|
| 29 |
yutakapon |
5545 |
#ifndef __KEY_H_ |
| 30 |
|
|
#define __KEY_H_ |
| 31 |
|
|
|
| 32 |
maya |
4304 |
#include "ttxssh.h" |
| 33 |
yutakapon |
5545 |
#include "ed25519_crypto_api.h" |
| 34 |
maya |
4304 |
|
| 35 |
yutakapon |
5545 |
#define ED25519_SK_SZ crypto_sign_ed25519_SECRETKEYBYTES |
| 36 |
|
|
#define ED25519_PK_SZ crypto_sign_ed25519_PUBLICKEYBYTES |
| 37 |
|
|
|
| 38 |
maya |
4307 |
int key_verify(Key *key, |
| 39 |
maya |
4304 |
unsigned char *signature, unsigned int signaturelen, |
| 40 |
|
|
unsigned char *data, unsigned int datalen); |
| 41 |
|
|
RSA *duplicate_RSA(RSA *src); |
| 42 |
|
|
DSA *duplicate_DSA(DSA *src); |
| 43 |
yutakapon |
5545 |
unsigned char *duplicate_ED25519_PK(unsigned char *src); |
| 44 |
maya |
6145 |
BOOL key_copy(Key *dest, Key *src); |
| 45 |
maya |
4307 |
|
| 46 |
zmatsuo |
7536 |
char *key_fingerprint_raw(Key *k, digest_algorithm dgst_alg, int *dgst_raw_length); |
| 47 |
|
|
char *key_fingerprint(Key *key, enum fp_rep dgst_rep, digest_algorithm dgst_alg); |
| 48 |
maya |
4304 |
|
| 49 |
maya |
5550 |
const char *ssh_key_type(ssh_keytype type); |
| 50 |
maya |
4304 |
char *get_sshname_from_key(Key *key); |
| 51 |
zmatsuo |
7536 |
ssh_keytype get_keytype_from_name(char *name); |
| 52 |
maya |
4378 |
char *curve_keytype_to_name(ssh_keytype type); |
| 53 |
maya |
6817 |
ssh_keytype key_curve_name_to_keytype(char *name); |
| 54 |
maya |
4307 |
|
| 55 |
yutakapon |
5545 |
Key *key_new_private(int type); |
| 56 |
|
|
Key *key_new(int type); |
| 57 |
maya |
4307 |
void key_free(Key *key); |
| 58 |
maya |
6147 |
void key_init(Key *key); |
| 59 |
maya |
4304 |
int key_to_blob(Key *key, char **blobp, int *lenp); |
| 60 |
|
|
Key *key_from_blob(char *data, int blen); |
| 61 |
|
|
BOOL get_SSH2_publickey_blob(PTInstVar pvar, buffer_t **blobptr, int *bloblen); |
| 62 |
maya |
4307 |
BOOL generate_SSH2_keysign(Key *keypair, char **sigptr, int *siglen, char *data, int datalen); |
| 63 |
maya |
4327 |
|
| 64 |
maya |
4378 |
int kextype_to_cipher_nid(kex_algorithm type); |
| 65 |
|
|
int keytype_to_hash_nid(ssh_keytype type); |
| 66 |
|
|
int keytype_to_cipher_nid(ssh_keytype type); |
| 67 |
|
|
ssh_keytype nid_to_keytype(int nid); |
| 68 |
yutakapon |
5545 |
|
| 69 |
|
|
void key_private_serialize(Key *key, buffer_t *b); |
| 70 |
|
|
Key *key_private_deserialize(buffer_t *blob); |
| 71 |
|
|
|
| 72 |
maya |
6817 |
int key_ec_validate_private(EC_KEY *key); |
| 73 |
|
|
int key_ec_validate_public(const EC_GROUP *group, const EC_POINT *public); |
| 74 |
|
|
|
| 75 |
yutakapon |
5838 |
int update_client_input_hostkeys(PTInstVar pvar, char *dataptr, int datalen); |
| 76 |
|
|
|
| 77 |
yutakapon |
5545 |
#endif |