Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ssh.h
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2021-03-13 13:15:29 +0300
committerSimon Tatham <anakin@pobox.com>2021-03-13 14:01:35 +0300
commit995e2f7164733ef7b7d677ed59bad562de638a99 (patch)
tree1cbbd2d3713cd006adb7ef2da073e2761b50fcb3 /ssh.h
parent911ead25e72bc99afb855b698d7b03e41f2b9c39 (diff)
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.
Diffstat (limited to 'ssh.h')
-rw-r--r--ssh.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/ssh.h b/ssh.h
index 378dcb90..acffbe32 100644
--- a/ssh.h
+++ b/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);