root/openpgpsdk/trunk/include/packet.h

Revision 135 (checked in by rachel, 8 years ago)

Basic doxygen header added
Unwanted $Id$ headers removed
doxygen-user.cfg modified to include include dir

  • Property svn:keywords set to Id
Line 
1 /** \file
2  * packet related headers.
3  */
4
5 #ifndef OPS_PACKET_H
6 #define OPS_PACKET_H
7
8 #include <time.h>
9 #include <openssl/bn.h>
10 #include "types.h"
11
12 /** general use structure for variable-length data */
13
14 typedef struct
15     {
16     size_t len;
17     unsigned char *contents;
18     } data_t;
19
20 /************************************/
21 /* Packet Tags - RFC2440bis-12, 4.2 */
22 /************************************/
23
24 /** Packet Tag - Bit 7 Mask (this bit is always set).
25  * The first byte of a packet is the "Packet Tag".  It always
26  * has bit 7 set.  This is the mask for it.
27  *
28  * \see RFC2440bis-12 4.2
29  */
30 #define OPS_PTAG_ALWAYS_SET             0x80
31
32 /** Packet Tag - New Format Flag.
33  * Bit 6 of the Packet Tag is the packet format indicator.
34  * If it is set, the new format is used, if cleared the
35  * old format is used.
36  *
37  * \see RFC2440bis-12 4.2
38  */
39 #define OPS_PTAG_NEW_FORMAT             0x40
40
41
42 /** Old Packet Format: Mask for content tag.
43  * In the old packet format bits 5 to 2 (including)
44  * are the content tag.  This is the mask to apply
45  * to the packet tag.  Note that you need to
46  * shift by #OPS_PTAG_OF_CONTENT_TAG_SHIFT bits.
47  *
48  * \see RFC2440bis-12 4.2
49  */
50 #define OPS_PTAG_OF_CONTENT_TAG_MASK    0x3c
51 /** Old Packet Format: Offset for the content tag.
52  * As described at #OPS_PTAG_OF_CONTENT_TAG_MASK the
53  * content tag needs to be shifted after being masked
54  * out from the Packet Tag.
55  *
56  * \see RFC2440bis-12 4.2
57  */
58 #define OPS_PTAG_OF_CONTENT_TAG_SHIFT   2
59 /** Old Packet Format: Mask for length type.
60  * Bits 1 and 0 of the packet tag are the length type
61  * in the old packet format.
62  *
63  * See #ops_ptag_of_lt_t for the meaning of the values.
64  *
65  * \see RFC2440bis-12 4.2
66  */
67 #define OPS_PTAG_OF_LENGTH_TYPE_MASK    0x03
68
69
70 /** Old Packet Format Lengths.
71  * Defines the meanings of the 2 bits for length type in the
72  * old packet format.
73  *
74  * \see RFC2440bis-12 4.2.1
75  */
76 typedef enum
77     {
78     OPS_PTAG_OF_LT_ONE_BYTE             =0x00, /*!< Packet has a 1 byte length - header is 2 bytes long. */
79     OPS_PTAG_OF_LT_TWO_BYTE             =0x01, /*!< Packet has a 2 byte length - header is 3 bytes long. */
80     OPS_PTAG_OF_LT_FOUR_BYTE            =0x02, /*!< Packet has a 4 byte length - header is 5 bytes long. */
81     OPS_PTAG_OF_LT_INDETERMINATE        =0x03  /*!< Packet has a indeterminate length. */
82     } ops_ptag_of_lt_t;
83
84
85 /** New Packet Format: Mask for content tag.
86  * In the new packet format the 6 rightmost bits
87  * are the content tag.  This is the mask to apply
88  * to the packet tag.  Note that you need to
89  * shift by #OPS_PTAG_NF_CONTENT_TAG_SHIFT bits.
90  *
91  * \see RFC2440bis-12 4.2
92  */
93 #define OPS_PTAG_NF_CONTENT_TAG_MASK    0x3f
94 /** New Packet Format: Offset for the content tag.
95  * As described at #OPS_PTAG_NF_CONTENT_TAG_MASK the
96  * content tag needs to be shifted after being masked
97  * out from the Packet Tag.
98  *
99  * \see RFC2440bis-12 4.2
100  */
101 #define OPS_PTAG_NF_CONTENT_TAG_SHIFT   0
102
103
104
105 /* PTag Content Tags */
106 /***************************/
107
108 /** Package Tags (aka Content Tags) and signatue subpacket types.
109  * This enumerates all rfc-defined packet tag values and the
110  * signature subpacket type values that we understand.
111  *
112  * \see RFC2440bis-12 4.3
113  * \see RFC2440bis-12 5.2.3.1
114  */
115 enum ops_content_tag_t
116     {
117     OPS_PTAG_CT_RESERVED                = 0,    /*!< Reserved - a packet tag must not have this value */
118     OPS_PTAG_CT_PK_SESSION_KEY          = 1,    /*!< Public-Key Encrypted Session Key Packet */
119     OPS_PTAG_CT_SIGNATURE               = 2,    /*!< Signature Packet */
120     OPS_PTAG_CT_SK_SESSION_KEY          = 3,    /*!< Symmetric-Key Encrypted Session Key Packet */
121     OPS_PTAG_CT_ONE_PASS_SIGNATURE      = 4,    /*!< One-Pass Signature Packet */
122     OPS_PTAG_CT_SECRET_KEY              = 5,    /*!< Secret Key Packet */
123     OPS_PTAG_CT_PUBLIC_KEY              = 6,    /*!< Public Key Packet */
124     OPS_PTAG_CT_SECRET_SUBKEY           = 7,    /*!< Secret Subkey Packet */
125     OPS_PTAG_CT_COMPRESSED              = 8,    /*!< Compressed Data Packet */
126     OPS_PTAG_CT_SK_DATA                 = 9,    /*!< Symmetrically Encrypted Data Packet */
127     OPS_PTAG_CT_MARKER                  =10,    /*!< Marker Packet */
128     OPS_PTAG_CT_LITERAL_DATA            =11,    /*!< Literal Data Packet */
129     OPS_PTAG_CT_TRUST                   =12,    /*!< Trust Packet */
130     OPS_PTAG_CT_USER_ID                 =13,    /*!< User ID Packet */
131     OPS_PTAG_CT_PUBLIC_SUBKEY           =14,    /*!< Public Subkey Packet */
132     OPS_PTAG_CT_RESERVED2               =15,    /*!< reserved */
133     OPS_PTAG_CT_RESERVED3               =16,    /*!< reserved */
134     OPS_PTAG_CT_USER_ATTRIBUTE          =17,    /*!< User Attribute Packet */
135     OPS_PTAG_CT_SK_IP_DATA              =18,    /*!< Sym. Encrypted and Integrity Protected Data Packet */
136     OPS_PTAG_CT_MDC                     =19,    /*!< Modification Detection Code Packet */
137
138     OPS_PARSER_ERROR                    =0x100, /*!< Internal Use: Parser Error */
139     OPS_PARSER_PTAG                     =0x101, /*!< Internal Use: The packet is the "Packet Tag" itself - used when
140                                                      callback sends back the PTag. */
141     OPS_PTAG_RAW_SS                     =0x102, /*!< Internal Use: content is raw sig subtag */
142     OPS_PTAG_SS_ALL                     =0x103, /*!< Internal Use: select all subtags */
143     OPS_PARSER_PACKET_END               =0x104,
144
145     /* signature subpackets (0x200-2ff) (type+0x200) */
146     /* only those we can parse are listed here */
147     OPS_PTAG_SIGNATURE_SUBPACKET_BASE   =0x200,         /*!< Base for signature subpacket types - All signature type
148                                                              values are relative to this value. */
149     OPS_PTAG_SS_CREATION_TIME           =0x200+2,       /*!< signature creation time */
150     OPS_PTAG_SS_EXPIRATION_TIME         =0x200+3,       /*!< signature expiration time */
151
152     OPS_PTAG_SS_TRUST                   =0x200+5,       /*!< trust signature */
153     OPS_PTAG_SS_REGEXP                  =0x200+6,       /*!< regular expression */
154     OPS_PTAG_SS_REVOCABLE               =0x200+7,       /*!< revocable */
155     OPS_PTAG_SS_KEY_EXPIRATION_TIME     =0x200+9,       /*!< key expiration time */
156     OPS_PTAG_SS_PREFERRED_SKA           =0x200+11,      /*!< preferred symmetric algorithms */
157     OPS_PTAG_SS_REVOCATION_KEY          =0x200+12,      /*!< revocation key */
158     OPS_PTAG_SS_ISSUER_KEY_ID           =0x200+16, /*!< issuer key ID */
159     OPS_PTAG_SS_NOTATION_DATA           =0x200+20, /*!< notation data */
160     OPS_PTAG_SS_PREFERRED_HASH          =0x200+21, /*!< preferred hash algorithms */
161     OPS_PTAG_SS_PREFERRED_COMPRESSION   =0x200+22, /*!< preferred compression algorithms */
162     OPS_PTAG_SS_KEY_SERVER_PREFS        =0x200+23, /*!< key server preferences */
163     OPS_PTAG_SS_PREFERRED_KEY_SERVER    =0x200+24, /*!< Preferred Key Server */
164     OPS_PTAG_SS_PRIMARY_USER_ID         =0x200+25, /*!< primary User ID */
165     OPS_PTAG_SS_POLICY_URL              =0x200+26, /*!< Policy URL */
166     OPS_PTAG_SS_KEY_FLAGS               =0x200+27, /*!< key flags */
167     OPS_PTAG_SS_REVOCATION_REASON       =0x200+29, /*!< reason for revocation */
168     OPS_PTAG_SS_FEATURES                =0x200+30, /*!< features */
169
170     OPS_PTAG_SS_USERDEFINED00   =0x200+100, /*!< internal or user-defined */
171     OPS_PTAG_SS_USERDEFINED01   =0x200+101,
172     OPS_PTAG_SS_USERDEFINED02   =0x200+102,
173     OPS_PTAG_SS_USERDEFINED03   =0x200+103,
174     OPS_PTAG_SS_USERDEFINED04   =0x200+104,
175     OPS_PTAG_SS_USERDEFINED05   =0x200+105,
176     OPS_PTAG_SS_USERDEFINED06   =0x200+106,
177     OPS_PTAG_SS_USERDEFINED07   =0x200+107,
178     OPS_PTAG_SS_USERDEFINED08   =0x200+108,
179     OPS_PTAG_SS_USERDEFINED09   =0x200+109,
180     OPS_PTAG_SS_USERDEFINED10   =0x200+110,
181
182        
183     /* pseudo content types */
184     OPS_PTAG_CT_LITERAL_DATA_HEADER     =0x300,
185     OPS_PTAG_CT_LITERAL_DATA_BODY       =0x300+1,
186     };
187
188 /** Structure to hold one parse error string. */
189 typedef struct
190     {
191     const char *error; /*!< error message. */
192     } ops_parser_error_t;
193
194 /** Structure to hold one packet tag.
195  * \see RFC2440bis-12 4.2
196  */
197 typedef struct
198     {
199     unsigned            new_format;     /*!< Whether this packet tag is new (true) or old format (false) */
200     unsigned            content_tag;    /*!< content_tag value - See #ops_content_tag_t for meanings */
201     ops_ptag_of_lt_t    length_type;    /*!< Length type (#ops_ptag_of_lt_t) - only if this packet tag is old format.  Set to 0 if new format. */
202     unsigned            length;         /*!< The length of the packet.  This value is set when we read and compute the
203                                           length information, not at the same moment we create the packet tag structure.
204                                           Only defined if #length_read is set. */  /* XXX: Ben, is this correct? */
205     //    unsigned              length_read;    /*!< How much bytes of this packet we have read so far - for internal use
206     //                                    only. */
207     } ops_ptag_t;
208
209 /** Public Key Algorithm Numbers.
210  * OpenPGP assigns a unique Algorithm Number to each algorithm that is part of OpenPGP.
211  *
212  * This lists algorithm numbers for public key algorithms.
213  *
214  * \see RFC2440bis-12 9.1
215  */
216 typedef enum
217     {
218     OPS_PKA_RSA                 =1,     /*!< RSA (Encrypt or Sign) */
219     OPS_PKA_RSA_ENCRYPT_ONLY    =2,     /*!< RSA Encrypt-Only (deprecated - \see RFC2440bis-12 12.4) */
220     OPS_PKA_RSA_SIGN_ONLY       =3,     /*!< RSA Sign-Only (deprecated - \see RFC2440bis-12 12.4) */
221     OPS_PKA_ELGAMAL             =16,    /*!< Elgamal (Encrypt-Only) */
222     OPS_PKA_DSA                 =17     /*!< DSA (Digital Signature Algorithm) */
223     } ops_public_key_algorithm_t;
224
225 /** Structure to hold one DSA public key parameters.
226  *
227  * \see RFC2440bis-12 5.5.2
228  */
229 typedef struct
230     {
231     BIGNUM *p;  /*!< DSA prime p */
232     BIGNUM *q;  /*!< DSA group order q */
233     BIGNUM *g;  /*!< DSA group generator g */
234     BIGNUM *y;  /*!< DSA public key value y (= g^x mod p with x being the secret) */
235     } ops_dsa_public_key_t;
236
237 /** Structure to hold on RSA public key.
238  *
239  * \see RFC2440bis-12 5.5.2
240  */
241 typedef struct
242     {
243     BIGNUM *n;  /*!< RSA public modulus n */
244     BIGNUM *e;  /*!< RSA public encryptiong exponent e */
245     } ops_rsa_public_key_t;
246
247 /** Structure to hold on ElGamal public key parameters.
248  *
249  * \see RFC2440bis-12 5.5.2
250  */
251 typedef struct
252     {
253     BIGNUM *p;  /*!< ElGamal prime p */
254     BIGNUM *g;  /*!< ElGamal group generator g */
255     BIGNUM *y;  /*!< ElGamal public key value y (= g^x mod p with x being the secret) */
256     } ops_elgamal_public_key_t;
257
258 /** Union to hold public key parameters of any algorithm */
259 typedef union
260     {
261     ops_dsa_public_key_t        dsa;            /*!< A DSA public key */
262     ops_rsa_public_key_t        rsa;            /*!< An RSA public key */
263     ops_elgamal_public_key_t    elgamal;        /*!< An ElGamal public key */
264     } ops_public_key_union_t;
265
266 /** Structure to hold one pgp public key */
267 typedef struct
268     {
269     unsigned                    version;        /*!< version of the key (v3, v4...) */
270     time_t                      creation_time;  /*!< when the key was created.  Note that interpretation varies with key
271                                                   version. */
272     unsigned                    days_valid;     /*!< validity period of the key in days since creation.  A value of 0
273                                                   has a special meaning indicating this key does not expire.  Only
274                                                   used with v3 keys. */
275     ops_public_key_algorithm_t  algorithm;      /*!< Public Key Algorithm type */
276     ops_public_key_union_t      key;            /*!< Public Key Parameters */
277     } ops_public_key_t;
278
279 /** Symmetric Key Algorithm Numbers.
280  * OpenPGP assigns a unique Algorithm Number to each algorithm that is part of OpenPGP.
281  *
282  * This lists algorithm numbers for symmetric key algorithms.
283  *
284  * \see RFC2440bis-12 9.2
285  */
286 typedef enum
287     {
288     OPS_SKA_PLAINTEXT   =0, /*!< Plaintext or unencrypted data */
289     OPS_SKA_IDEA        =1, /*!< IDEA */
290     OPS_SKA_TRIPLEDES   =2, /*!< TripleDES */
291     OPS_SKA_CAST5       =3, /*!< CAST5 */
292     OPS_SKA_BLOWFISH    =4, /*!< Blowfish */
293     OPS_SKA_AES_128     =7, /*!< AES with 128-bit key (AES) */
294     OPS_SKA_AES_192     =8, /*!< AES with 192-bit key */
295     OPS_SKA_AES_256     =9, /*!< AES with 256-bit key */
296     OPS_SKA_TWOFISH     =10, /*!< Twofish with 256-bit key (TWOFISH) */
297
298     } ops_symmetric_key_algorithm_t;
299
300 /** Structure to hold one trust packet's data */
301
302 typedef struct
303     {
304     data_t data;
305     } ops_trust_t;
306        
307 /** Structure to hold one user id */
308 typedef struct
309     {
310     char *                      user_id;        /*!< User ID string */
311     } ops_user_id_t;
312
313 /** Structure to hold one user attribute */
314 typedef struct
315     {
316     data_t data;
317     } ops_user_attribute_t;
318
319 /** Signature Version.
320  * OpenPGP has two different signature versions: version 3 and version 4.
321  *
322  * \see RFC2440bis-12 5.2
323  */
324 typedef enum
325     {
326     OPS_SIG_V3=3,       /*<! Version 3 Signature */
327     OPS_SIG_V4=4,       /*<! Version 4 Signature */
328     } ops_sig_version_t;
329
330 /** Signature Type.
331  * OpenPGP defines different signature types that allow giving different meanings to signatures.  Signature types
332  * include 0x10 for generitc User ID certifications (used when Ben signs Weasel's key), Subkey binding signatures,
333  * document signatures, key revocations, etc.
334  *
335  * Different types are used in different places, and most make only sense in their intended location (for instance a
336  * subkey binding has no place on a UserID).
337  *
338  * \see RFC2440bis-12 5.2.1
339  */
340 typedef enum
341     {
342     OPS_SIG_BINARY      =0x00,  /*<! Signature of a binary document */
343     OPS_SIG_TEXT        =0x01,  /*<! Signature of a canonical text document */
344     OPS_SIG_STANDALONE  =0x02,  /*<! Standalone signature */
345
346     OPS_CERT_GENERIC    =0x10,  /*<! Generic certification of a User ID and Public Key packet */
347     OPS_CERT_PERSONA    =0x11,  /*<! Persona certification of a User ID and Public Key packet */
348     OPS_CERT_CASUAL     =0x12,  /*<! Casual certification of a User ID and Public Key packet */
349     OPS_CERT_POSITIVE   =0x13,  /*<! Positive certification of a User ID and Public Key packet */
350
351     OPS_SIG_SUBKEY      =0x18,  /*<! Subkey Binding Signature */
352     OPS_SIG_PRIMARY     =0x19,  /*<! Primary Key Binding Signature */
353     OPS_SIG_DIRECT      =0x1f,  /*<! Signature directly on a key */
354
355     OPS_SIG_REV_KEY     =0x20,  /*<! Key revocation signature */
356     OPS_SIG_REV_SUBKEY  =0x28,  /*<! Subkey revocation signature */
357     OPS_SIG_REV_CERT    =0x30,  /*<! Certification revocation signature */
358
359     OPS_SIG_TIMESTAMP   =0x40,  /*<! Timestamp signature */
360
361     OPS_SIG_3RD_PARTY   =0x50,  /*<! Third-Party Confirmation signature */
362     } ops_sig_type_t;
363
364 /** Hashing Algorithm Numbers.
365  * OpenPGP assigns a unique Algorithm Number to each algorithm that is part of OpenPGP.
366  *
367  * This lists algorithm numbers for hash algorithms.
368  *
369  * \see RFC2440bis-12 9.4
370  */
371 typedef enum
372     {
373     OPS_HASH_MD5        = 1,    /*!< MD5 */
374     OPS_HASH_SHA1       = 2,    /*!< SHA-1 */
375     OPS_HASH_RIPEMD     = 3,    /*!< RIPEMD160 */
376
377     OPS_HASH_SHA256     = 8,    /*!< SHA256 */
378     OPS_HASH_SHA384     = 9,    /*!< SHA384 */
379     OPS_HASH_SHA512     =10,    /*!< SHA512 */
380     } ops_hash_algorithm_t;
381
382 /** Struct to hold parameters of an RSA signature */
383 typedef struct
384     {
385     BIGNUM                      *sig;   /*!< the signature value (m^d % n) */
386     } ops_rsa_signature_t;
387
388 /** Struct to hold parameters of a DSA signature */
389 typedef struct
390     {
391     BIGNUM                      *r;     /*!< DSA value r */
392     BIGNUM                      *s;     /*!< DSA value s */
393     } ops_dsa_signature_t;
394
395 /** Union to hold signature parameters of any algorithm */
396 typedef union
397     {
398     ops_rsa_signature_t         rsa;    /*!< An RSA Signature */
399     ops_dsa_signature_t         dsa;    /*!< A DSA Signature */
400     } ops_signature_union_t;
401
402 /** Struct to hold a signature packet.
403  *
404  * \see RFC2440bis-12 5.2.2
405  * \see RFC2440bis-12 5.2.3
406  */
407 #define OPS_KEY_ID_SIZE         8
408 typedef struct
409     {
410     ops_sig_version_t           version;        /*!< signature version number */
411     ops_sig_type_t              type;           /*!< signature type value */
412     time_t                      creation_time;  /*!< creation time of the signature - only with v3 signatures*/
413     unsigned char               signer_id[OPS_KEY_ID_SIZE];     /*!< Eight-octet key ID of signer*/
414     ops_public_key_algorithm_t  key_algorithm;  /*!< public key algorithm number */
415     ops_hash_algorithm_t        hash_algorithm; /*!< hashing algorithm number */
416     unsigned char               hash2[2];       /*!< high 2 bytes of hashed value - for quick test */
417     ops_signature_union_t       signature;      /*!< signature parameters */
418     size_t                      v4_hashed_data_start; // only valid if accumulate is set
419     size_t                      v4_hashed_data_length;
420     } ops_signature_t;
421
422 /** The raw bytes of a signature subpacket */
423
424 typedef struct
425     {
426     ops_content_tag_t           tag;
427     size_t                      length;
428     unsigned char               *raw;
429     } ops_ss_raw_t;
430
431 /** Signature Subpacket Type 5, Trust Level */
432
433 typedef struct
434     {
435     unsigned char               level;
436     unsigned char               amount;
437     } ops_ss_trust_t;
438
439 typedef struct
440         {
441         ops_boolean_t   revocable;
442         } ops_ss_revocable_t;
443        
444 typedef struct
445     {
446     time_t                      time;
447     } ops_ss_time_t;
448
449 typedef struct
450     {
451     unsigned char               key_id[OPS_KEY_ID_SIZE];
452     } ops_ss_key_id_t;
453
454 typedef struct
455     {
456     data_t flags;
457     data_t name;
458     data_t value;
459     } ops_ss_notation_data_t;
460
461 typedef struct
462     {
463     data_t data;
464     } ops_ss_userdefined_t;
465
466 typedef struct
467     {
468     data_t data;
469     /* Note that value 0 may represent the plaintext algorithm
470        so we cannot expect data->contents to be a null-terminated list */
471     } ops_ss_preferred_ska_t;
472
473 typedef struct
474     {
475     data_t data;
476     } ops_ss_preferred_hash_t;
477
478 typedef struct
479     {
480     data_t data;
481     } ops_ss_preferred_compression_t;
482
483 typedef struct
484     {
485     data_t data;
486     } ops_ss_key_flags_t;
487
488 typedef struct
489     {
490     data_t data;
491     } ops_ss_key_server_prefs_t;
492
493 typedef struct
494     {
495     data_t data;
496     } ops_ss_features_t;
497
498 typedef struct
499     {
500     size_t                      length;
501     unsigned char               *raw;
502     } ops_packet_t;
503
504 typedef enum
505     {
506     OPS_C_NONE=0,
507     OPS_C_ZIP=1,
508     OPS_C_ZLIB=2,
509     OPS_C_BZIP2=3,
510     } ops_compression_type_t;
511
512 // unlike most structures, this will feed its data as a stream
513 // to the application instead of directly including it
514 typedef struct
515     {
516     ops_compression_type_t      type;
517     } ops_compressed_t;
518
519 typedef struct
520     {
521     unsigned char               version;
522     ops_sig_type_t              sig_type;
523     ops_hash_algorithm_t        hash_algorithm;
524     ops_public_key_algorithm_t  key_algorithm;
525     unsigned char               keyid[OPS_KEY_ID_SIZE];
526     ops_boolean_t               nested;
527     } ops_one_pass_signature_t;
528
529 typedef struct
530     {
531     ops_boolean_t       primary_user_id;
532     } ops_ss_primary_user_id_t;
533
534 typedef struct
535     {
536     char *text;
537     } ops_ss_regexp_t;
538
539 typedef struct
540     {
541     char *text;
542     } ops_ss_policy_url_t;
543
544 typedef struct
545     {
546     char *text;
547     } ops_ss_preferred_key_server_t;
548
549 typedef struct
550     {
551     unsigned char       class;
552     unsigned char       algid;
553     unsigned char fingerprint[20];
554     } ops_ss_revocation_key_t;
555
556 typedef struct
557     {
558     unsigned char code;
559     char *text;
560     } ops_ss_revocation_reason_t;
561
562 typedef enum
563     {
564     OPS_LDT_BINARY='b',
565     OPS_LDT_TEXT='t',
566     OPS_LDT_UTF8='u',
567     OPS_LDT_LOCAL='l',
568     OPS_LDT_LOCAL2='1'
569     } literal_data_type_t;
570
571 typedef struct
572     {
573     literal_data_type_t         format;
574     char                        filename[256];
575     time_t                      modification_time;
576     } ops_literal_data_header_t;
577
578 typedef struct
579     {
580     size_t                      length;
581     unsigned char               data[8192];
582     } ops_literal_data_body_t;
583
584 typedef union
585     {
586     ops_parser_error_t          error;
587     ops_ptag_t                  ptag;
588     ops_public_key_t            public_key;
589     ops_trust_t                 trust;
590     ops_user_id_t               user_id;
591     ops_user_attribute_t        user_attribute;
592     ops_signature_t             signature;
593     ops_ss_raw_t                ss_raw;
594     ops_ss_trust_t              ss_trust;
595     ops_ss_revocable_t          ss_revocable;
596     ops_ss_time_t               ss_time;
597     ops_ss_key_id_t             ss_issuer_key_id;
598     ops_ss_notation_data_t      ss_notation_data;
599     ops_packet_t                packet;
600     ops_compressed_t            compressed;
601     ops_one_pass_signature_t    one_pass_signature;
602     ops_ss_preferred_ska_t      ss_preferred_ska;
603     ops_ss_preferred_hash_t     ss_preferred_hash;
604     ops_ss_preferred_compression_t     ss_preferred_compression;
605     ops_ss_key_flags_t          ss_key_flags;
606     ops_ss_key_server_prefs_t   ss_key_server_prefs;
607     ops_ss_primary_user_id_t    ss_primary_user_id;
608     ops_ss_regexp_t             ss_regexp;
609     ops_ss_policy_url_t         ss_policy_url;
610     ops_ss_preferred_key_server_t       ss_preferred_key_server;
611     ops_ss_revocation_key_t     ss_revocation_key;
612     ops_ss_userdefined_t        ss_userdefined;
613     ops_literal_data_header_t   literal_data_header;
614     ops_literal_data_body_t     literal_data_body;
615     ops_ss_features_t           ss_features;
616     ops_ss_revocation_reason_t  ss_revocation_reason;
617     } ops_parser_content_union_t;
618
619 struct ops_parser_content_t
620     {
621     ops_content_tag_t           tag;
622     unsigned char               critical; /* for signature subpackets */
623     ops_parser_content_union_t  content;
624     };
625
626 typedef struct
627     {
628     unsigned char               fingerprint[20];
629     unsigned                    length;
630     } ops_fingerprint_t;
631
632 void ops_init(void);
633 void ops_finish(void);
634 void ops_keyid(unsigned char keyid[OPS_KEY_ID_SIZE],
635                const ops_public_key_t *key);
636 void ops_fingerprint(ops_fingerprint_t *fp,const ops_public_key_t *key);
637 void ops_public_key_free(ops_public_key_t *key);
638 void ops_user_id_free(ops_user_id_t *id);
639 void ops_user_attribute_free(ops_user_attribute_t *att);
640 void ops_signature_free(ops_signature_t *sig);
641 void ops_trust_free(ops_trust_t * trust);
642 void ops_ss_preferred_ska_free(ops_ss_preferred_ska_t *ss_preferred_ska);
643 void ops_ss_preferred_hash_free(ops_ss_preferred_hash_t *ss_preferred_hash);
644 void ops_ss_preferred_compression_free(ops_ss_preferred_compression_t *ss_preferred_compression);
645 void ops_ss_key_flags_free(ops_ss_key_flags_t * ss_key_flags);
646 void ops_ss_key_server_prefs_free(ops_ss_key_server_prefs_t * ss_key_server_prefs);
647 void ops_ss_features_free(ops_ss_features_t * ss_features);
648 void ops_ss_notation_data_free(ops_ss_notation_data_t *ss_notation_data);
649 void ops_ss_policy_url_free(ops_ss_policy_url_t *ss_policy_url);
650 void ops_ss_preferred_key_server_free(ops_ss_preferred_key_server_t *ss_preferred_key_server);
651 void ops_ss_regexp_free(ops_ss_regexp_t *ss_regexp);
652 void ops_ss_userdefined_free(ops_ss_userdefined_t *ss_userdefined);
653 void ops_ss_revocation_reason_free(ops_ss_revocation_reason_t *ss_revocation_reason);
654 void ops_packet_free(ops_packet_t *packet);
655 void ops_parser_content_free(ops_parser_content_t *c);
656
657 /* vim:set textwidth=120: */
658 /* vim:set ts=8: */
659
660 #endif
661
Note: See TracBrowser for help on using the browser.