root/openpgpsdk/trunk/src/packet.h

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

SS Revocation Reason added

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