mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* main.h, keygen.c (keygen_add_revkey): Add revocation key subpackets to a
signature (callable by make_keysig_packet). (write_direct_sig): Write a 1F direct key signature. (parse_revocation_key): Parse a string in algo:fpr:sensitive format into a revocation key. (get_parameter_revkey, do_generate_keypair): Call above functions when prompted from a batch key generation file. * build-packet.c (build_sig_subpkt): Allow multiple revocation key subpackets in a single sig. * keydb.h, getkey.c (get_seckey_byfprint): Same as get_pubkey_byfprint, except for secret keys. We only know the fingerprint of a revocation key, so this is needed to retrieve the secret key needed to issue a revokation. * packet.h, parse-packet.c (parse_signature, parse_revkeys): Split revkey parsing off into a new function that can be used to reparse after manipulating the revkey list. * sign.c (make_keysig_packet): Ability to make 1F direct key signatures.
This commit is contained in:
parent
fcfc223dbb
commit
4dcdaa3b1b
9 changed files with 232 additions and 27 deletions
|
@ -1121,6 +1121,31 @@ parse_sig_subpkt2 (PKT_signature *sig, sigsubpkttype_t reqtype,
|
|||
return p;
|
||||
}
|
||||
|
||||
/* Find all revocation keys. Look in hashed area only. */
|
||||
void parse_revkeys(PKT_signature *sig)
|
||||
{
|
||||
struct revocation_key *revkey;
|
||||
int seq=0;
|
||||
size_t len;
|
||||
|
||||
if(sig->sig_class!=0x1F)
|
||||
return;
|
||||
|
||||
while((revkey=
|
||||
(struct revocation_key *)enum_sig_subpkt(sig->hashed,
|
||||
SIGSUBPKT_REV_KEY,
|
||||
&len,&seq)))
|
||||
{
|
||||
if(len==sizeof(struct revocation_key) &&
|
||||
(revkey->class&0x80)) /* 0x80 bit must be set */
|
||||
{
|
||||
sig->revkey=m_realloc(sig->revkey,
|
||||
sizeof(struct revocation_key *)*(sig->numrevkeys+1));
|
||||
sig->revkey[sig->numrevkeys]=revkey;
|
||||
sig->numrevkeys++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
|
||||
|
@ -1261,28 +1286,9 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||
if(p && *p==0)
|
||||
sig->flags.exportable=0;
|
||||
|
||||
/* Find all revocation keys. Back to hashed area only. */
|
||||
/* Find all revocation keys. */
|
||||
if(sig->sig_class==0x1F)
|
||||
{
|
||||
struct revocation_key *revkey;
|
||||
int seq=0;
|
||||
size_t len;
|
||||
|
||||
while((revkey=
|
||||
(struct revocation_key *)enum_sig_subpkt(sig->hashed,
|
||||
SIGSUBPKT_REV_KEY,
|
||||
&len,&seq)))
|
||||
{
|
||||
if(len==sizeof(struct revocation_key) &&
|
||||
(revkey->class&0x80)) /* 0x80 bit must be set */
|
||||
{
|
||||
sig->revkey=m_realloc(sig->revkey,
|
||||
sizeof(struct revocation_key *)*(sig->numrevkeys+1));
|
||||
sig->revkey[sig->numrevkeys]=revkey;
|
||||
sig->numrevkeys++;
|
||||
}
|
||||
}
|
||||
}
|
||||
parse_revkeys(sig);
|
||||
}
|
||||
|
||||
if( list_mode ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue