@@ 82,21 82,18 @@ fn encode(key: *query::query) void = {
const pkey = base64::decodestr(&base64::std_encoding, pkey.value)!;
defer free(pkey);
- const key = switch (keytype.value) {
- case "ssh-ed25519" =>
- let key = ssh::ed25519key {
- comment = comment,
- ...
- };
- // XXX: We could validate the length here
- key.pubkey[..] = pkey[..];
- yield key;
+ const key = match (ssh::newkey(keytype.value)) {
+ case let k: *ssh::key =>
+ yield k;
case =>
fmt::errorfln("Skipping unsupported key type {}", keytype)!;
return;
};
- ssh::encode_pubkeystr(os::stdout, &key)!;
+ let pkeyh = bufio::fixed(pkey, io::mode::READ);
+ ssh::key_decoderawpub(key, &pkeyh)!;
+
+ ssh::encode_pubkeystr(os::stdout, key)!;
fmt::println()!;
};