src/cryptotech.h
author vb
Sun, 08 Feb 2015 11:33:04 -0500
changeset 48 9ff5d2dfa75a
parent 28 7fc9fc3e680c
child 62 ad5e484720e1
permissions -rw-r--r--
...
     1 #pragma once
     2 
     3 #include "pEpEngine.h"
     4 
     5 typedef enum _PEP_cryptotech {
     6     PEP_crypt_none = 0,
     7     PEP_crypt_OpenPGP,
     8     //    PEP_ctypt_PEP,
     9     //    PEP_crypt_SMIME,
    10     //    PEP_crypt_CMS,
    11 
    12     PEP_crypt__count
    13 } PEP_cryptotech;
    14 
    15 typedef PEP_STATUS (*decrypt_and_verify_t)(
    16         PEP_SESSION session, const char *ctext, size_t csize,
    17         char **ptext, size_t *psize, stringlist_t **keylist
    18     );
    19 
    20 typedef PEP_STATUS (*verify_text_t)(
    21         PEP_SESSION session, const char *text, size_t size,
    22         const char *signature, size_t sig_size, stringlist_t **keylist
    23     );
    24 
    25 typedef PEP_STATUS (*encrypt_and_sign_t)(
    26         PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
    27         size_t psize, char **ctext, size_t *csize
    28     );
    29 
    30 typedef PEP_STATUS (*delete_keypair_t)(PEP_SESSION session, const char *fpr);
    31 
    32 typedef PEP_STATUS (*export_key_t)(
    33         PEP_SESSION session, const char *fpr, char **key_data, size_t *size
    34     );
    35 
    36 typedef PEP_STATUS (*find_keys_t)(
    37         PEP_SESSION session, const char *pattern, stringlist_t **keylist
    38     );
    39 
    40 typedef PEP_STATUS (*generate_keypair_t)(
    41         PEP_SESSION session, pEp_identity *identity
    42     );
    43 
    44 typedef PEP_STATUS (*get_key_rating_t)(
    45         PEP_SESSION session,
    46         const char *fpr,
    47         PEP_comm_type *comm_type
    48     );
    49 
    50 typedef PEP_STATUS (*import_key_t)(PEP_SESSION session, const char *key_data, size_t size);
    51 
    52 typedef PEP_STATUS (*recv_key_t)(PEP_SESSION session, const char *pattern);
    53 
    54 typedef PEP_STATUS (*send_key_t)(PEP_SESSION session, const char *pattern);
    55 
    56 typedef struct _PEP_cryptotech_t {
    57     uint8_t id;
    58     // the following are default values; comm_type may vary with key length or b0rken crypto
    59     uint8_t unconfirmed_comm_type;
    60     uint8_t confirmed_comm_type;
    61     decrypt_and_verify_t decrypt_and_verify;
    62     verify_text_t verify_text;
    63     encrypt_and_sign_t encrypt_and_sign;
    64     delete_keypair_t delete_keypair;
    65     export_key_t export_key;
    66     find_keys_t find_keys;
    67     generate_keypair_t generate_keypair;
    68     get_key_rating_t get_key_rating;
    69     import_key_t import_key;
    70     recv_key_t recv_key;
    71     send_key_t send_key;
    72 } PEP_cryptotech_t;
    73 
    74 typedef uint64_t cryptotech_mask;
    75 
    76 PEP_STATUS init_cryptotech(PEP_SESSION session);
    77 void release_cryptotech(PEP_SESSION session);