1 /* packet.h - OpenPGP packet definitions
2 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
3 * 2007 Free Software Foundation, Inc.
4 * Copyright (C) 2015 g10 Code GmbH
6 * This file is part of GnuPG.
8 * GnuPG is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * GnuPG is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
26 #include "../common/iobuf.h"
27 #include "../common/strlist.h"
30 #include "../common/openpgpdefs.h"
31 #include "../common/userids.h"
33 #define DEBUG_PARSE_PACKET 1
36 /* Constants to allocate static MPI arrays. */
37 #define PUBKEY_MAX_NPKEY 5
38 #define PUBKEY_MAX_NSKEY 7
39 #define PUBKEY_MAX_NSIG 2
40 #define PUBKEY_MAX_NENC 2
43 #define PUBKEY_USAGE_SIG GCRY_PK_USAGE_SIGN /* Good for signatures. */
44 #define PUBKEY_USAGE_ENC GCRY_PK_USAGE_ENCR /* Good for encryption. */
45 #define PUBKEY_USAGE_CERT GCRY_PK_USAGE_CERT /* Also good to certify keys.*/
46 #define PUBKEY_USAGE_AUTH GCRY_PK_USAGE_AUTH /* Good for authentication. */
47 #define PUBKEY_USAGE_UNKNOWN GCRY_PK_USAGE_UNKN /* Unknown usage flag. */
48 #define PUBKEY_USAGE_NONE 256 /* No usage given. */
49 #if (GCRY_PK_USAGE_SIGN | GCRY_PK_USAGE_ENCR | GCRY_PK_USAGE_CERT \
50 | GCRY_PK_USAGE_AUTH | GCRY_PK_USAGE_UNKN) >= 256
51 # error Please choose another value for PUBKEY_USAGE_NONE
55 #define is_RSA(a) ((a)==PUBKEY_ALGO_RSA || (a)==PUBKEY_ALGO_RSA_E \
56 || (a)==PUBKEY_ALGO_RSA_S )
57 #define is_ELGAMAL(a) ((a)==PUBKEY_ALGO_ELGAMAL_E)
58 #define is_DSA(a) ((a)==PUBKEY_ALGO_DSA)
60 /* A pointer to the packet object. */
61 typedef struct packet_struct PACKET;
63 /* PKT_GPG_CONTROL types */
65 CTRLPKT_CLEARSIGN_START = 1,
67 CTRLPKT_PLAINTEXT_MARK =3
84 int mode; /* Must be an integer due to the GNU modes 1001 et al. */
92 byte cipher_algo; /* cipher algorithm used */
94 byte seskeylen; /* keylength in byte or 0 for no seskey */
99 u32 keyid[2]; /* 64 bit keyid */
101 byte pubkey_algo; /* algorithm used for public key scheme */
103 gcry_mpi_t data[PUBKEY_MAX_NENC];
108 u32 keyid[2]; /* 64 bit keyid */
109 byte sig_class; /* sig classification */
110 byte digest_algo; /* algorithm used for digest */
111 byte pubkey_algo; /* algorithm used for public key scheme */
112 byte last; /* a stupid flag */
117 size_t size; /* allocated */
118 size_t len; /* used */
122 struct revocation_key {
125 byte fpr[MAX_FINGERPRINT_LEN];
129 /* Object to keep information about a PKA DNS record. */
132 int valid; /* An actual PKA record exists for EMAIL. */
133 int checked; /* Set to true if the FPR has been checked against the
135 char *uri; /* Malloced string with the URI. NULL if the URI is
137 unsigned char fpr[20]; /* The fingerprint as stored in the PKA RR. */
138 char email[1];/* The email address from the notation data. */
142 /* Object to keep information pertaining to a signature. */
147 unsigned checked:1; /* Signature has been checked. */
148 unsigned valid:1; /* Signature is good (if checked is set). */
149 unsigned chosen_selfsig:1; /* A selfsig that is the chosen one. */
150 unsigned unknown_critical:1;
151 unsigned exportable:1;
152 unsigned revocable:1;
153 unsigned policy_url:1; /* At least one policy URL is present */
154 unsigned notation:1; /* At least one notation is present */
155 unsigned pref_ks:1; /* At least one preferred keyserver is present */
157 unsigned pka_tried:1; /* Set if we tried to retrieve the PKA record. */
159 u32 keyid[2]; /* 64 bit keyid */
160 u32 timestamp; /* Signature made (seconds since Epoch). */
161 u32 expiredate; /* Expires at this date or 0 if not at all. */
163 byte sig_class; /* Sig classification, append for MD calculation. */
164 byte pubkey_algo; /* Algorithm used for public key scheme */
165 /* (PUBKEY_ALGO_xxx) */
166 byte digest_algo; /* Algorithm used for digest (DIGEST_ALGO_xxxx). */
169 const byte *trust_regexp;
170 struct revocation_key *revkey;
172 pka_info_t *pka_info; /* Malloced PKA data or NULL if not
173 available. See also flags.pka_tried. */
174 subpktarea_t *hashed; /* All subpackets with hashed data (v4 only). */
175 subpktarea_t *unhashed; /* Ditto for unhashed data. */
176 byte digest_start[2]; /* First 2 bytes of the digest. */
177 gcry_mpi_t data[PUBKEY_MAX_NSIG];
178 /* The message digest and its length (in bytes). Note the maximum
179 digest length is 512 bits (64 bytes). If DIGEST_LEN is 0, then
180 the digest's value has not been saved here. */
181 byte digest[512 / 8];
185 #define ATTRIB_IMAGE 1
187 /* This is the cooked form of attributes. */
188 struct user_attribute {
195 /* (See also keybox-search-desc.h) */
196 struct gpg_pkt_user_id_s
198 int ref; /* reference counter */
199 int len; /* length of the name */
200 struct user_attribute *attribs;
202 byte *attrib_data; /* if this is not NULL, the packet is an attribute */
203 unsigned long attrib_len;
208 int help_marginal_count;
209 int is_primary; /* 2 if set via the primary flag, 1 if calculated */
212 u32 expiredate; /* expires at this date or 0 if not at all */
213 prefitem_t *prefs; /* list of preferences (may be NULL)*/
214 u32 created; /* according to the self-signature */
218 /* TODO: Move more flags here */
220 unsigned int ks_modify:1;
221 unsigned int compacted:1;
225 typedef struct gpg_pkt_user_id_s PKT_user_id;
231 /* revoked at this date */
233 /* the keyid of the revoking key (selfsig or designated revoker) */
235 /* the algo of the revoking key */
240 /* Information pertaining to secret keys. */
243 int is_protected:1; /* The secret info is protected and must */
244 /* be decrypted before use, the protected */
245 /* MPIs are simply (void*) pointers to memory */
246 /* and should never be passed to a mpi_xxx() */
247 int sha1chk:1; /* SHA1 is used instead of a 16 bit checksum */
248 u16 csum; /* Checksum for old protection modes. */
249 byte algo; /* Cipher used to protect the secret information. */
250 STRING2KEY s2k; /* S2K parameter. */
251 byte ivlen; /* Used length of the IV. */
252 byte iv[16]; /* Initialization vector for CFB mode. */
257 * We assume that secret keys have the same number of parameters as
258 * the public key and that the public parameters are the first items
259 * in the PKEY array. Thus NPKEY is always less than NSKEY and it is
260 * possible to compare the secret and public keys by comparing the
261 * first NPKEY elements of the PKEY array. Note that since GnuPG 2.1
262 * we don't use secret keys anymore directly because they are managed
263 * by gpg-agent. However for parsing OpenPGP key files we need a way
264 * to temporary store those secret keys. We do this by putting them
265 * into the public key structure and extending the PKEY field to NSKEY
266 * elements; the extra secret key information are stored in the
271 u32 timestamp; /* key made */
272 u32 expiredate; /* expires at this date or 0 if not at all */
273 u32 max_expiredate; /* must not expire past this date */
274 struct revoke_info revoked;
275 byte hdrbytes; /* number of header bytes */
277 byte selfsigversion; /* highest version of all of the self-sigs */
278 byte pubkey_algo; /* algorithm used for public key scheme */
279 byte pubkey_usage; /* for now only used to pass it to getkey() */
280 byte req_usage; /* hack to pass a request to getkey() */
281 u32 has_expired; /* set to the expiration date if expired */
282 u32 main_keyid[2]; /* keyid of the primary key */
283 u32 keyid[2]; /* calculated by keyid_from_pk() */
284 prefitem_t *prefs; /* list of preferences (may be NULL) */
287 unsigned int mdc:1; /* MDC feature set. */
288 unsigned int disabled_valid:1;/* The next flag is valid. */
289 unsigned int disabled:1; /* The key has been disabled. */
290 unsigned int primary:1; /* This is a primary key. */
291 unsigned int revoked:2; /* Key has been revoked.
292 1 = revoked by the owner
293 2 = revoked by designated revoker. */
294 unsigned int maybe_revoked:1; /* A designated revocation is
295 present, but without the key to
297 unsigned int valid:1; /* Key (especially subkey) is valid. */
298 unsigned int dont_cache:1; /* Do not cache this key. */
299 unsigned int backsig:2; /* 0=none, 1=bad, 2=good. */
300 unsigned int serialno_valid:1;/* SERIALNO below is valid. */
302 PKT_user_id *user_id; /* If != NULL: found by that uid. */
303 struct revocation_key *revkey;
308 const byte *trust_regexp;
309 char *serialno; /* Malloced hex string or NULL if it is
310 likely not on a card. See also
311 flags.serialno_valid. */
312 struct seckey_info *seckey_info; /* If not NULL this malloced
313 structure describes a secret
315 gcry_mpi_t pkey[PUBKEY_MAX_NSKEY]; /* Right, NSKEY elements. */
318 /* Evaluates as true if the pk is disabled, and false if it isn't. If
319 there is no disable value cached, fill one in. */
320 #define pk_is_disabled(a) \
321 (((a)->flags.disabled_valid)? \
322 ((a)->flags.disabled):(cache_disabled_value((a))))
326 int len; /* length of data */
331 u32 len; /* reserved */
334 iobuf_t buf; /* IOBUF reference */
338 u32 len; /* Remaining length of encrypted data. */
339 int extralen; /* This is (blocksize+2). Used by build_packet. */
340 byte new_ctb; /* uses a new CTB */
341 byte is_partial; /* partial length encoded */
342 byte mdc_method; /* > 0: integrity protected encrypted data packet */
343 iobuf_t buf; /* IOBUF reference */
351 unsigned int trustval;
352 unsigned int sigcache;
356 u32 len; /* length of encrypted data */
357 iobuf_t buf; /* IOBUF reference */
359 byte is_partial; /* partial length encoded */
372 /* combine all packets into a union */
373 struct packet_struct {
377 PKT_symkey_enc *symkey_enc; /* PKT_SYMKEY_ENC */
378 PKT_pubkey_enc *pubkey_enc; /* PKT_PUBKEY_ENC */
379 PKT_onepass_sig *onepass_sig; /* PKT_ONEPASS_SIG */
380 PKT_signature *signature; /* PKT_SIGNATURE */
381 PKT_public_key *public_key; /* PKT_PUBLIC_[SUB]KEY */
382 PKT_public_key *secret_key; /* PKT_SECRET_[SUB]KEY */
383 PKT_comment *comment; /* PKT_COMMENT */
384 PKT_user_id *user_id; /* PKT_USER_ID */
385 PKT_compressed *compressed; /* PKT_COMPRESSED */
386 PKT_encrypted *encrypted; /* PKT_ENCRYPTED[_MDC] */
387 PKT_mdc *mdc; /* PKT_MDC */
388 PKT_ring_trust *ring_trust; /* PKT_RING_TRUST */
389 PKT_plaintext *plaintext; /* PKT_PLAINTEXT */
390 PKT_gpg_control *gpg_control; /* PKT_GPG_CONTROL */
394 #define init_packet(a) do { (a)->pkttype = 0; \
395 (a)->pkt.generic = NULL; \
408 unsigned int critical:1;
409 unsigned int ignore:1;
411 struct notation *next;
415 void reset_literals_seen(void);
416 int proc_packets (ctrl_t ctrl, void *ctx, iobuf_t a );
417 int proc_signature_packets (ctrl_t ctrl, void *ctx, iobuf_t a,
418 strlist_t signedfiles, const char *sigfile );
419 int proc_signature_packets_by_fd (ctrl_t ctrl,
420 void *anchor, IOBUF a, int signed_data_fd );
421 int proc_encryption_packets (ctrl_t ctrl, void *ctx, iobuf_t a);
422 int list_packets( iobuf_t a );
424 /*-- parse-packet.c --*/
426 /* Sets the packet list mode to MODE (i.e., whether we are dumping a
427 packet or not). Returns the current mode. This allows for
428 temporarily suspending dumping by doing the following:
430 int saved_mode = set_packet_list_mode (0);
432 set_packet_list_mode (saved_mode);
434 int set_packet_list_mode( int mode );
436 #if DEBUG_PARSE_PACKET
437 /* There are debug functions and should not be used directly. */
438 int dbg_search_packet( iobuf_t inp, PACKET *pkt, off_t *retpos, int with_uid,
439 const char* file, int lineno );
440 int dbg_parse_packet( iobuf_t inp, PACKET *ret_pkt,
441 const char* file, int lineno );
442 int dbg_copy_all_packets( iobuf_t inp, iobuf_t out,
443 const char* file, int lineno );
444 int dbg_copy_some_packets( iobuf_t inp, iobuf_t out, off_t stopoff,
445 const char* file, int lineno );
446 int dbg_skip_some_packets( iobuf_t inp, unsigned n,
447 const char* file, int lineno );
448 #define search_packet( a,b,c,d ) \
449 dbg_search_packet( (a), (b), (c), (d), __FILE__, __LINE__ )
450 #define parse_packet( a, b ) \
451 dbg_parse_packet( (a), (b), __FILE__, __LINE__ )
452 #define copy_all_packets( a,b ) \
453 dbg_copy_all_packets((a),(b), __FILE__, __LINE__ )
454 #define copy_some_packets( a,b,c ) \
455 dbg_copy_some_packets((a),(b),(c), __FILE__, __LINE__ )
456 #define skip_some_packets( a,b ) \
457 dbg_skip_some_packets((a),(b), __FILE__, __LINE__ )
459 /* Return the next valid OpenPGP packet in *PKT. (This function will
460 skip any packets whose type is 0.)
462 Returns 0 on success, -1 if EOF is reached, and an error code
463 otherwise. In the case of an error, the packet in *PKT may be
464 partially constructed. As such, even if there is an error, it is
465 necessary to free *PKT to avoid a resource leak. To detect what
466 has been allocated, clear *PKT before calling this function. */
467 int parse_packet( iobuf_t inp, PACKET *pkt);
469 /* Return the first OpenPGP packet in *PKT that contains a key (either
470 a public subkey, a public key, a secret subkey or a secret key) or,
471 if WITH_UID is set, a user id.
473 Saves the position in the pipeline of the start of the returned
474 packet (according to iobuf_tell) in RETPOS, if it is not NULL.
476 The return semantics are the same as parse_packet. */
477 int search_packet( iobuf_t inp, PACKET *pkt, off_t *retpos, int with_uid );
479 /* Copy all packets (except invalid packets, i.e., those with a type
480 of 0) from INP to OUT until either an error occurs or EOF is
483 Returns -1 when end of file is reached or an error code, if an
484 error occured. (Note: this function never returns 0, because it
485 effectively keeps going until it gets an EOF.) */
486 int copy_all_packets( iobuf_t inp, iobuf_t out );
488 /* Like copy_all_packets, but stops at the first packet that starts at
489 or after STOPOFF (as indicated by iobuf_tell).
491 Example: if STOPOFF is 100, the first packet in INP goes from 0 to
492 110 and the next packet starts at offset 111, then the packet
493 starting at offset 0 will be completely processed (even though it
494 extends beyond STOPOFF) and the packet starting at offset 111 will
495 not be processed at all. */
496 int copy_some_packets( iobuf_t inp, iobuf_t out, off_t stopoff );
498 /* Skips the next N packets from INP.
500 If parsing a packet returns an error code, then the function stops
501 immediately and returns the error code. Note: in the case of an
502 error, this function does not indicate how many packets were
503 successfully processed. */
504 int skip_some_packets( iobuf_t inp, unsigned n );
507 /* Parse a signature packet and store it in *SIG.
509 The signature packet is read from INP. The OpenPGP header (the tag
510 and the packet's length) have already been read; the next byte read
511 from INP should be the first byte of the packet's contents. The
512 packet's type (as extract from the tag) must be passed as PKTTYPE
513 and the packet's length must be passed as PKTLEN. This is used as
514 the upper bound on the amount of data read from INP. If the packet
515 is shorter than PKTLEN, the data at the end will be silently
516 skipped. If an error occurs, an error code will be returned. -1
517 means the EOF was encountered. 0 means parsing was successful. */
518 int parse_signature( iobuf_t inp, int pkttype, unsigned long pktlen,
519 PKT_signature *sig );
521 /* Given a subpacket area (typically either PKT_signature.hashed or
522 PKT_signature.unhashed), either:
524 - test whether there are any subpackets with the critical bit set
525 that we don't understand,
527 - list the subpackets, or,
529 - find a subpacket with a specific type.
531 REQTYPE indicates the type of operation.
533 If REQTYPE is SIGSUBPKT_TEST_CRITICAL, then this function checks
534 whether there are any subpackets that have the critical bit and
535 which GnuPG cannot handle. If GnuPG understands all subpackets
536 whose critical bit is set, then this function returns simply
537 returns SUBPKTS. If there is a subpacket whose critical bit is set
538 and which GnuPG does not understand, then this function returns
539 NULL and, if START is not NULL, sets *START to the 1-based index of
540 the subpacket that violates the constraint.
542 If REQTYPE is SIGSUBPKT_LIST_HASHED or SIGSUBPKT_LIST_UNHASHED, the
543 packets are dumped. Note: if REQTYPE is SIGSUBPKT_LIST_HASHED,
544 this function does not check whether the hash is correct; this is
545 merely an indication of the section that the subpackets came from.
547 If REQTYPE is anything else, then this function interprets the
548 values as a subpacket type and looks for the first subpacket with
549 that type. If such a packet is found, *CRITICAL (if not NULL) is
550 set if the critical bit was set, *RET_N is set to the offset of the
551 subpacket's content within the SUBPKTS buffer, *START is set to the
552 1-based index of the subpacket within the buffer, and returns
555 *START is the number of initial subpackets to not consider. Thus,
556 if *START is 2, then the first 2 subpackets are ignored. */
557 const byte *enum_sig_subpkt ( const subpktarea_t *subpkts,
558 sigsubpkttype_t reqtype,
559 size_t *ret_n, int *start, int *critical );
563 enum_sig_subpkt (buffer, reqtype, ret_n, NULL, NULL); */
564 const byte *parse_sig_subpkt ( const subpktarea_t *buffer,
565 sigsubpkttype_t reqtype,
568 /* This calls parse_sig_subpkt first on the hashed signature area in
569 SIG and then, if that returns NULL, calls parse_sig_subpkt on the
570 unhashed subpacket area in SIG. */
571 const byte *parse_sig_subpkt2 ( PKT_signature *sig,
572 sigsubpkttype_t reqtype);
574 /* Returns whether the N byte large buffer BUFFER is sufficient to
575 hold a subpacket of type TYPE. Note: the buffer refers to the
576 contents of the subpacket (not the header) and it must already be
577 initialized: for some subpackets, it checks some internal
580 Returns 0 if the size is acceptable. Returns -2 if the buffer is
581 definately too short. To check for an error, check whether the
582 return value is less than 0. */
583 int parse_one_sig_subpkt( const byte *buffer, size_t n, int type );
585 /* Looks for revocation key subpackets (see RFC 4880 5.2.3.15) in the
586 hashed area of the signature packet. Any that are found are added
587 to SIG->REVKEY and SIG->NUMREVKEYS is updated appropriately. */
588 void parse_revkeys(PKT_signature *sig);
590 /* Extract the attributes from the buffer at UID->ATTRIB_DATA and
591 update UID->ATTRIBS and UID->NUMATTRIBS accordingly. */
592 int parse_attribute_subpkts(PKT_user_id *uid);
594 /* Set the UID->NAME field according to the attributes. MAX_NAMELEN
595 must be at least 71. */
596 void make_attribute_uidname(PKT_user_id *uid, size_t max_namelen);
598 /* Allocate and initialize a new GPG control packet. DATA is the data
599 to save in the packet. */
600 PACKET *create_gpg_control ( ctrlpkttype_t type,
604 /*-- build-packet.c --*/
605 int build_packet( iobuf_t inp, PACKET *pkt );
606 gpg_error_t gpg_mpi_write (iobuf_t out, gcry_mpi_t a);
607 gpg_error_t gpg_mpi_write_nohdr (iobuf_t out, gcry_mpi_t a);
608 u32 calc_packet_length( PACKET *pkt );
609 void build_sig_subpkt( PKT_signature *sig, sigsubpkttype_t type,
610 const byte *buffer, size_t buflen );
611 void build_sig_subpkt_from_sig( PKT_signature *sig );
612 int delete_sig_subpkt(subpktarea_t *buffer, sigsubpkttype_t type );
613 void build_attribute_subpkt(PKT_user_id *uid,byte type,
614 const void *buf,u32 buflen,
615 const void *header,u32 headerlen);
616 struct notation *string_to_notation(const char *string,int is_utf8);
617 struct notation *sig_to_notation(PKT_signature *sig);
618 void free_notation(struct notation *notation);
620 /*-- free-packet.c --*/
621 void free_symkey_enc( PKT_symkey_enc *enc );
622 void free_pubkey_enc( PKT_pubkey_enc *enc );
623 void free_seckey_enc( PKT_signature *enc );
624 int digest_algo_from_sig( PKT_signature *sig );
625 void release_public_key_parts( PKT_public_key *pk );
626 void free_public_key( PKT_public_key *key );
627 void free_attributes(PKT_user_id *uid);
628 void free_user_id( PKT_user_id *uid );
629 void free_comment( PKT_comment *rem );
630 void free_packet( PACKET *pkt );
631 prefitem_t *copy_prefs (const prefitem_t *prefs);
632 PKT_public_key *copy_public_key( PKT_public_key *d, PKT_public_key *s );
633 PKT_signature *copy_signature( PKT_signature *d, PKT_signature *s );
634 PKT_user_id *scopy_user_id (PKT_user_id *sd );
635 int cmp_public_keys( PKT_public_key *a, PKT_public_key *b );
636 int cmp_signatures( PKT_signature *a, PKT_signature *b );
637 int cmp_user_ids( PKT_user_id *a, PKT_user_id *b );
640 /*-- sig-check.c --*/
641 /* Check a signature. This is shorthand for check_signature2 with
642 the unnamed arguments passed as NULL. */
643 int check_signature (PKT_signature *sig, gcry_md_hd_t digest);
645 /* Check a signature. Looks up the public key from the key db. (If
646 RET_PK is not NULL, it is returned in *RET_PK.) DIGEST contains a
647 valid hash context that already includes the signed data. This
648 function adds the relevant meta-data to the hash before finalizing
649 it and verifying the signature. */
650 int check_signature2 (PKT_signature *sig, gcry_md_hd_t digest,
651 u32 *r_expiredate, int *r_expired, int *r_revoked,
652 PKT_public_key *ret_pk);
655 /*-- pubkey-enc.c --*/
656 gpg_error_t get_session_key (PKT_pubkey_enc *k, DEK *dek);
657 gpg_error_t get_override_session_key (DEK *dek, const char *string);
660 int handle_compressed (ctrl_t ctrl, void *ctx, PKT_compressed *cd,
661 int (*callback)(iobuf_t, void *), void *passthru );
663 /*-- encr-data.c --*/
664 int decrypt_data (ctrl_t ctrl, void *ctx, PKT_encrypted *ed, DEK *dek );
666 /*-- plaintext.c --*/
667 int handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
668 int nooutput, int clearsig );
669 int ask_for_detached_datafile( gcry_md_hd_t md, gcry_md_hd_t md2,
670 const char *inname, int textmode );
673 int make_keysig_packet( PKT_signature **ret_sig, PKT_public_key *pk,
674 PKT_user_id *uid, PKT_public_key *subpk,
675 PKT_public_key *pksk, int sigclass, int digest_algo,
676 u32 timestamp, u32 duration,
677 int (*mksubpkt)(PKT_signature *, void *),
679 const char *cache_nonce);
680 gpg_error_t update_keysig_packet (PKT_signature **ret_sig,
681 PKT_signature *orig_sig,
684 PKT_public_key *subpk,
685 PKT_public_key *pksk,
686 int (*mksubpkt)(PKT_signature *, void *),
690 PKT_user_id *generate_user_id (kbnode_t keyblock, const char *uidstr);
692 #endif /*G10_PACKET_H*/