src/pgp_gpg.h
author Krista Bennett <krista@pep-project.org>
Mon, 12 Nov 2018 08:35:57 +0100
branchENGINE-479
changeset 3131 44dbae32fe45
parent 2978 2b16aa31c35b
child 3137 93877eafa715
permissions -rw-r--r--
ENGINE-479: initial impl
vb@1513
     1
// This file is under GNU General Public License 3.0
vb@1513
     2
// see LICENSE.txt
vb@1513
     3
vb@24
     4
#pragma once
vb@24
     5
vb@24
     6
#include "pEpEngine.h"
vb@24
     7
vb@62
     8
PEP_STATUS pgp_init(PEP_SESSION session, bool in_first);
vb@62
     9
void pgp_release(PEP_SESSION session, bool out_last);
vb@24
    10
vb@24
    11
PEP_STATUS pgp_decrypt_and_verify(
vb@49
    12
        PEP_SESSION session, const char *ctext, size_t csize,
krista@1397
    13
        const char *dsigtext, size_t dsigsize,
krista@2978
    14
        char **ptext, size_t *psize, stringlist_t **keylist,
krista@2978
    15
        char** filename_ptr
vb@24
    16
    );
vb@24
    17
vb@24
    18
PEP_STATUS pgp_encrypt_and_sign(
vb@49
    19
        PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
vb@49
    20
        size_t psize, char **ctext, size_t *csize
vb@24
    21
    );
vb@24
    22
krista@1639
    23
PEP_STATUS pgp_encrypt_only(
krista@1639
    24
        PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
krista@1639
    25
        size_t psize, char **ctext, size_t *csize
krista@1639
    26
    );
krista@1639
    27
krista@3131
    28
PEP_STATUS pgp_sign_only(
krista@3131
    29
        PEP_SESSION session, const char* fpr, const char *ptext,
krista@3131
    30
        size_t psize, char **stext, size_t *ssize
krista@3131
    31
    );
krista@1639
    32
vb@24
    33
PEP_STATUS pgp_verify_text(
vb@49
    34
        PEP_SESSION session, const char *text, size_t size,
vb@49
    35
        const char *signature, size_t sig_size, stringlist_t **keylist
vb@24
    36
    );
vb@24
    37
vb@24
    38
PEP_STATUS pgp_delete_keypair(PEP_SESSION session, const char *fpr);
vb@24
    39
Edouard@170
    40
PEP_STATUS pgp_export_keydata(
vb@1103
    41
        PEP_SESSION session, const char *fpr, char **key_data, size_t *size,
vb@1103
    42
        bool secret
vb@24
    43
    );
vb@24
    44
vb@24
    45
PEP_STATUS pgp_find_keys(
vb@49
    46
        PEP_SESSION session, const char *pattern, stringlist_t **keylist
vb@24
    47
    );
vb@24
    48
krista@1030
    49
PEP_STATUS pgp_list_keyinfo(
vb@2429
    50
        PEP_SESSION session, const char* pattern, stringpair_list_t** keyinfo_list
krista@1030
    51
    );
krista@1030
    52
vb@24
    53
PEP_STATUS pgp_generate_keypair(
vb@49
    54
        PEP_SESSION session, pEp_identity *identity
vb@24
    55
    );
vb@24
    56
vb@24
    57
PEP_STATUS pgp_get_key_rating(
vb@74
    58
        PEP_SESSION session,
vb@74
    59
        const char *fpr,
vb@74
    60
        PEP_comm_type *comm_type
vb@24
    61
    );
vb@24
    62
Edouard@170
    63
PEP_STATUS pgp_import_keydata(PEP_SESSION session, const char *key_data,
Edouard@728
    64
                              size_t size, identity_list **private_idents);
Edouard@728
    65
Edouard@728
    66
PEP_STATUS pgp_import_private_keydata(PEP_SESSION session, const char *key_data,
Edouard@728
    67
                                      size_t size, identity_list **private_idents);
vb@24
    68
vb@24
    69
PEP_STATUS pgp_recv_key(PEP_SESSION session, const char *pattern);
vb@200
    70
PEP_STATUS pgp_send_key(PEP_SESSION session, const char *pattern);
vb@201
    71
vb@201
    72
PEP_STATUS pgp_renew_key(
vb@201
    73
        PEP_SESSION session,
vb@201
    74
        const char *fpr,
vb@201
    75
        const timestamp *ts
vb@201
    76
    );
vb@201
    77
vb@211
    78
PEP_STATUS pgp_revoke_key(
vb@211
    79
        PEP_SESSION session,
vb@211
    80
        const char *fpr,
vb@211
    81
        const char *reason
vb@211
    82
    );
vb@24
    83
vb@214
    84
PEP_STATUS pgp_key_expired(
vb@214
    85
        PEP_SESSION session,
vb@214
    86
        const char *fpr,
Edouard@701
    87
        const time_t when,
vb@214
    88
        bool *expired
vb@214
    89
    );
vb@214
    90
Edouard@662
    91
PEP_STATUS pgp_key_revoked(
Edouard@662
    92
        PEP_SESSION session,
Edouard@662
    93
        const char *fpr,
Edouard@662
    94
        bool *revoked
Edouard@662
    95
    );
Edouard@662
    96
vb@958
    97
PEP_STATUS pgp_key_created(
vb@958
    98
        PEP_SESSION session,
vb@958
    99
        const char *fpr,
vb@958
   100
        time_t *created
vb@958
   101
    );
vb@958
   102
krista@1357
   103
PEP_STATUS pgp_contains_priv_key(
krista@1357
   104
        PEP_SESSION session, 
krista@1357
   105
        const char *fpr,
krista@1357
   106
        bool *has_private);
krista@1357
   107
krista@1357
   108
PEP_STATUS pgp_find_private_keys(
krista@1357
   109
    PEP_SESSION session, const char *pattern, stringlist_t **keylist
krista@1357
   110
);
krista@1357
   111
vb@507
   112
PEP_STATUS pgp_binary(const char **path);
krista@1924
   113
krista@2458
   114
// Returns first failure status, if there were any. Keys may have been
krista@2458
   115
// imported into DB regardless of status.
krista@2458
   116
PEP_STATUS pgp_import_ultimately_trusted_keypairs(PEP_SESSION session);
krista@2458
   117
krista@1924
   118
/* Really only internal. */
krista@1924
   119
PEP_STATUS pgp_replace_only_uid(
krista@1924
   120
        PEP_SESSION session,
krista@1924
   121
        const char* fpr,
krista@1924
   122
        const char* realname,
krista@1924
   123
        const char* email
krista@1924
   124
    );
krista@1924
   125
vb@507
   126
#define PGP_BINARY_PATH pgp_binary