export secret keys

doc_update_sequoia
Volker Birk 7 years ago
parent 58e64a608f
commit 1b7779a73a

@ -177,7 +177,7 @@ DYNAMIC_API PEP_STATUS own_key_is_listed(
// own_identities (out) list of own identities
//
// caveat:
// the ownership of the copy of own_key goes to the caller
// the ownership of the copy of own_identities goes to the caller
DYNAMIC_API PEP_STATUS own_identities_retrieve(
PEP_SESSION session,

@ -1296,7 +1296,7 @@ DYNAMIC_API PEP_STATUS export_key(
key_data, size, false);
}
DYNAMIC_API PEP_STATUS export_secret_key(
DYNAMIC_API PEP_STATUS export_secrect_key(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size
)
{

@ -264,9 +264,22 @@ PEP_STATUS unicast_msg(
IdentityList_t *list = &msg->payload.choice.groupKeys.ownIdentities;
for (int i=0; i<list->list.count; i++) {
Identity_t *ident = list->list.array[i];
char *fpr = strndup((const char *)ident->fpr.buf, ident->fpr.size);
assert(fpr);
if (!fpr)
goto enomem;
static char filename[MAX_LINELENGTH];
int result = snprintf(filename, MAX_LINELENGTH, "%s-sec.asc", fpr);
if (result < 0)
goto enomem;
char *key = NULL;
size_t size = 0;
status = export_secrect_key(session, fpr, &key, &size);
free(fpr);
if (status != PEP_STATUS_OK)
goto error;
bloblist_t *bl = bloblist_add(_message->attachments,
(char *) ident->fpr.buf, ident->fpr.size,
"application/pgp-keys", "");
(char *) key, size, "application/pgp-keys", filename);
if (!bl)
goto enomem;
if (!_message->attachments)

Loading…
Cancel
Save