X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=pageant.h;h=6e29f40c181a0fc8e8186d25f1acb8aa29a6ec8c;hb=510f49e405e71ba5c97875e7a019364e1ef5fac9;hp=06dd033a8010fd6cd8d412afa6cd388c8db46657;hpb=47c9a6ef0bda6bed52f1c37ff4f8ef98734d349a;p=PuTTY.git diff --git a/pageant.h b/pageant.h index 06dd033a..6e29f40c 100644 --- a/pageant.h +++ b/pageant.h @@ -85,3 +85,59 @@ void pageant_listener_got_socket(struct pageant_listen_state *pl, Socket sock); void pageant_listener_set_logfn(struct pageant_listen_state *pl, void *logctx, pageant_logfn_t logfn); void pageant_listener_free(struct pageant_listen_state *pl); + +/* + * Functions to perform specific key actions, either as a client of an + * ssh-agent running elsewhere, or directly on the agent state in this + * process. (On at least one platform we want to do this in an + * agnostic way between the two situations.) + * + * pageant_get_keylist{1,2} work just like pageant_make_keylist{1,2} + * above, except that they can also cope if they have to contact an + * external agent. + * + * pageant_add_keyfile() is used to load a private key from a file and + * add it to the agent. Initially, you should call it with passphrase + * NULL, and it will check if the key is already in the agent, and + * whether a passphrase is required. Return values are given in the + * enum below. On return, *retstr will either be NULL, or a + * dynamically allocated string containing a key comment or an error + * message. + * + * pageant_add_keyfile() also remembers passphrases with which it's + * successfully decrypted keys (because if you try to add multiple + * keys in one go, you might very well have used the same passphrase + * for keys that have the same trust properties). Call + * pageant_forget_passphrases() to get rid of them all. + */ +void *pageant_get_keylist1(int *length); +void *pageant_get_keylist2(int *length); +enum { + PAGEANT_ACTION_OK, /* success; no further action needed */ + PAGEANT_ACTION_FAILURE, /* failure; *retstr is error message */ + PAGEANT_ACTION_NEED_PP /* need passphrase: *retstr is key comment */ +}; +int pageant_add_keyfile(Filename *filename, const char *passphrase, + char **retstr); +void pageant_forget_passphrases(void); + +struct pageant_pubkey { + /* Everything needed to identify a public key found by + * pageant_enum_keys and pass it back to the agent or other code + * later */ + void *blob; + int bloblen; + char *comment; + int ssh_version; +}; +struct pageant_pubkey *pageant_pubkey_copy(struct pageant_pubkey *key); +void pageant_pubkey_free(struct pageant_pubkey *key); + +typedef void (*pageant_key_enum_fn_t)(void *ctx, + const char *fingerprint, + const char *comment, + struct pageant_pubkey *key); +int pageant_enum_keys(pageant_key_enum_fn_t callback, void *callback_ctx, + char **retstr); +int pageant_delete_key(struct pageant_pubkey *key, char **retstr); +int pageant_delete_all_keys(char **retstr);