mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
Utility functions to get the algorithm from a public key.
Every time I've had to do this before, I've always done the three-line dance of initialising a BinarySource and calling get_string on it. It's long past time I wrapped that up into a convenient subroutine.
This commit is contained in:
12
sshpubk.c
12
sshpubk.c
@ -585,6 +585,18 @@ const ssh_keyalg *find_pubkey_alg(const char *name)
|
||||
return find_pubkey_alg_len(ptrlen_from_asciz(name));
|
||||
}
|
||||
|
||||
ptrlen pubkey_blob_to_alg_name(ptrlen blob)
|
||||
{
|
||||
BinarySource src[1];
|
||||
BinarySource_BARE_INIT_PL(src, blob);
|
||||
return get_string(src);
|
||||
}
|
||||
|
||||
const ssh_keyalg *pubkey_blob_to_alg(ptrlen blob)
|
||||
{
|
||||
return find_pubkey_alg_len(pubkey_blob_to_alg_name(blob));
|
||||
}
|
||||
|
||||
struct ppk_cipher {
|
||||
const char *name;
|
||||
size_t blocklen, keylen, ivlen;
|
||||
|
Reference in New Issue
Block a user