mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32:48 -05:00
Add API for getting all of a key's fingerprints.
ssh2_all_fingerprints() and friends will return a small 'char **' array, containing all the fingerprints of a key that we know how to generate, indexed by the FingerprintType enum. The result requires complex freeing, so there's an ssh2_free_all_fingerprints as well. For SSH-1 RSA keys, we refuse to generate any fingerprint except the old SSH-1 MD5 version, because there's no other fingerprint type I know of that anyone else uses. So I've got a function that returns the same 'char **' for an SSH-1 key, but it only fills in the MD5 slot, and leaves the rest NULL. As a result, I also need a dynamic function that takes a fingerprint list and returns the id of the most preferred fingerprint type in it _that actually exists_. NFC: this API is introduced, but not yet used.
This commit is contained in:
8
ssh.h
8
ssh.h
@ -567,6 +567,7 @@ mp_int *rsa_ssh1_decrypt(mp_int *input, RSAKey *key);
|
||||
bool rsa_ssh1_decrypt_pkcs1(mp_int *input, RSAKey *key, strbuf *outbuf);
|
||||
char *rsastr_fmt(RSAKey *key);
|
||||
char *rsa_ssh1_fingerprint(RSAKey *key);
|
||||
char **rsa_ssh1_fake_all_fingerprints(RSAKey *key);
|
||||
bool rsa_verify(RSAKey *key);
|
||||
void rsa_ssh1_public_blob(BinarySink *bs, RSAKey *key, RsaSsh1Order order);
|
||||
int rsa_ssh1_public_blob_len(ptrlen data);
|
||||
@ -1337,6 +1338,10 @@ typedef enum {
|
||||
#define SSH_FPTYPE_DEFAULT SSH_FPTYPE_MD5
|
||||
#define SSH_N_FPTYPES (SSH_FPTYPE_SHA256 + 1)
|
||||
|
||||
FingerprintType ssh2_pick_fingerprint(char **fingerprints,
|
||||
FingerprintType preferred_type);
|
||||
FingerprintType ssh2_pick_default_fingerprint(char **fingerprints);
|
||||
|
||||
char *ssh1_pubkey_str(RSAKey *ssh1key);
|
||||
void ssh1_write_pubkey(FILE *fp, RSAKey *ssh1key);
|
||||
char *ssh2_pubkey_openssh_str(ssh2_userkey *key);
|
||||
@ -1345,6 +1350,9 @@ void ssh2_write_pubkey(FILE *fp, const char *comment,
|
||||
int keytype);
|
||||
char *ssh2_fingerprint_blob(ptrlen, FingerprintType);
|
||||
char *ssh2_fingerprint(ssh_key *key, FingerprintType);
|
||||
char **ssh2_all_fingerprints_for_blob(ptrlen);
|
||||
char **ssh2_all_fingerprints(ssh_key *key);
|
||||
void ssh2_free_all_fingerprints(char **);
|
||||
int key_type(const Filename *filename);
|
||||
int key_type_s(BinarySource *src);
|
||||
const char *key_type_to_str(int type);
|
||||
|
Reference in New Issue
Block a user