mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-16 02:27:32 -05:00
New key component type KCT_BINARY.
This stores its data in the same format as the existing KCT_TEXT, but it displays differently in puttygen --dump, expecting that the data will be full of horrible control characters, invalid UTF-8, etc. The displayed data is of the form b64("..."), so you get a hint about what the encoding is, and can still paste into Python by defining the identifier 'b64' to be base64.b64decode or equivalent.
This commit is contained in:
@ -10,14 +10,26 @@ key_components *key_components_new(void)
|
||||
return kc;
|
||||
}
|
||||
|
||||
void key_components_add_text(key_components *kc,
|
||||
const char *name, const char *value)
|
||||
static void key_components_add_str(key_components *kc, const char *name,
|
||||
KeyComponentType type, ptrlen data)
|
||||
{
|
||||
sgrowarray(kc->components, kc->componentsize, kc->ncomponents);
|
||||
size_t n = kc->ncomponents++;
|
||||
kc->components[n].name = dupstr(name);
|
||||
kc->components[n].type = KCT_TEXT;
|
||||
kc->components[n].str = strbuf_dup_nm(ptrlen_from_asciz(value));
|
||||
kc->components[n].type = type;
|
||||
kc->components[n].str = strbuf_dup_nm(data);
|
||||
}
|
||||
|
||||
void key_components_add_text(key_components *kc,
|
||||
const char *name, const char *value)
|
||||
{
|
||||
key_components_add_str(kc, name, KCT_TEXT, ptrlen_from_asciz(value));
|
||||
}
|
||||
|
||||
void key_components_add_binary(key_components *kc,
|
||||
const char *name, ptrlen value)
|
||||
{
|
||||
key_components_add_str(kc, name, KCT_BINARY, value);
|
||||
}
|
||||
|
||||
void key_components_add_mp(key_components *kc,
|
||||
@ -40,6 +52,7 @@ void key_components_free(key_components *kc)
|
||||
mp_free(comp->mp);
|
||||
break;
|
||||
case KCT_TEXT:
|
||||
case KCT_BINARY:
|
||||
strbuf_free(comp->str);
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user