|
|
|
@ -245,7 +245,6 @@ pgp_validate_key_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
|
|
|
|
|
pgp_pubkey_t *sigkey;
|
|
|
|
|
pgp_error_t **errors;
|
|
|
|
|
pgp_io_t *io;
|
|
|
|
|
unsigned from;
|
|
|
|
|
unsigned valid = 0;
|
|
|
|
|
|
|
|
|
|
io = cbinfo->io;
|
|
|
|
@ -336,10 +335,11 @@ pgp_validate_key_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
|
|
|
|
|
}
|
|
|
|
|
case PGP_PTAG_CT_SIGNATURE: /* V3 sigs */
|
|
|
|
|
case PGP_PTAG_CT_SIGNATURE_FOOTER: /* V4 sigs */
|
|
|
|
|
from = 0;
|
|
|
|
|
sigkey = NULL;
|
|
|
|
|
if(vdata->keyring){
|
|
|
|
|
unsigned from;
|
|
|
|
|
const pgp_key_t *signer;
|
|
|
|
|
from = 0;
|
|
|
|
|
signer = pgp_getkeybyid(io, vdata->keyring,
|
|
|
|
|
content->sig.info.signer_id,
|
|
|
|
|
&from, &sigkey);
|
|
|
|
@ -753,17 +753,31 @@ static void printtime(time_t t)
|
|
|
|
|
tm->tm_mon + 1,
|
|
|
|
|
tm->tm_mday);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef struct key_filter_cb_t{
|
|
|
|
|
pgp_keyring_t *destring;
|
|
|
|
|
pgp_key_t *key;
|
|
|
|
|
} key_filter_cb_t;
|
|
|
|
|
|
|
|
|
|
static pgp_cb_ret_t key_filter_cb (
|
|
|
|
|
validate_key_cb_t *vdata,
|
|
|
|
|
const pgp_subpacket_t *sigpkt)
|
|
|
|
|
{
|
|
|
|
|
key_filter_cb_t *filter = vdata->on_valid_args;
|
|
|
|
|
|
|
|
|
|
if(vdata->not_commited){
|
|
|
|
|
printf("New key ************************************** \n");
|
|
|
|
|
/*hexdump(stdout, "signer ID", vdata->valid_sig_info.signer_id,
|
|
|
|
|
sizeof(vdata->valid_sig_info.signer_id));*/
|
|
|
|
|
hexdump(stdout, "pubkey ID", vdata->pubkeyid,
|
|
|
|
|
sizeof(vdata->pubkeyid));
|
|
|
|
|
if((filter->key = pgp_ensure_pubkey(filter->destring,
|
|
|
|
|
&vdata->pubkey,
|
|
|
|
|
vdata->pubkeyid))==NULL){
|
|
|
|
|
return PGP_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch(vdata->last_seen){
|
|
|
|
|
case ATTRIBUTE:
|
|
|
|
|
printf("ATTRIBUTE\n");
|
|
|
|
@ -786,7 +800,13 @@ static pgp_cb_ret_t key_filter_cb (
|
|
|
|
|
hexdump(stdout, "subkey ID", subkeyid,
|
|
|
|
|
sizeof(subkeyid));
|
|
|
|
|
/* XXX TODO add/update subkey
|
|
|
|
|
* with expiration and flags from sig info */
|
|
|
|
|
* with expiration and flags from sig info
|
|
|
|
|
if (memcmp(key->encid, "\0\0\0\0\0\0\0\0", 8) == 0) {
|
|
|
|
|
pgp_pubkey_dup(&key->enckey, pubkey);
|
|
|
|
|
(void) memcpy(&key->encid, pubkeyid, sizeof(PGP_KEY_ID_SIZE));
|
|
|
|
|
(void) memcpy(&key->encfingerprint, &key->sigfingerprint,
|
|
|
|
|
sizeof(key->encfingerprint));
|
|
|
|
|
* */
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case PRIMARYKEY:
|
|
|
|
@ -810,17 +830,21 @@ pgp_filter_keys_from_mem(pgp_io_t *io,
|
|
|
|
|
pgp_memory_t *mem)
|
|
|
|
|
{
|
|
|
|
|
pgp_validation_t vresult;
|
|
|
|
|
pgp_stream_t *stream;
|
|
|
|
|
const unsigned noaccum = 0;
|
|
|
|
|
validate_key_cb_t vdata;
|
|
|
|
|
const int printerrors = 1;
|
|
|
|
|
unsigned res;
|
|
|
|
|
pgp_stream_t *stream;
|
|
|
|
|
const unsigned noaccum = 0;
|
|
|
|
|
validate_key_cb_t vdata;
|
|
|
|
|
key_filter_cb_t filter;
|
|
|
|
|
const int printerrors = 1;
|
|
|
|
|
unsigned res;
|
|
|
|
|
|
|
|
|
|
(void) memset(&vresult, 0x0, sizeof(vresult));
|
|
|
|
|
(void) memset(&vdata, 0x0, sizeof(vdata));
|
|
|
|
|
vdata.result = &vresult;
|
|
|
|
|
vdata.getpassphrase = NULL;
|
|
|
|
|
|
|
|
|
|
(void) memset(&filter, 0x0, sizeof(filter));
|
|
|
|
|
filter.destring = destring;
|
|
|
|
|
|
|
|
|
|
stream = pgp_new(sizeof(*stream));
|
|
|
|
|
pgp_parse_options(stream, PGP_PTAG_SS_ALL, PGP_PARSE_PARSED);
|
|
|
|
|
pgp_setup_memory_read(io, &stream, mem, &vdata, pgp_validate_key_cb,
|
|
|
|
|