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