src/pEpEngine.h
author Volker Birk <vb@pep.foundation>
Thu, 01 Sep 2016 17:54:33 +0200
branchkeysync
changeset 1110 d37d730fa8e5
parent 1109 6be9dc59517d
child 1170 8949bee99bcd
permissions -rw-r--r--
implementing keep_sync_msg flag
vb@23
     1
#pragma once
vb@23
     2
vb@0
     3
#ifdef __cplusplus
vb@0
     4
extern "C" {
vb@0
     5
#endif
vb@0
     6
vb@25
     7
#include <stddef.h>
vb@0
     8
#include <stdint.h>
vb@0
     9
#include <stdbool.h>
vb@0
    10
vb@98
    11
#include "dynamic_api.h"
vb@98
    12
#include "stringlist.h"
krista@1005
    13
#include "stringpair.h"    
vb@201
    14
#include "timestamp.h"
vb@0
    15
krista@942
    16
#define PEP_VERSION "1.0" // protocol version
vb@94
    17
Edouard@658
    18
#define PEP_OWN_USERID "pEp_own_userId"
Edouard@658
    19
    
vb@0
    20
// pEp Engine API
vb@0
    21
vb@0
    22
//  caveat:
vb@0
    23
//      Unicode data has to be normalized to NFC before calling
vb@0
    24
//      UTF-8 strings are UTF-8 encoded C strings (zero terminated)
vb@0
    25
vb@0
    26
vb@46
    27
struct _pEpSession;
vb@46
    28
typedef struct _pEpSession * PEP_SESSION;
vb@0
    29
vb@0
    30
typedef enum {
roker@529
    31
    PEP_STATUS_OK                                   = 0,
vb@0
    32
roker@529
    33
    PEP_INIT_CANNOT_LOAD_GPGME                      = 0x0110,
roker@529
    34
    PEP_INIT_GPGME_INIT_FAILED                      = 0x0111,
roker@529
    35
    PEP_INIT_NO_GPG_HOME                            = 0x0112,
roker@529
    36
    PEP_INIT_NETPGP_INIT_FAILED                     = 0x0113,
vb@0
    37
roker@529
    38
    PEP_INIT_SQLITE3_WITHOUT_MUTEX                  = 0x0120,
roker@529
    39
    PEP_INIT_CANNOT_OPEN_DB                         = 0x0121,
roker@529
    40
    PEP_INIT_CANNOT_OPEN_SYSTEM_DB                  = 0x0122,
roker@529
    41
    
roker@529
    42
    PEP_KEY_NOT_FOUND                               = 0x0201,
roker@529
    43
    PEP_KEY_HAS_AMBIG_NAME                          = 0x0202,
roker@529
    44
    PEP_GET_KEY_FAILED                              = 0x0203,
vb@1103
    45
    PEP_CANNOT_EXPORT_KEY                           = 0x0204,
roker@529
    46
    
roker@529
    47
    PEP_CANNOT_FIND_IDENTITY                        = 0x0301,
roker@529
    48
    PEP_CANNOT_SET_PERSON                           = 0x0381,
roker@529
    49
    PEP_CANNOT_SET_PGP_KEYPAIR                      = 0x0382,
roker@529
    50
    PEP_CANNOT_SET_IDENTITY                         = 0x0383,
vb@370
    51
    PEP_CANNOT_SET_TRUST                            = 0x0384,
vb@515
    52
    PEP_KEY_BLACKLISTED                             = 0x0385,
roker@529
    53
    
roker@529
    54
    PEP_UNENCRYPTED                                 = 0x0400,
roker@529
    55
    PEP_VERIFIED                                    = 0x0401,
roker@529
    56
    PEP_DECRYPTED                                   = 0x0402,
roker@529
    57
    PEP_DECRYPTED_AND_VERIFIED                      = 0x0403,
roker@529
    58
    PEP_DECRYPT_WRONG_FORMAT                        = 0x0404,
roker@529
    59
    PEP_DECRYPT_NO_KEY                              = 0x0405,
roker@529
    60
    PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH            = 0x0406,
vb@0
    61
    PEP_VERIFY_NO_KEY                               = 0x0407,
vb@0
    62
    PEP_VERIFIED_AND_TRUSTED                        = 0x0408,
roker@529
    63
    PEP_CANNOT_DECRYPT_UNKNOWN                      = 0x04ff,
vb@0
    64
roker@529
    65
    PEP_TRUSTWORD_NOT_FOUND                         = 0x0501,
vb@0
    66
vb@0
    67
    PEP_CANNOT_CREATE_KEY                           = 0x0601,
vb@0
    68
    PEP_CANNOT_SEND_KEY                             = 0x0602,
vb@0
    69
vb@458
    70
    PEP_PHRASE_NOT_FOUND                            = 0x0701,
vb@458
    71
vb@690
    72
    PEP_SEND_FUNCTION_NOT_REGISTERED                = 0x0801,
vb@691
    73
    PEP_CONTRAINTS_VIOLATED                         = 0x0802,
vb@691
    74
    PEP_CANNOT_ENCODE                               = 0x0803,
vb@690
    75
vb@884
    76
    PEP_SYNC_NO_TRUSTWORDS_CALLBACK                 = 0x0901,
vb@951
    77
    PEP_SYNC_ILLEGAL_MESSAGE                        = 0x0902,
vb@1105
    78
    PEP_SYNC_NO_INJECT_CALLBACK                     = 0x0903,
vb@934
    79
vb@1085
    80
    PEP_SEQUENCE_VIOLATED                           = 0x0970,
vb@1085
    81
    PEP_CANNOT_INCREASE_SEQUENCE                    = 0x0971,
vb@1087
    82
    PEP_CANNOT_SET_SEQUENCE_VALUE                   = 0x0972,
vb@1087
    83
    PEP_OWN_SEQUENCE                                = 0x097f,
vb@1085
    84
vb@964
    85
    PEP_SYNC_STATEMACHINE_ERROR                     = 0x0980,
vb@1101
    86
    PEP_SYNC_NO_TRUST                               = 0x0981,
vb@964
    87
    PEP_STATEMACHINE_INVALID_STATE                  = 0x0982,
vb@964
    88
    PEP_STATEMACHINE_INVALID_EVENT                  = 0x0983,
vb@964
    89
    PEP_STATEMACHINE_INVALID_CONDITION              = 0x0984,
vb@964
    90
    PEP_STATEMACHINE_INVALID_ACTION                 = 0x0985,
vb@884
    91
roker@529
    92
    PEP_COMMIT_FAILED                               = 0xff01,
vb@952
    93
    PEP_MESSAGE_CONSUMED                            = 0xff02,
vb@0
    94
vb@1091
    95
    PEP_RECORD_NOT_FOUND                            = -6,
vb@44
    96
    PEP_CANNOT_CREATE_TEMP_FILE                     = -5,
vb@0
    97
    PEP_ILLEGAL_VALUE                               = -4,
vb@0
    98
    PEP_BUFFER_TOO_SMALL                            = -3,
roker@529
    99
    PEP_OUT_OF_MEMORY                               = -2,
roker@529
   100
    PEP_UNKNOWN_ERROR                               = -1
vb@0
   101
} PEP_STATUS;
vb@0
   102
vb@0
   103
vb@0
   104
// INIT_STATUS init() - initialize pEpEngine for a thread
vb@0
   105
//
vb@0
   106
//  parameters:
roker@529
   107
//        session (out)   init() allocates session memory and returns a pointer
roker@529
   108
//                        as a handle
vb@0
   109
//
vb@0
   110
//  return value:
roker@529
   111
//        PEP_STATUS_OK = 0                 if init() succeeds
roker@529
   112
//        PEP_INIT_SQLITE3_WITHOUT_MUTEX    if SQLite3 was compiled with
roker@529
   113
//                                            SQLITE_THREADSAFE 0
roker@529
   114
//        PEP_INIT_CANNOT_LOAD_GPGME        if libgpgme.dll cannot be found
roker@529
   115
//        PEP_INIT_GPGME_INIT_FAILED        if GPGME init fails
roker@529
   116
//        PEP_INIT_CANNOT_OPEN_DB           if user's management db cannot be
roker@529
   117
//                                            opened
roker@529
   118
//        PEP_INIT_CANNOT_OPEN_SYSTEM_DB    if system's management db cannot be
roker@529
   119
//                                            opened
vb@0
   120
//
vb@0
   121
//  caveat:
vb@0
   122
//      the pointer is valid only if the return value is PEP_STATUS_OK
vb@0
   123
//      in other case a NULL pointer will be returned; a valid handle must
vb@0
   124
//      be released using release() when it's no longer needed
vb@62
   125
//
vb@62
   126
//      the caller has to guarantee that the first call to this function
vb@62
   127
//      will succeed before further calls can be done
vb@0
   128
vb@0
   129
DYNAMIC_API PEP_STATUS init(PEP_SESSION *session);
vb@0
   130
vb@0
   131
vb@0
   132
// void release() - release thread session handle
vb@0
   133
//
vb@0
   134
//  parameters:
roker@529
   135
//        session (in)    session handle to release
vb@62
   136
//
roker@529
   137
//    caveat:
roker@529
   138
//        the last release() can be called only when all other release() calls
roker@529
   139
//        are done
vb@0
   140
vb@0
   141
DYNAMIC_API void release(PEP_SESSION session);
vb@0
   142
vb@0
   143
vb@464
   144
// config_passive_mode() - enable passive mode
vb@464
   145
//
vb@464
   146
//  parameters:
vb@464
   147
//      session (in)    session handle
vb@467
   148
//      enable (in)     flag if enabled or disabled
vb@464
   149
vb@467
   150
DYNAMIC_API void config_passive_mode(PEP_SESSION session, bool enable);
vb@467
   151
vb@467
   152
vb@553
   153
// config_unencrypted_subject() - disable subject encryption
vb@467
   154
//
vb@467
   155
//  parameters:
vb@467
   156
//      session (in)    session handle
vb@467
   157
//      enable (in)     flag if enabled or disabled
vb@467
   158
vb@467
   159
DYNAMIC_API void config_unencrypted_subject(PEP_SESSION session, bool enable);
vb@464
   160
vb@464
   161
Edouard@721
   162
// config_use_only_own_private_keys() - enable passive mode
Edouard@721
   163
//
Edouard@721
   164
//  parameters:
Edouard@721
   165
//      session (in)    session handle
Edouard@721
   166
//      enable (in)     flag if enabled or disabled
Edouard@721
   167
Edouard@721
   168
DYNAMIC_API void config_use_only_own_private_keys(PEP_SESSION session, bool enable);
Edouard@721
   169
Edouard@721
   170
vb@1110
   171
// config_keep_sync_msg() - do not remove sync messages (for debugging purposes)
vb@1109
   172
//
vb@1109
   173
//      session (in)    session handle
vb@1109
   174
//      enable (in)     flag if enabled or disabled
vb@1109
   175
vb@1110
   176
DYNAMIC_API void config_keep_sync_msg(PEP_SESSION session, bool enable);
vb@1109
   177
vb@1109
   178
vb@0
   179
// decrypt_and_verify() - decrypt and/or verify a message
vb@0
   180
//
roker@529
   181
//    parameters:
roker@529
   182
//        session (in)    session handle
roker@529
   183
//        ctext (in)      cipher text to decrypt and/or verify
roker@529
   184
//        csize (in)      size of cipher text
roker@529
   185
//        ptext (out)     pointer to internal buffer with plain text
roker@529
   186
//        psize (out)     size of plain text
roker@529
   187
//        keylist (out)   list of key ids which where used to encrypt
vb@0
   188
//
roker@529
   189
//    return value:
roker@529
   190
//        PEP_UNENCRYPTED               message was unencrypted and not signed
roker@529
   191
//        PEP_VERIFIED                  message was unencrypted, signature matches
roker@529
   192
//        PEP_DECRYPTED                 message is decrypted now, no signature
roker@529
   193
//        PEP_DECRYPTED_AND_VERIFIED    message is decrypted now and verified
roker@529
   194
//        PEP_DECRYPT_WRONG_FORMAT      message has wrong format to handle
roker@529
   195
//        PEP_DECRYPT_NO_KEY            key not available to decrypt and/or verify
roker@529
   196
//        PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH    wrong signature
vb@0
   197
//
roker@529
   198
//    caveat:
roker@529
   199
//        the ownerships of ptext as well as keylist are going to the caller
roker@529
   200
//        the caller must use free() (or an Windoze pEp_free()) and
roker@529
   201
//        free_stringlist() to free them
vb@15
   202
//
vb@15
   203
//      if this function failes an error message may be the first element of
vb@15
   204
//      keylist and the other elements may be the keys used for encryption
vb@0
   205
vb@0
   206
DYNAMIC_API PEP_STATUS decrypt_and_verify(
vb@0
   207
        PEP_SESSION session, const char *ctext, size_t csize,
vb@0
   208
        char **ptext, size_t *psize, stringlist_t **keylist
vb@0
   209
    );
vb@0
   210
vb@0
   211
vb@0
   212
// verify_text() - verfy plain text with a digital signature
vb@0
   213
//
vb@0
   214
//  parameters:
vb@0
   215
//      session (in)    session handle
vb@0
   216
//      text (in)       text to verify
vb@0
   217
//      size (in)       size of text
vb@0
   218
//      signature (in)  signature text
vb@0
   219
//      sig_size (in)   size of signature
roker@529
   220
//      keylist (out)   list of key ids which where used to encrypt or NULL on
roker@529
   221
//                        error
vb@0
   222
//
vb@0
   223
//  return value:
roker@529
   224
//        PEP_VERIFIED                message was unencrypted, signature matches
roker@529
   225
//        PEP_DECRYPT_NO_KEY          key not available to decrypt and/or verify
roker@529
   226
//        PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH    wrong signature
vb@0
   227
vb@0
   228
DYNAMIC_API PEP_STATUS verify_text(
vb@0
   229
        PEP_SESSION session, const char *text, size_t size,
vb@0
   230
        const char *signature, size_t sig_size, stringlist_t **keylist
vb@0
   231
    );
vb@0
   232
vb@0
   233
vb@0
   234
// encrypt_and_sign() - encrypt and sign a message
vb@0
   235
//
roker@529
   236
//    parameters:
roker@529
   237
//        session (in)    session handle
roker@529
   238
//        keylist (in)    list of key ids to encrypt with as C strings
roker@529
   239
//        ptext (in)      plain text to decrypt and/or verify
roker@529
   240
//        psize (in)      size of plain text
roker@529
   241
//        ctext (out)     pointer to internal buffer with cipher text
roker@529
   242
//        csize (out)     size of cipher text
vb@0
   243
//
roker@529
   244
//    return value:
roker@529
   245
//        PEP_STATUS_OK = 0            encryption and signing succeeded
roker@529
   246
//        PEP_KEY_NOT_FOUND            at least one of the receipient keys
roker@529
   247
//                                     could not be found
roker@529
   248
//        PEP_KEY_HAS_AMBIG_NAME       at least one of the receipient keys has
roker@529
   249
//                                     an ambiguous name
roker@529
   250
//        PEP_GET_KEY_FAILED           cannot retrieve key
vb@0
   251
//
roker@529
   252
//    caveat:
roker@529
   253
//      the ownership of ctext is going to the caller
vb@0
   254
//      the caller is responsible to free() it (on Windoze use pEp_free())
vb@20
   255
//      the first key in keylist is being used to sign the message
vb@20
   256
//      this implies there has to be a private key for that keypair
vb@0
   257
vb@0
   258
DYNAMIC_API PEP_STATUS encrypt_and_sign(
vb@0
   259
        PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
vb@0
   260
        size_t psize, char **ctext, size_t *csize
vb@0
   261
    );
vb@0
   262
vb@0
   263
vb@0
   264
// log_event() - log a user defined event defined by UTF-8 encoded strings into
vb@0
   265
// management log
vb@0
   266
//
roker@529
   267
//    parameters:
roker@529
   268
//        session (in)        session handle
roker@529
   269
//        title (in)          C string with event name
roker@529
   270
//        entity (in)         C string with name of entity which is logging
roker@529
   271
//        description (in)    C string with long description for event or NULL if
roker@529
   272
//                            omitted
roker@529
   273
//        comment (in)        C string with user defined comment or NULL if
roker@529
   274
//                            omitted
vb@0
   275
//
roker@529
   276
//    return value:
roker@529
   277
//        PEP_STATUS_OK       log entry created
vb@0
   278
vb@0
   279
DYNAMIC_API PEP_STATUS log_event(
vb@450
   280
        PEP_SESSION session,
vb@451
   281
        const char *title,
vb@451
   282
        const char *entity,
vb@451
   283
        const char *description,
vb@451
   284
        const char *comment
vb@0
   285
    );
vb@0
   286
vb@0
   287
vb@233
   288
// trustword() - get the corresponding trustword for a 16 bit value
vb@0
   289
//
roker@529
   290
//    parameters:
roker@529
   291
//        session (in)            session handle
roker@529
   292
//        value (in)              value to find a trustword for
roker@529
   293
//        lang (in)               C string with ISO 639-1 language code
roker@529
   294
//        word (out)              pointer to C string with trustword UTF-8 encoded
roker@529
   295
//                                NULL if language is not supported or trustword
roker@529
   296
//                                wordlist is damaged or unavailable
roker@529
   297
//        wsize (out)             length of trustword
vb@0
   298
//
roker@529
   299
//    return value:
roker@529
   300
//        PEP_STATUS_OK            trustword retrieved
roker@529
   301
//        PEP_TRUSTWORD_NOT_FOUND  trustword not found
vb@0
   302
//
roker@529
   303
//    caveat:
roker@529
   304
//        the word pointer goes to the ownership of the caller
vb@0
   305
//      the caller is responsible to free() it (on Windoze use pEp_free())
vb@0
   306
vb@233
   307
DYNAMIC_API PEP_STATUS trustword(
vb@0
   308
            PEP_SESSION session, uint16_t value, const char *lang,
vb@0
   309
            char **word, size_t *wsize
vb@0
   310
        );
vb@0
   311
vb@0
   312
vb@233
   313
// trustwords() - get trustwords for a string of hex values of a fingerprint
vb@0
   314
//
roker@529
   315
//    parameters:
roker@529
   316
//        session (in)        session handle
roker@529
   317
//        fingerprint (in)    C string with hex values to find trustwords for
roker@529
   318
//        lang (in)           C string with ISO 639-1 language code
roker@529
   319
//        words (out)         pointer to C string with trustwords UTF-8 encoded,
roker@529
   320
//                            separated by a blank each
roker@529
   321
//                            NULL if language is not supported or trustword
roker@529
   322
//                            wordlist is damaged or unavailable
roker@529
   323
//        wsize (out)         length of trustwords string
roker@529
   324
//        max_words (in)      only generate a string with max_words;
roker@529
   325
//                            if max_words == 0 there is no such limit
vb@0
   326
//
roker@529
   327
//    return value:
roker@529
   328
//        PEP_STATUS_OK            trustwords retrieved
roker@529
   329
//        PEP_OUT_OF_MEMORY        out of memory
roker@529
   330
//        PEP_TRUSTWORD_NOT_FOUND  at least one trustword not found
vb@0
   331
//
roker@529
   332
//    caveat:
roker@529
   333
//        the word pointer goes to the ownership of the caller
vb@0
   334
//      the caller is responsible to free() it (on Windoze use pEp_free())
vb@0
   335
//
vb@0
   336
//  DON'T USE THIS FUNCTION FROM HIGH LEVEL LANGUAGES!
vb@0
   337
//
vb@233
   338
//  Better implement a simple one in the adapter yourself using trustword(), and
vb@233
   339
//  return a list of trustwords.
vb@0
   340
//  This function is provided for being used by C and C++ programs only.
vb@0
   341
vb@233
   342
DYNAMIC_API PEP_STATUS trustwords(
vb@0
   343
        PEP_SESSION session, const char *fingerprint, const char *lang,
vb@0
   344
        char **words, size_t *wsize, int max_words
vb@0
   345
    );
vb@0
   346
vb@0
   347
vb@951
   348
// TODO: increase versions in pEp.asn1 if rating changes
vb@951
   349
vb@0
   350
typedef enum _PEP_comm_type {
vb@9
   351
    PEP_ct_unknown = 0,
vb@0
   352
vb@9
   353
    // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
vb@0
   354
vb@9
   355
    PEP_ct_no_encryption = 0x01,                // generic
vb@9
   356
    PEP_ct_no_encrypted_channel = 0x02,
vb@9
   357
    PEP_ct_key_not_found = 0x03,
vb@9
   358
    PEP_ct_key_expired = 0x04,
vb@9
   359
    PEP_ct_key_revoked = 0x05,
vb@9
   360
    PEP_ct_key_b0rken = 0x06,
vb@9
   361
    PEP_ct_my_key_not_included = 0x09,
vb@9
   362
vb@9
   363
    PEP_ct_security_by_obscurity = 0x0a,
vb@9
   364
    PEP_ct_b0rken_crypto = 0x0b,
Edouard@442
   365
    PEP_ct_key_too_short = 0x0c,
vb@9
   366
Edouard@442
   367
    PEP_ct_compromized = 0x0e,                  // known compromized connection
Edouard@442
   368
    PEP_ct_mistrusted = 0x0f,                   // known mistrusted key
vb@0
   369
vb@9
   370
    // range 0x10 to 0x3f: unconfirmed encryption
vb@0
   371
vb@0
   372
    PEP_ct_unconfirmed_encryption = 0x10,       // generic
roker@529
   373
    PEP_ct_OpenPGP_weak_unconfirmed = 0x11,     // RSA 1024 is weak
vb@190
   374
vb@190
   375
    PEP_ct_to_be_checked = 0x20,                // generic
vb@190
   376
    PEP_ct_SMIME_unconfirmed = 0x21,
vb@190
   377
    PEP_ct_CMS_unconfirmed = 0x22,
vb@190
   378
vb@190
   379
    PEP_ct_strong_but_unconfirmed = 0x30,       // generic
vb@122
   380
    PEP_ct_OpenPGP_unconfirmed = 0x38,          // key at least 2048 bit RSA or EC
vb@122
   381
    PEP_ct_OTR_unconfirmed = 0x3a,
vb@0
   382
vb@9
   383
    // range 0x40 to 0x7f: unconfirmed encryption and anonymization
vb@0
   384
vb@0
   385
    PEP_ct_unconfirmed_enc_anon = 0x40,         // generic
lix@710
   386
    PEP_ct_pEp_unconfirmed = 0x7f,
vb@0
   387
vb@9
   388
    PEP_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
vb@9
   389
vb@9
   390
    // range 0x81 to 0x8f: reserved
vb@9
   391
    // range 0x90 to 0xbf: confirmed encryption
vb@0
   392
vb@0
   393
    PEP_ct_confirmed_encryption = 0x90,         // generic
roker@529
   394
    PEP_ct_OpenPGP_weak = 0x91,                 // RSA 1024 is weak
vb@190
   395
vb@190
   396
    PEP_ct_to_be_checked_confirmed = 0xa0,      //generic
vb@190
   397
    PEP_ct_SMIME = 0xa1,
vb@190
   398
    PEP_ct_CMS = 0xa2,
vb@190
   399
vb@190
   400
    PEP_ct_strong_encryption = 0xb0,            // generic
roker@529
   401
    PEP_ct_OpenPGP = 0xb8,                      // key at least 2048 bit RSA or EC
roker@529
   402
    PEP_ct_OTR = 0xba,
vb@0
   403
vb@0
   404
    // range 0xc0 to 0xff: confirmed encryption and anonymization
vb@0
   405
vb@0
   406
    PEP_ct_confirmed_enc_anon = 0xc0,           // generic
roker@529
   407
    PEP_ct_pEp = 0xff
vb@0
   408
} PEP_comm_type;
vb@0
   409
vb@928
   410
typedef enum _identity_flags {
vb@951
   411
    // the first octet flags are app defined settings
vb@934
   412
    PEP_idf_not_for_sync = 1,   // don't use this identity for sync
vb@951
   413
    PEP_idf_list = 2,           // identity of list of persons
vb@945
   414
vb@951
   415
    // the second octet flags are calculated
vb@951
   416
    PEP_idf_devicegroup = 256   // identity of a device group member
vb@928
   417
} identity_flags;
vb@928
   418
vb@944
   419
typedef unsigned int identity_flags_t;
vb@944
   420
vb@0
   421
typedef struct _pEp_identity {
roker@529
   422
    char *address;              // C string with address UTF-8 encoded
roker@529
   423
    char *fpr;                  // C string with fingerprint UTF-8 encoded
roker@529
   424
    char *user_id;              // C string with user ID UTF-8 encoded
roker@529
   425
    char *username;             // C string with user name UTF-8 encoded
roker@529
   426
    PEP_comm_type comm_type;    // type of communication with this ID
roker@529
   427
    char lang[3];               // language of conversation
vb@0
   428
                                // ISO 639-1 ALPHA-2, last byte is 0
vb@0
   429
    bool me;                    // if this is the local user herself/himself
vb@944
   430
    identity_flags_t flags;     // identity_flag1 | identity_flag2 | ...
vb@0
   431
} pEp_identity;
vb@0
   432
Edouard@730
   433
typedef struct _identity_list {
Edouard@730
   434
    pEp_identity *ident;
Edouard@730
   435
    struct _identity_list *next;
Edouard@730
   436
} identity_list;
Edouard@730
   437
vb@0
   438
vb@0
   439
// new_identity() - allocate memory and set the string and size fields
vb@0
   440
//
vb@0
   441
//  parameters:
vb@0
   442
//      address (in)        UTF-8 string or NULL 
vb@0
   443
//      fpr (in)            UTF-8 string or NULL 
vb@0
   444
//      user_id (in)        UTF-8 string or NULL 
vb@0
   445
//      username (in)       UTF-8 string or NULL 
vb@0
   446
//
vb@0
   447
//  return value:
vb@932
   448
//      pEp_identity struct or NULL if out of memory
vb@0
   449
//
vb@0
   450
//  caveat:
vb@0
   451
//      the strings are copied; the original strings are still being owned by
vb@0
   452
//      the caller
vb@0
   453
vb@0
   454
DYNAMIC_API pEp_identity *new_identity(
vb@0
   455
        const char *address, const char *fpr, const char *user_id,
vb@0
   456
        const char *username
vb@0
   457
    );
vb@0
   458
vb@0
   459
vb@932
   460
// identity_dup() - allocate memory and duplicate
vb@37
   461
//
vb@37
   462
//  parameters:
vb@37
   463
//      src (in)            identity to duplicate
vb@37
   464
//
vb@37
   465
//  return value:
vb@932
   466
//      pEp_identity struct or NULL if out of memory
vb@37
   467
//
vb@37
   468
//  caveat:
vb@37
   469
//      the strings are copied; the original strings are still being owned by
vb@37
   470
//      the caller
vb@37
   471
vb@37
   472
DYNAMIC_API pEp_identity *identity_dup(const pEp_identity *src);
vb@37
   473
vb@37
   474
vb@0
   475
// free_identity() - free all memory being occupied by a pEp_identity struct
vb@0
   476
//
vb@0
   477
//  parameters:
vb@0
   478
//      identity (in)       struct to release
vb@0
   479
//
vb@0
   480
//  caveat:
vb@0
   481
//      not only the struct but also all string memory referenced by the
vb@0
   482
//      struct is being freed; all pointers inside are invalid afterwards
vb@0
   483
vb@0
   484
DYNAMIC_API void free_identity(pEp_identity *identity);
vb@0
   485
vb@0
   486
vb@0
   487
// get_identity() - get identity information
vb@0
   488
//
roker@529
   489
//    parameters:
roker@529
   490
//        session (in)        session handle
roker@529
   491
//        address (in)        C string with communication address, UTF-8 encoded
Edouard@562
   492
//        user_id (in)        unique C string to identify person that identity
Edouard@562
   493
//                            is refering to
roker@529
   494
//        identity (out)      pointer to pEp_identity structure with results or
roker@529
   495
//                            NULL if failure
vb@0
   496
//
roker@529
   497
//    caveat:
vb@951
   498
//        address and user_id are being copied; the original strings remains in
vb@951
   499
//        the ownership of the caller
roker@529
   500
//        the resulting pEp_identity structure goes to the ownership of the
roker@529
   501
//        caller and has to be freed with free_identity() when not in use any
roker@529
   502
//        more
vb@0
   503
vb@0
   504
DYNAMIC_API PEP_STATUS get_identity(
Edouard@559
   505
        PEP_SESSION session,
Edouard@559
   506
        const char *address,
Edouard@559
   507
        const char *user_id,
vb@0
   508
        pEp_identity **identity
vb@0
   509
    );
vb@0
   510
vb@0
   511
// set_identity() - set identity information
vb@0
   512
//
roker@529
   513
//    parameters:
roker@529
   514
//        session (in)        session handle
roker@529
   515
//        identity (in)       pointer to pEp_identity structure
vb@0
   516
//
roker@529
   517
//    return value:
roker@529
   518
//        PEP_STATUS_OK = 0             encryption and signing succeeded
roker@529
   519
//        PEP_CANNOT_SET_PERSON         writing to table person failed
roker@529
   520
//        PEP_CANNOT_SET_PGP_KEYPAIR    writing to table pgp_keypair failed
roker@529
   521
//        PEP_CANNOT_SET_IDENTITY       writing to table identity failed
roker@529
   522
//        PEP_COMMIT_FAILED             SQL commit failed
vb@932
   523
//        PEP_KEY_BLACKLISTED           Key blacklisted, cannot set identity
vb@0
   524
//
roker@529
   525
//    caveat:
vb@932
   526
//        address, fpr, user_id and username must be given
vb@0
   527
vb@0
   528
DYNAMIC_API PEP_STATUS set_identity(
vb@0
   529
        PEP_SESSION session, const pEp_identity *identity
vb@0
   530
    );
vb@0
   531
vb@0
   532
vb@932
   533
// set_identity_flags() - update identity flags on existing identity
vb@932
   534
//
vb@932
   535
//    parameters:
vb@932
   536
//        session (in)        session handle
vb@934
   537
//        identity (in,out)   pointer to pEp_identity structure
vb@934
   538
//        flags (in)          new value for flags
vb@932
   539
//
vb@932
   540
//    return value:
vb@932
   541
//        PEP_STATUS_OK = 0             encryption and signing succeeded
vb@932
   542
//        PEP_CANNOT_SET_IDENTITY       update of identity failed
vb@932
   543
//
vb@932
   544
//    caveat:
vb@934
   545
//        address and user_id must be given in identity
vb@932
   546
vb@932
   547
DYNAMIC_API PEP_STATUS set_identity_flags(
vb@934
   548
        PEP_SESSION session,
vb@934
   549
        pEp_identity *identity,
vb@934
   550
        unsigned int flags
vb@932
   551
    );
vb@932
   552
vb@932
   553
vb@357
   554
// mark_as_compromized() - mark key in trust db as compromized
vb@357
   555
//
roker@529
   556
//    parameters:
roker@529
   557
//        session (in)        session handle
roker@529
   558
//        fpr (in)            fingerprint of key to mark
vb@357
   559
vb@357
   560
DYNAMIC_API PEP_STATUS mark_as_compromized(
vb@357
   561
        PEP_SESSION session,
vb@357
   562
        const char *fpr
vb@357
   563
    );
vb@357
   564
vb@357
   565
vb@0
   566
// generate_keypair() - generate a new key pair and add it to the key ring
vb@0
   567
//
vb@0
   568
//  parameters:
vb@0
   569
//      session (in)            session handle
roker@529
   570
//        identity (inout)      pointer to pEp_identity structure
vb@0
   571
//
roker@529
   572
//    return value:
roker@529
   573
//        PEP_STATUS_OK = 0       encryption and signing succeeded
roker@529
   574
//        PEP_ILLEGAL_VALUE       illegal values for identity fields given
roker@529
   575
//        PEP_CANNOT_CREATE_KEY   key engine is on strike
vb@0
   576
//
vb@0
   577
//  caveat:
vb@0
   578
//      address and username fields must be set to UTF-8 strings
vb@0
   579
//      the fpr field must be set to NULL
vb@0
   580
//
vb@0
   581
//      this function allocates a string and sets set fpr field of identity
vb@0
   582
//      the caller is responsible to call free() for that string or use
vb@0
   583
//      free_identity() on the struct
vb@0
   584
vb@0
   585
DYNAMIC_API PEP_STATUS generate_keypair(
vb@0
   586
        PEP_SESSION session, pEp_identity *identity
vb@0
   587
    );
vb@0
   588
vb@0
   589
vb@0
   590
// delete_keypair() - delete a public key or a key pair from the key ring
vb@0
   591
//
vb@0
   592
//  parameters:
vb@0
   593
//      session (in)            session handle
vb@0
   594
//      fpr (in)                C string with key id or fingerprint of the
vb@0
   595
//                              public key
vb@0
   596
//
vb@0
   597
//  return value:
vb@0
   598
//      PEP_STATUS_OK = 0       key was successfully deleted
vb@0
   599
//      PEP_KEY_NOT_FOUND       key not found
vb@0
   600
//      PEP_ILLEGAL_VALUE       not a valid key id or fingerprint
vb@0
   601
//      PEP_KEY_HAS_AMBIG_NAME  fpr does not uniquely identify a key
vb@0
   602
//      PEP_OUT_OF_MEMORY       out of memory
vb@0
   603
vb@0
   604
DYNAMIC_API PEP_STATUS delete_keypair(PEP_SESSION session, const char *fpr);
vb@0
   605
vb@0
   606
vb@0
   607
// import_key() - import key from data
vb@0
   608
//
vb@0
   609
//  parameters:
vb@0
   610
//      session (in)            session handle
vb@0
   611
//      key_data (in)           key data, i.e. ASCII armored OpenPGP key
vb@0
   612
//      size (in)               amount of data to handle
Edouard@772
   613
//      private_keys (out)      list of private keys that have been imported
vb@0
   614
//
vb@0
   615
//  return value:
vb@0
   616
//      PEP_STATUS_OK = 0       key was successfully imported
vb@0
   617
//      PEP_OUT_OF_MEMORY       out of memory
vb@0
   618
//      PEP_ILLEGAL_VALUE       there is no key data to import
Edouard@772
   619
//
Edouard@772
   620
//  caveat:
Edouard@772
   621
//      private_keys goes to the ownership of the caller
Edouard@772
   622
//      private_keys can be left NULL, it is then ignored
vb@0
   623
Edouard@728
   624
DYNAMIC_API PEP_STATUS import_key(
Edouard@728
   625
        PEP_SESSION session,
Edouard@728
   626
        const char *key_data,
Edouard@728
   627
        size_t size,
Edouard@728
   628
        identity_list **private_keys
Edouard@728
   629
    );
vb@0
   630
vb@0
   631
vb@0
   632
// export_key() - export ascii armored key
vb@0
   633
//
vb@0
   634
//  parameters:
vb@0
   635
//      session (in)            session handle
vb@0
   636
//      fpr (in)                key id or fingerprint of key
vb@0
   637
//      key_data (out)          ASCII armored OpenPGP key
roker@529
   638
//      size (out)              amount of data to handle
vb@0
   639
//
vb@0
   640
//  return value:
vb@0
   641
//      PEP_STATUS_OK = 0       key was successfully exported
vb@0
   642
//      PEP_OUT_OF_MEMORY       out of memory
vb@0
   643
//      PEP_KEY_NOT_FOUND       key not found
vb@0
   644
//
vb@0
   645
//  caveat:
vb@0
   646
//      the key_data goes to the ownership of the caller
vb@0
   647
//      the caller is responsible to free() it (on Windoze use pEp_free())
vb@0
   648
vb@0
   649
DYNAMIC_API PEP_STATUS export_key(
vb@0
   650
        PEP_SESSION session, const char *fpr, char **key_data, size_t *size
vb@0
   651
    );
vb@0
   652
vb@0
   653
vb@1103
   654
// export_secret_key() - export secret key ascii armored
vb@1103
   655
//
vb@1103
   656
//  parameters:
vb@1103
   657
//      session (in)            session handle
vb@1103
   658
//      fpr (in)                fingerprint of key, at least 16 hex digits
vb@1103
   659
//      key_data (out)          ASCII armored OpenPGP secret key
vb@1103
   660
//      size (out)              amount of data to handle
vb@1103
   661
//
vb@1103
   662
//  return value:
vb@1103
   663
//      PEP_STATUS_OK = 0       key was successfully exported
vb@1103
   664
//      PEP_OUT_OF_MEMORY       out of memory
vb@1103
   665
//      PEP_KEY_NOT_FOUND       key not found
vb@1103
   666
//      PEP_CANNOT_EXPORT_KEY   cannot export secret key (i.e. it's on an HKS)
vb@1103
   667
//
vb@1103
   668
//  caveat:
vb@1103
   669
//      the key_data goes to the ownership of the caller
vb@1103
   670
//      the caller is responsible to free() it (on Windoze use pEp_free())
vb@1103
   671
//      beware of leaking secret key data - overwrite it in memory after use
vb@1103
   672
vb@1103
   673
DYNAMIC_API PEP_STATUS export_secrect_key(
vb@1103
   674
        PEP_SESSION session, const char *fpr, char **key_data, size_t *size
vb@1103
   675
    );
vb@1103
   676
vb@1103
   677
vb@0
   678
// recv_key() - update key(s) from keyserver
vb@0
   679
//
vb@0
   680
//  parameters:
vb@0
   681
//      session (in)            session handle
vb@0
   682
//      pattern (in)            key id, user id or address to search for as
vb@0
   683
//                              UTF-8 string
vb@0
   684
vb@0
   685
DYNAMIC_API PEP_STATUS recv_key(PEP_SESSION session, const char *pattern);
vb@0
   686
vb@0
   687
vb@0
   688
// find_keys() - find keys in keyring
vb@0
   689
//
vb@0
   690
//  parameters:
vb@0
   691
//      session (in)            session handle
vb@0
   692
//      pattern (in)            key id, user id or address to search for as
vb@0
   693
//                              UTF-8 string
vb@0
   694
//      keylist (out)           list of fingerprints found or NULL on error
vb@0
   695
//
vb@0
   696
//  caveat:
roker@529
   697
//        the ownerships of keylist isgoing to the caller
roker@529
   698
//        the caller must use free_stringlist() to free it
vb@0
   699
vb@0
   700
vb@0
   701
DYNAMIC_API PEP_STATUS find_keys(
vb@0
   702
        PEP_SESSION session, const char *pattern, stringlist_t **keylist
vb@0
   703
    );
vb@0
   704
vb@0
   705
// send_key() - send key(s) to keyserver
vb@0
   706
//
vb@0
   707
//  parameters:
vb@0
   708
//      session (in)            session handle
vb@0
   709
//      pattern (in)            key id, user id or address to search for as
vb@0
   710
//                              UTF-8 string
vb@0
   711
vb@0
   712
DYNAMIC_API PEP_STATUS send_key(PEP_SESSION session, const char *pattern);
vb@0
   713
vb@0
   714
vb@0
   715
// pEp_free() - free memory allocated by pEp engine
vb@0
   716
//
vb@0
   717
//  parameters:
vb@0
   718
//      p (in)                  pointer to free
vb@0
   719
//
vb@0
   720
//  The reason for this function is that heap management can be a pretty
vb@0
   721
//  complex task with Windoze. This free() version calls the free()
vb@0
   722
//  implementation of the C runtime library which was used to build pEp engine,
vb@0
   723
//  so you're using the correct heap. For more information, see:
vb@0
   724
//  <http://msdn.microsoft.com/en-us/library/windows/desktop/aa366711(v=vs.85).aspx>
vb@0
   725
vb@0
   726
DYNAMIC_API void pEp_free(void *p);
vb@0
   727
vb@8
   728
vb@8
   729
// get_trust() - get the trust level a key has for a person
vb@8
   730
//
vb@8
   731
//  parameters:
vb@8
   732
//      session (in)            session handle
vb@8
   733
//      identity (inout)        user_id and fpr to check as UTF-8 strings (in)
vb@8
   734
//                              user_id and comm_type as result (out)
vb@8
   735
//
vb@14
   736
//  this function modifies the given identity struct; the struct remains in
vb@251
   737
//  the ownership of the caller
vb@14
   738
//  if the trust level cannot be determined identity->comm_type is set
vb@14
   739
//  to PEP_ct_unknown
vb@8
   740
vb@8
   741
DYNAMIC_API PEP_STATUS get_trust(PEP_SESSION session, pEp_identity *identity);
vb@8
   742
vb@8
   743
vb@251
   744
// least_trust() - get the least known trust level for a key in the database
vb@251
   745
//
vb@251
   746
//  parameters:
vb@251
   747
//      session (in)            session handle
vb@251
   748
//      fpr (in)                fingerprint of key to check
vb@251
   749
//      comm_type (out)         least comm_type as result (out)
vb@251
   750
//
vb@251
   751
//  if the trust level cannot be determined comm_type is set to PEP_ct_unknown
vb@251
   752
vb@251
   753
DYNAMIC_API PEP_STATUS least_trust(
vb@251
   754
        PEP_SESSION session,
vb@251
   755
        const char *fpr,
vb@251
   756
        PEP_comm_type *comm_type
vb@251
   757
    );
vb@251
   758
vb@251
   759
vb@9
   760
// get_key_rating() - get the rating a bare key has
vb@9
   761
//
vb@9
   762
//  parameters:
vb@9
   763
//      session (in)            session handle
vb@9
   764
//      fpr (in)                unique identifyer for key as UTF-8 string
vb@9
   765
//      comm_type (out)         key rating
vb@10
   766
//
vb@14
   767
//  if an error occurs, *comm_type is set to PEP_ct_unknown and an error
vb@10
   768
//  is returned
vb@9
   769
vb@9
   770
DYNAMIC_API PEP_STATUS get_key_rating(
vb@14
   771
        PEP_SESSION session,
vb@14
   772
        const char *fpr,
vb@14
   773
        PEP_comm_type *comm_type
vb@9
   774
    );
vb@9
   775
vb@9
   776
vb@198
   777
// renew_key() - renew an expired key
vb@196
   778
//
vb@196
   779
//  parameters:
vb@196
   780
//      session (in)            session handle
vb@214
   781
//      fpr (in)                ID of key to renew as UTF-8 string
vb@201
   782
//      ts (in)                 timestamp when key should expire or NULL for
vb@201
   783
//                              default
vb@196
   784
vb@201
   785
DYNAMIC_API PEP_STATUS renew_key(
vb@201
   786
        PEP_SESSION session,
vb@201
   787
        const char *fpr,
vb@201
   788
        const timestamp *ts
vb@201
   789
    );
vb@196
   790
vb@196
   791
vb@224
   792
// revoke_key() - revoke a key
vb@197
   793
//
vb@197
   794
//  parameters:
vb@197
   795
//      session (in)            session handle
vb@214
   796
//      fpr (in)                ID of key to revoke as UTF-8 string
vb@211
   797
//      reason (in)             text with reason for revoke as UTF-8 string
vb@211
   798
//                              or NULL if reason unknown
vb@211
   799
//
vb@211
   800
//  caveat:
vb@211
   801
//      reason text must not include empty lines
vb@224
   802
//      this function is meant for internal use only; better use
vb@224
   803
//      key_compromized() of keymanagement API
vb@197
   804
vb@211
   805
DYNAMIC_API PEP_STATUS revoke_key(
vb@211
   806
        PEP_SESSION session,
vb@211
   807
        const char *fpr,
vb@211
   808
        const char *reason
vb@211
   809
    );
vb@197
   810
vb@197
   811
vb@214
   812
// key_expired() - flags if a key is already expired
vb@214
   813
//
vb@214
   814
//  parameters:
vb@214
   815
//      session (in)            session handle
vb@214
   816
//      fpr (in)                ID of key to check as UTF-8 string
Edouard@701
   817
//      when (in)               UTC time of when should expiry be considered
vb@214
   818
//      expired (out)           flag if key expired
vb@214
   819
vb@214
   820
DYNAMIC_API PEP_STATUS key_expired(
vb@214
   821
        PEP_SESSION session,
vb@214
   822
        const char *fpr,
Edouard@701
   823
        const time_t when,
vb@214
   824
        bool *expired
vb@214
   825
    );
vb@214
   826
Edouard@694
   827
    
Edouard@694
   828
// key_revoked() - flags if a key is already revoked
Edouard@694
   829
//
Edouard@694
   830
//  parameters:
Edouard@694
   831
//      session (in)            session handle
Edouard@694
   832
//      fpr (in)                ID of key to check as UTF-8 string
Edouard@694
   833
//      revoked (out)           flag if key revoked
Edouard@694
   834
Edouard@694
   835
DYNAMIC_API PEP_STATUS key_revoked(
Edouard@694
   836
        PEP_SESSION session,
Edouard@694
   837
        const char *fpr,
Edouard@694
   838
        bool *revoked
Edouard@694
   839
    );
Edouard@694
   840
vb@214
   841
vb@450
   842
// get_crashdump_log() - get the last log messages out
vb@450
   843
//
vb@450
   844
//  parameters:
vb@450
   845
//      session (in)            session handle
vb@450
   846
//      maxlines (in)           maximum number of lines (0 for default)
vb@458
   847
//      logdata (out)           logdata as string in double quoted CSV format
vb@463
   848
//                              column1 is title
vb@463
   849
//                              column2 is entity
vb@463
   850
//                              column3 is description
vb@463
   851
//                              column4 is comment
vb@462
   852
//
vb@462
   853
//  caveat:
vb@462
   854
//      the ownership of logdata goes to the caller
vb@450
   855
vb@450
   856
DYNAMIC_API PEP_STATUS get_crashdump_log(
vb@450
   857
        PEP_SESSION session,
vb@450
   858
        int maxlines,
vb@450
   859
        char **logdata
vb@450
   860
    );
vb@450
   861
vb@450
   862
dirk@501
   863
// get_languagelist() - get the list of languages
vb@458
   864
//
vb@458
   865
//  parameters:
vb@458
   866
//      session (in)            session handle
vb@458
   867
//      languages (out)         languages as string in double quoted CSV format
vb@463
   868
//                              column 1 is the ISO 639-1 language code
vb@463
   869
//                              column 2 is the name of the language
vb@462
   870
//
vb@462
   871
//  caveat:
vb@462
   872
//      the ownership of languages goes to the caller
vb@458
   873
vb@458
   874
DYNAMIC_API PEP_STATUS get_languagelist(
vb@458
   875
        PEP_SESSION session,
vb@458
   876
        char **languages
vb@458
   877
    );
vb@458
   878
vb@458
   879
vb@458
   880
// get_phrase() - get phrase in a dedicated language through i18n
vb@458
   881
//
vb@458
   882
//  parameters:
vb@458
   883
//      session (in)            session handle
roker@529
   884
//      lang (in)               C string with ISO 639-1 language code
vb@458
   885
//      phrase_id (in)          id of phrase in i18n
vb@458
   886
//      phrase (out)            phrase as UTF-8 string
vb@462
   887
//
vb@462
   888
//  caveat:
vb@462
   889
//      the ownership of phrase goes to the caller
vb@458
   890
vb@458
   891
DYNAMIC_API PEP_STATUS get_phrase(
vb@458
   892
        PEP_SESSION session,
vb@458
   893
        const char *lang,
vb@458
   894
        int phrase_id,
vb@458
   895
        char **phrase
vb@458
   896
    );
vb@458
   897
vb@458
   898
vb@632
   899
// sequence_value() - raise the value of a named sequence and retrieve it
vb@632
   900
//
vb@632
   901
//  parameters:
vb@632
   902
//      session (in)            session handle
vb@1085
   903
//      name (inout)            name of sequence or char[37] set to {0, }
vb@1086
   904
//                              for new own sequence named as UUID
vb@1085
   905
//      value (inout)           value of sequence value to test or 0 for
vb@1085
   906
//                              getting next value
vb@1085
   907
//
vb@1085
   908
//  returns:
vb@1086
   909
//      PEP_STATUS_OK                   no error, not own sequence
vb@1086
   910
//      PEP_SEQUENCE_VIOLATED           if sequence violated
vb@1086
   911
//      PEP_CANNOT_INCREASE_SEQUENCE    if sequence cannot be increased
vb@1086
   912
//      PEP_OWN_SEQUENCE                if own sequence
vb@632
   913
vb@632
   914
DYNAMIC_API PEP_STATUS sequence_value(
vb@632
   915
        PEP_SESSION session,
vb@1085
   916
        char *name,
vb@652
   917
        int32_t *value
vb@632
   918
    );
vb@632
   919
vb@1044
   920
Edouard@694
   921
// set_revoked() - records relation between a revoked key and its replacement
Edouard@694
   922
//
Edouard@694
   923
//  parameters:
Edouard@694
   924
//      session (in)            session handle
Edouard@694
   925
//      revoked_fpr (in)        revoked fingerprint
Edouard@694
   926
//      replacement_fpr (in)    replacement key fingerprint
Edouard@694
   927
//      revocation_date (in)    revocation date
Edouard@694
   928
Edouard@693
   929
DYNAMIC_API PEP_STATUS set_revoked(
Edouard@693
   930
       PEP_SESSION session,
Edouard@693
   931
       const char *revoked_fpr,
Edouard@693
   932
       const char *replacement_fpr,
Edouard@693
   933
       const uint64_t revocation_date
Edouard@693
   934
    );
Edouard@693
   935
vb@958
   936
Edouard@694
   937
// get_revoked() - find revoked key that may have been replaced by given key, if any
Edouard@694
   938
//
Edouard@694
   939
//  parameters:
Edouard@694
   940
//      session (in)            session handle
Edouard@694
   941
//      fpr (in)                given fingerprint
Edouard@694
   942
//      revoked_fpr (out)       revoked fingerprint
Edouard@694
   943
//      revocation_date (out)   revocation date
Edouard@694
   944
    
Edouard@693
   945
DYNAMIC_API PEP_STATUS get_revoked(
Edouard@693
   946
        PEP_SESSION session,
Edouard@693
   947
        const char *fpr,
Edouard@693
   948
        char **revoked_fpr,
Edouard@693
   949
        uint64_t *revocation_date
Edouard@693
   950
    );
Edouard@693
   951
vb@632
   952
vb@958
   953
// key_created() - get creation date of a key
vb@958
   954
//
vb@958
   955
//  parameters:
vb@958
   956
//      session (in)            session handle
vb@958
   957
//      fpr (in)                fingerprint of key
vb@958
   958
//      created (out)           date of creation
vb@958
   959
vb@958
   960
PEP_STATUS key_created(
vb@958
   961
        PEP_SESSION session,
vb@958
   962
        const char *fpr,
vb@958
   963
        time_t *created
vb@958
   964
    );
vb@958
   965
vb@958
   966
krista@1011
   967
// get_engine_version() - returns the current version of pEpEngine (this is different
krista@1011
   968
//                        from the pEp protocol version!)
krista@1011
   969
//
krista@1011
   970
//  parameters: none
krista@1011
   971
//
krista@1011
   972
//  return_value: const char* to the engine version string constant
krista@1011
   973
//
krista@1011
   974
DYNAMIC_API const char* get_engine_version();
krista@1011
   975
vb@482
   976
DYNAMIC_API PEP_STATUS reset_peptest_hack(PEP_SESSION session);
vb@482
   977
vb@0
   978
#ifdef __cplusplus
vb@0
   979
}
vb@0
   980
#endif