src/cryptotech.h
author Volker Birk <vb@pep-project.org>
Mon, 20 Apr 2015 15:59:13 +0200
changeset 200 06655f7634a6
parent 62 ad5e484720e1
child 201 79bb3ac04b41
permissions -rw-r--r--
renew_key fixed
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@200
    56
typedef PEP_STATUS (*renew_key_t)(PEP_SESSION session, const char *key_id);
vb@200
    57
vb@200
    58
typedef PEP_STATUS (*revoke_key_t)(PEP_SESSION session, const char *key_id);
vb@200
    59
vb@23
    60
typedef struct _PEP_cryptotech_t {
vb@23
    61
    uint8_t id;
vb@24
    62
    // the following are default values; comm_type may vary with key length or b0rken crypto
vb@24
    63
    uint8_t unconfirmed_comm_type;
vb@24
    64
    uint8_t confirmed_comm_type;
vb@23
    65
    decrypt_and_verify_t decrypt_and_verify;
vb@23
    66
    verify_text_t verify_text;
vb@23
    67
    encrypt_and_sign_t encrypt_and_sign;
vb@24
    68
    delete_keypair_t delete_keypair;
vb@24
    69
    export_key_t export_key;
vb@24
    70
    find_keys_t find_keys;
vb@24
    71
    generate_keypair_t generate_keypair;
vb@24
    72
    get_key_rating_t get_key_rating;
vb@24
    73
    import_key_t import_key;
vb@24
    74
    recv_key_t recv_key;
vb@24
    75
    send_key_t send_key;
vb@200
    76
    renew_key_t renew_key;
vb@200
    77
    revoke_key_t revoke_key;
vb@23
    78
} PEP_cryptotech_t;
vb@23
    79
vb@23
    80
typedef uint64_t cryptotech_mask;
vb@28
    81
vb@62
    82
PEP_STATUS init_cryptotech(PEP_SESSION session, bool in_first);
vb@62
    83
void release_cryptotech(PEP_SESSION session, bool out_last);