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