Changeset 59

Show
Ignore:
Timestamp:
04/20/05 17:47:26
Author:
rachel
Message:

"Preferred Symmetric Algorithm" signature sub-packet now displayed
plus minor typos

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/src/packet-dump.c

    r58 r59  
    2626    { 
    2727    const ops_parser_content_union_t *content=&content_->content; 
    28  
     28        int i=0;        /* loop counter */ 
     29         
    2930    switch(content_->tag) 
    3031        { 
     
    137138        break; 
    138139 
     140    case OPS_PTAG_SS_PREFERRED_SKA: 
     141    printf("  preferred symmetric algorithms="); 
     142    for (i=0; i<content->ss_preferred_ska.len; i++) { 
     143        switch (content->ss_preferred_ska.data[i]) { 
     144                case OPS_SKA_PLAINTEXT: 
     145                        printf("Plaintext "); 
     146                        break; 
     147                case OPS_SKA_IDEA: 
     148                        printf("IDEA "); 
     149                        break; 
     150                case OPS_SKA_TRIPLEDES: 
     151                        printf("TripleDES "); 
     152                        break; 
     153                case OPS_SKA_CAST5: 
     154                        printf("CAST5 "); 
     155                        break; 
     156                case OPS_SKA_BLOWFISH: 
     157                        printf("Blowfish "); 
     158                        break; 
     159                case OPS_SKA_AES_128: 
     160                        printf("AES(128-bit) "); 
     161                        break; 
     162                case OPS_SKA_AES_192: 
     163                        printf("AES(192-bit) "); 
     164                        break; 
     165                case OPS_SKA_AES_256: 
     166                        printf("AES(256-bit) "); 
     167                        break; 
     168                case OPS_SKA_TWOFISH: 
     169                        printf("Twofish "); 
     170                        break; 
     171                default: 
     172                        printf("Unknown SKA: %d ",content->ss_preferred_ska.data[i]); 
     173        } 
     174    } 
     175        printf ("\n"); 
     176        break; 
     177     
    139178    default: 
    140179        fprintf(stderr,"unknown tag=%d\n",content_->tag); 
  • openpgpsdk/trunk/src/packet-parse.c

    r55 r59  
    1717# include <dmalloc.h> 
    1818#endif 
    19  
     19  
    2020static void init_subregion(ops_region_t *subregion,ops_region_t *region) 
    2121    { 
     
    177177/** Read a scalar. 
    178178 * 
    179  * Read a Big Endian scalar of length bytes, respecing packet boundaries (by calling #limited_read to read the raw 
     179 * Read a Big Endian scalar of length bytes, respecting packet boundaries (by calling #limited_read to read the raw 
    180180 * data). 
    181181 * 
     
    684684        break; 
    685685 
     686    case OPS_PTAG_SS_PREFERRED_SKA: 
     687        /* should this be malloc-ed? or done as fixed array? 
     688         * use fixed arraysize for now. Ben? - Rachel */ 
     689 
     690                C.ss_preferred_ska.len = subregion.length - subregion.length_read;        
     691                if (!ops_limited_read(C.ss_preferred_ska.data, 
     692                        C.ss_preferred_ska.len, &subregion, opt)) 
     693                        return 0; 
     694                break; 
     695                                 
    686696    default: 
    687697        if(opt->ss_parsed[t8]&t7) 
  • openpgpsdk/trunk/src/packet-parse.h

    r55 r59  
    6565    OPS_PARSE_RAW, 
    6666    OPS_PARSE_PARSED, 
    67     OPS_PARSE_IGNORE 
     67    OPS_PARSE_IGNORE  
    6868    }; 
    6969 
  • openpgpsdk/trunk/src/packet.h

    r55 r59  
    144144    OPS_PTAG_SS_EXPIRATION_TIME         =0x200+3,       /*!< signature expiration time */ 
    145145    OPS_PTAG_SS_TRUST                   =0x200+5,       /*!< trust signature */ 
     146    OPS_PTAG_SS_PREFERRED_SKA = 0x200+11,       /*!< preferred symmetric algorithms */ 
    146147    OPS_PTAG_SS_ISSUER_KEY_ID           =0x200+16, 
    147148    }; 
     
    171172 * OpenPGP assigns a unique Algorithm Number to each algorithm that is part of OpenPGP. 
    172173 * 
    173  * This lists algorith numbers for public key algorithms. 
     174 * This lists algorithm numbers for public key algorithms. 
    174175 *  
    175176 * \see RFC2440bis-12 9.1 
     
    225226    } ops_public_key_union_t; 
    226227 
    227 /** Struture to hold one pgp public key */ 
     228/** Structure to hold one pgp public key */ 
    228229typedef struct 
    229230    { 
     
    238239    } ops_public_key_t; 
    239240 
    240 /** Struture to hold one user id */ 
     241/** Symmetric Key Algorithm Numbers. 
     242 * OpenPGP assigns a unique Algorithm Number to each algorithm that is part of OpenPGP. 
     243 * 
     244 * This lists algorithm numbers for symmetric key algorithms. 
     245 *  
     246 * \see RFC2440bis-12 9.2 
     247 */ 
     248typedef enum 
     249    { 
     250    OPS_SKA_PLAINTEXT                   =0,     /*!< Plaintext or unencrypted data */ 
     251    OPS_SKA_IDEA                                =1, /*!< IDEA */ 
     252    OPS_SKA_TRIPLEDES                   =2, /*!< TripleDES */ 
     253    OPS_SKA_CAST5                               =3, /*!< CAST5 */ 
     254    OPS_SKA_BLOWFISH                    =4, /*!< Blowfish */ 
     255    OPS_SKA_AES_128                             =7, /*!< AES with 128-bit key (AES) */ 
     256    OPS_SKA_AES_192                             =8, /*!< AES with 192-bit key */ 
     257    OPS_SKA_AES_256                             =9, /*!< AES with 256-bit key */ 
     258    OPS_SKA_TWOFISH                             =10, /*!< Twofish with 256-bit key (TWOFISH) */ 
     259 
     260    } ops_symmetric_key_algorithm_t; 
     261 
     262/** Structure to hold one user id */ 
    241263typedef struct 
    242264    { 
     
    292314 * OpenPGP assigns a unique Algorithm Number to each algorithm that is part of OpenPGP. 
    293315 *  
    294  * This lists algorith numbers for hash algorithms. 
    295  * 
    296  * \see RFC2440bis-12 9.1 
     316 * This lists algorithm numbers for hash algorithms. 
     317 * 
     318 * \see RFC2440bis-12 9.4 
    297319 */ 
    298320typedef enum 
     
    373395    unsigned char               key_id[OPS_KEY_ID_SIZE]; 
    374396    } ops_ss_key_id_t; 
     397 
     398/* MAX PREFERRED ALGORITHMS is defined to provide an upper bound 
     399 * on the size of array to be used to stored the array given in the 
     400 * Preferred Symmetric Algorithms signature sub-packet. 
     401 * The value has been arbitrarily chosen to allow for an array 
     402 * which includes each SKA currently defined in rfc2440bis 
     403 */ 
     404 
     405#define MAX_PREFERRED_SKA 22 
     406typedef struct 
     407        { 
     408                size_t  len;    /* must use a length field in structure to  
     409                                                        determine where the algorithms stop.  
     410                                                        The value 0 may represent the plaintext algorithm 
     411                                                        so we cannot expect a null-terminated list */ 
     412                unsigned char data[MAX_PREFERRED_SKA]; 
     413        } ops_ss_preferred_ska_t; 
    375414 
    376415typedef struct 
     
    419458    ops_compressed_t            compressed; 
    420459    ops_one_pass_signature_t    one_pass_signature; 
     460    ops_ss_preferred_ska_t      ss_preferred_ska; 
    421461    } ops_parser_content_union_t; 
    422462