src/message_api.h
author Krista Bennett <krista@pep-project.org>
Wed, 11 Apr 2018 16:43:33 +0200
branchENGINE-420
changeset 2592 d1cb6fd3ded2
parent 2588 858909bcf85b
child 2594 1b45507f4696
permissions -rw-r--r--
ENGINE-420: compiled first draft of private key export
vb@1513
     1
// This file is under GNU General Public License 3.0
vb@1513
     2
// see LICENSE.txt
vb@1513
     3
vb@39
     4
#pragma once
vb@39
     5
vb@102
     6
#include "pEpEngine.h"
vb@102
     7
#include "keymanagement.h"
vb@101
     8
#include "message.h"
vb@259
     9
#include "cryptotech.h"
vb@101
    10
vb@37
    11
#ifdef __cplusplus
vb@37
    12
extern "C" {
vb@37
    13
#endif
vb@37
    14
vb@39
    15
Edouard@734
    16
bool import_attached_keys(
Edouard@728
    17
        PEP_SESSION session, 
Edouard@728
    18
        const message *msg,
Edouard@728
    19
        identity_list **private_idents
Edouard@728
    20
    );
roker@1869
    21
vb@236
    22
void attach_own_key(PEP_SESSION session, message *msg);
roker@1869
    23
vb@258
    24
PEP_cryptotech determine_encryption_format(message *msg);
roker@1869
    25
vb@952
    26
void add_opt_field(message *msg, const char *name, const char *value);
Edouard@736
    27
vb@939
    28
typedef enum _PEP_encrypt_flags {
krista@1639
    29
    // "default" means whatever the default behaviour for the function is.
krista@1639
    30
    PEP_encrypt_flag_default = 0x0,
markus@1633
    31
    PEP_encrypt_flag_force_encryption = 0x1,
markus@1633
    32
markus@1633
    33
    // This flag is for special use cases and should not be used
markus@1633
    34
    // by normal pEp clients!
krista@1640
    35
    PEP_encrypt_flag_force_unsigned = 0x2,
krista@2121
    36
    PEP_encrypt_flag_force_no_attached_key = 0x4,
krista@2121
    37
    
krista@2121
    38
    // This is used for outer messages (used to wrap the real message)
krista@2121
    39
    // This is only used internally and (eventually) by transport functions
krista@2147
    40
    PEP_encrypt_flag_inner_message = 0x8
vb@939
    41
} PEP_encrypt_flags; 
vb@939
    42
vb@939
    43
typedef unsigned int PEP_encrypt_flags_t;
vb@235
    44
roker@1869
    45
vb@39
    46
// encrypt_message() - encrypt message in memory
vb@39
    47
//
vb@39
    48
//  parameters:
vb@48
    49
//      session (in)        session handle
vb@48
    50
//      src (in)            message to encrypt
vb@48
    51
//      extra (in)          extra keys for encryption
vb@2338
    52
//      dst (out)           pointer to new encrypted message or NULL if no
vb@2338
    53
//                          encryption could take place
vb@84
    54
//      enc_format (in)     encrypted format
vb@939
    55
//      flags (in)          flags to set special encryption features
vb@39
    56
//
vb@39
    57
//  return value:
vb@48
    58
//      PEP_STATUS_OK                   on success
edouard@1854
    59
//      PEP_KEY_HAS_AMBIG_NAME          at least one of the receipient keys has
edouard@1854
    60
//                                      an ambiguous name
vb@2338
    61
//      PEP_UNENCRYPTED                 on demand or no recipients with usable
vb@2338
    62
//                                      key, is left unencrypted, and key is
vb@2338
    63
//                                      attached to it
vb@83
    64
//
roker@1869
    65
//  caveat:
roker@1869
    66
//      the ownershop of src remains with the caller
roker@1869
    67
//      the ownership of dst goes to the caller
vb@44
    68
DYNAMIC_API PEP_STATUS encrypt_message(
vb@37
    69
        PEP_SESSION session,
vb@113
    70
        message *src,
vb@37
    71
        stringlist_t *extra,
vb@38
    72
        message **dst,
vb@939
    73
        PEP_enc_format enc_format,
vb@939
    74
        PEP_encrypt_flags_t flags
vb@37
    75
    );
vb@37
    76
roker@1869
    77
krista@2592
    78
DYNAMIC_API PEP_STATUS encrypt_message_and_add_priv_key(
krista@2592
    79
        PEP_SESSION session,
krista@2592
    80
        message *src,
krista@2592
    81
        message **dst,
krista@2592
    82
        const char* to_fpr,
krista@2592
    83
        PEP_enc_format enc_format
krista@2592
    84
    );
krista@2592
    85
krista@2592
    86
krista@1034
    87
// encrypt_message_for_self() - encrypt message in memory for user's identity only,
krista@1034
    88
//                              ignoring recipients and other identities from
krista@1034
    89
//                              the message
krista@994
    90
//  parameters:
krista@994
    91
//      session (in)        session handle
krista@995
    92
//      target_id (in)      self identity this message should be encrypted for
krista@994
    93
//      src (in)            message to encrypt
krista@2588
    94
//      extra (in)          extra keys for encryption
krista@994
    95
//      dst (out)           pointer to new encrypted message or NULL on failure
krista@994
    96
//      enc_format (in)     encrypted format
markus@1634
    97
//      flags (in)          flags to set special encryption features
krista@994
    98
//
krista@994
    99
//  return value:       (FIXME: This may not be correct or complete)
roker@1869
   100
//      PEP_STATUS_OK            on success
roker@1869
   101
//      PEP_KEY_NOT_FOUND        at least one of the receipient keys
roker@1869
   102
//                               could not be found
roker@1869
   103
//      PEP_KEY_HAS_AMBIG_NAME   at least one of the receipient keys has
roker@1869
   104
//                               an ambiguous name
roker@1869
   105
//      PEP_GET_KEY_FAILED       cannot retrieve key
krista@994
   106
//
roker@1869
   107
//  caveat:
roker@1869
   108
//      the ownership of src remains with the caller
krista@994
   109
//      the ownership of target_id remains w/ caller            
roker@1869
   110
//      the ownership of dst goes to the caller
krista@995
   111
//      message is NOT encrypted for identities other than the target_id (and then,
roker@1869
   112
//      only if the target_id refers to self!)
krista@995
   113
DYNAMIC_API PEP_STATUS encrypt_message_for_self(
krista@994
   114
        PEP_SESSION session,
krista@994
   115
        pEp_identity* target_id,
krista@994
   116
        message *src,
krista@2588
   117
        stringlist_t* extra,
krista@994
   118
        message **dst,
markus@1633
   119
        PEP_enc_format enc_format,
markus@1633
   120
        PEP_encrypt_flags_t flags
krista@994
   121
    );
vb@39
   122
roker@1869
   123
krista@1325
   124
// MIME_encrypt_message() - encrypt a MIME message, with MIME output
krista@1325
   125
//
krista@1325
   126
//  parameters:
krista@1325
   127
//      session (in)            session handle
krista@1325
   128
//      mimetext (in)           MIME encoded text to encrypt
krista@1331
   129
//      size (in)               size of input mime text
krista@1325
   130
//      extra (in)              extra keys for encryption
krista@1325
   131
//      mime_ciphertext (out)   encrypted, encoded message
krista@1325
   132
//      enc_format (in)         encrypted format
krista@1325
   133
//      flags (in)              flags to set special encryption features
krista@1325
   134
//
krista@1325
   135
//  return value:
krista@1325
   136
//      PEP_STATUS_OK           if everything worked
krista@1325
   137
//      PEP_BUFFER_TOO_SMALL    if encoded message size is too big to handle
krista@1325
   138
//      PEP_CANNOT_CREATE_TEMP_FILE
krista@1325
   139
//                              if there are issues with temp files; in
krista@1325
   140
//                              this case errno will contain the underlying
krista@1325
   141
//                              error
krista@1325
   142
//      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
krista@1325
   143
//
krista@1325
   144
//  caveat:
krista@1325
   145
//      the encrypted, encoded mime text will go to the ownership of the caller; mimetext
krista@1325
   146
//      will remain in the ownership of the caller
krista@1325
   147
DYNAMIC_API PEP_STATUS MIME_encrypt_message(
krista@1325
   148
    PEP_SESSION session,
krista@1325
   149
    const char *mimetext,
krista@1325
   150
    size_t size,
krista@1325
   151
    stringlist_t* extra,
krista@1325
   152
    char** mime_ciphertext,
krista@1325
   153
    PEP_enc_format enc_format,
krista@1325
   154
    PEP_encrypt_flags_t flags
krista@1325
   155
);
krista@1325
   156
roker@1869
   157
krista@1641
   158
// MIME_encrypt_message_for_self() - encrypt MIME message for user's identity only,
krista@1641
   159
//                              ignoring recipients and other identities from
krista@1641
   160
//                              the message, with MIME output
krista@1641
   161
//  parameters:
krista@1641
   162
//      session (in)            session handle
roker@1869
   163
//      target_id (in)          self identity this message should be encrypted for
krista@1641
   164
//      mimetext (in)           MIME encoded text to encrypt
krista@1641
   165
//      size (in)               size of input mime text
krista@2588
   166
//      extra (in)              extra keys for encryption
krista@1641
   167
//      mime_ciphertext (out)   encrypted, encoded message
krista@1641
   168
//      enc_format (in)         encrypted format
krista@1641
   169
//      flags (in)              flags to set special encryption features
krista@1641
   170
//
krista@1641
   171
//  return value:
krista@1641
   172
//      PEP_STATUS_OK           if everything worked
krista@1641
   173
//      PEP_BUFFER_TOO_SMALL    if encoded message size is too big to handle
krista@1641
   174
//      PEP_CANNOT_CREATE_TEMP_FILE
krista@1641
   175
//                              if there are issues with temp files; in
krista@1641
   176
//                              this case errno will contain the underlying
krista@1641
   177
//                              error
krista@1641
   178
//      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
krista@1641
   179
//
krista@1641
   180
//  caveat:
krista@1641
   181
//      the encrypted, encoded mime text will go to the ownership of the caller; mimetext
krista@1641
   182
//      will remain in the ownership of the caller
krista@1641
   183
DYNAMIC_API PEP_STATUS MIME_encrypt_message_for_self(
krista@1641
   184
    PEP_SESSION session,
krista@1641
   185
    pEp_identity* target_id,
krista@1641
   186
    const char *mimetext,
krista@1641
   187
    size_t size,
krista@2588
   188
    stringlist_t* extra,
krista@1641
   189
    char** mime_ciphertext,
krista@1641
   190
    PEP_enc_format enc_format,
krista@1641
   191
    PEP_encrypt_flags_t flags
krista@1641
   192
);
krista@1641
   193
krista@1641
   194
vb@1004
   195
typedef enum _PEP_rating {
vb@237
   196
    PEP_rating_undefined = 0,
vb@256
   197
    PEP_rating_cannot_decrypt,
vb@267
   198
    PEP_rating_have_no_key,
vb@237
   199
    PEP_rating_unencrypted,
vb@486
   200
    PEP_rating_unencrypted_for_some,
vb@237
   201
    PEP_rating_unreliable,
vb@237
   202
    PEP_rating_reliable,
vb@237
   203
    PEP_rating_trusted,
vb@237
   204
    PEP_rating_trusted_and_anonymized,
vb@237
   205
    PEP_rating_fully_anonymous,   
vb@189
   206
Edouard@442
   207
    PEP_rating_mistrust = -1,
Edouard@442
   208
    PEP_rating_b0rken = -2,
vb@436
   209
    PEP_rating_under_attack = -3
vb@1004
   210
} PEP_rating;
vb@1004
   211
vb@1004
   212
typedef enum _PEP_color {
vb@1004
   213
    PEP_color_no_color = 0,
vb@1004
   214
    PEP_color_yellow,
vb@1004
   215
    PEP_color_green,
vb@1004
   216
    PEP_color_red = -1,
vb@232
   217
} PEP_color;
vb@189
   218
roker@1869
   219
vb@1007
   220
// color_from_rating - calculate color from rating
vb@1007
   221
//
vb@1007
   222
//  parameters:
vb@1007
   223
//      rating (in)         rating
vb@1007
   224
//
vb@1007
   225
//  return value:           color representing that rating
vb@1004
   226
DYNAMIC_API PEP_color color_from_rating(PEP_rating rating);
vb@1004
   227
Edouard@728
   228
typedef enum _PEP_decrypt_flags {
edouard@1355
   229
    PEP_decrypt_flag_own_private_key = 0x1,
edouard@1369
   230
    PEP_decrypt_flag_consume = 0x2,
edouard@1369
   231
    PEP_decrypt_flag_ignore = 0x4
Edouard@728
   232
} PEP_decrypt_flags; 
Edouard@728
   233
vb@939
   234
typedef unsigned int PEP_decrypt_flags_t;
Edouard@728
   235
roker@1869
   236
vb@251
   237
// decrypt_message() - decrypt message in memory
vb@251
   238
//
vb@251
   239
//  parameters:
vb@251
   240
//      session (in)        session handle
vb@251
   241
//      src (in)            message to decrypt
vb@251
   242
//      dst (out)           pointer to new decrypted message or NULL on failure
vb@251
   243
//      keylist (out)       stringlist with keyids
roker@1218
   244
//      rating (out)        rating for the message
vb@939
   245
//      flags (out)         flags to signal special decryption features
vb@251
   246
//
vb@251
   247
//  return value:
edouard@1858
   248
//      error status 
edouard@1858
   249
//      or PEP_DECRYPTED if message decrypted but not verified
edouard@1858
   250
//      or PEP_STATUS_OK on success
vb@251
   251
//
roker@1869
   252
// caveat:
roker@1869
   253
//      the ownership of src remains with the caller
roker@1869
   254
//      the ownership of dst goes to the caller
roker@1869
   255
//      the ownership of keylist goes to the caller
roker@1869
   256
//      if src is unencrypted this function returns PEP_UNENCRYPTED and sets
roker@1869
   257
//      dst to NULL
vb@251
   258
DYNAMIC_API PEP_STATUS decrypt_message(
vb@251
   259
        PEP_SESSION session,
vb@251
   260
        message *src,
vb@251
   261
        message **dst,
vb@251
   262
        stringlist_t **keylist,
vb@1004
   263
        PEP_rating *rating,
vb@939
   264
        PEP_decrypt_flags_t *flags
Edouard@728
   265
);
vb@251
   266
roker@1869
   267
krista@1325
   268
// MIME_decrypt_message() - decrypt a MIME message, with MIME output
krista@1325
   269
//
krista@1325
   270
//  parameters:
krista@1325
   271
//      session (in)            session handle
krista@1325
   272
//      mimetext (in)           MIME encoded text to decrypt
krista@1331
   273
//      size (in)               size of mime text to decode (in order to decrypt)
krista@1325
   274
//      mime_plaintext (out)    decrypted, encoded message
krista@1325
   275
//      keylist (out)           stringlist with keyids
krista@1325
   276
//      rating (out)            rating for the message
krista@1325
   277
//      flags (out)             flags to signal special decryption features
krista@1325
   278
//
krista@1325
   279
//  return value:
krista@1644
   280
//      decrypt status          if everything worked with MIME encode/decode, 
krista@1644
   281
//                              the status of the decryption is returned 
krista@1644
   282
//                              (PEP_STATUS_OK or decryption error status)
krista@1325
   283
//      PEP_BUFFER_TOO_SMALL    if encoded message size is too big to handle
krista@1325
   284
//      PEP_CANNOT_CREATE_TEMP_FILE
krista@1325
   285
//                              if there are issues with temp files; in
krista@1325
   286
//                              this case errno will contain the underlying
krista@1325
   287
//                              error
krista@1325
   288
//      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
krista@1325
   289
//
krista@1325
   290
//  caveat:
krista@1325
   291
//      the decrypted, encoded mime text will go to the ownership of the caller; mimetext
krista@1325
   292
//      will remain in the ownership of the caller
krista@1325
   293
DYNAMIC_API PEP_STATUS MIME_decrypt_message(
krista@1325
   294
    PEP_SESSION session,
krista@1325
   295
    const char *mimetext,
krista@1325
   296
    size_t size,
krista@1325
   297
    char** mime_plaintext,
krista@1325
   298
    stringlist_t **keylist,
krista@1325
   299
    PEP_rating *rating,
krista@1325
   300
    PEP_decrypt_flags_t *flags
krista@1325
   301
);
krista@1325
   302
krista@1325
   303
Edouard@728
   304
// own_message_private_key_details() - details on own key in own message
Edouard@728
   305
//
Edouard@728
   306
//  parameters:
Edouard@728
   307
//      session (in)        session handle
Edouard@728
   308
//      msg (in)            message to decrypt
Edouard@728
   309
//      ident (out)         identity containing uid, address and fpr of key
Edouard@728
   310
//
Edouard@728
   311
//  note:
Edouard@728
   312
//      In order to obtain details about key to be possibly imported
Edouard@728
   313
//      as a replacement of key currently used as own identity, 
Edouard@728
   314
//      application passes message that have been previously flagged by 
Edouard@728
   315
//      decrypt_message() as own message containing own key to this function
Edouard@728
   316
//
Edouard@728
   317
//  return value:
Edouard@728
   318
//      error status or PEP_STATUS_OK on success
Edouard@728
   319
//
roker@1869
   320
//  caveat:
roker@1869
   321
//      the ownership of msg remains with the caller
roker@1869
   322
//      the ownership of ident goes to the caller
roker@1869
   323
//      msg MUST be encrypted so that this function can check own signature
Edouard@728
   324
DYNAMIC_API PEP_STATUS own_message_private_key_details(
Edouard@728
   325
        PEP_SESSION session,
Edouard@728
   326
        message *msg,
Edouard@728
   327
        pEp_identity **ident 
Edouard@728
   328
);
vb@251
   329
roker@1869
   330
vb@1009
   331
// outgoing_message_rating() - get rating for an outgoing message
vb@189
   332
//
vb@189
   333
//  parameters:
vb@189
   334
//      session (in)        session handle
vb@1009
   335
//      msg (in)            message to get the rating for
vb@1009
   336
//      rating (out)        rating for the message
vb@189
   337
//
vb@189
   338
//  return value:
vb@189
   339
//      error status or PEP_STATUS_OK on success
vb@190
   340
//
vb@190
   341
//  caveat:
vb@190
   342
//      msg->from must point to a valid pEp_identity
vb@251
   343
//      msg->dir must be PEP_dir_outgoing
vb@251
   344
//      the ownership of msg remains with the caller
vb@1009
   345
DYNAMIC_API PEP_STATUS outgoing_message_rating(
vb@189
   346
        PEP_SESSION session,
vb@190
   347
        message *msg,
vb@1004
   348
        PEP_rating *rating
vb@189
   349
    );
vb@189
   350
vb@239
   351
vb@1009
   352
// identity_rating() - get rating for a single identity
vb@239
   353
//
vb@239
   354
//  parameters:
vb@239
   355
//      session (in)        session handle
vb@1009
   356
//      ident (in)          identity to get the rating for
vb@1009
   357
//      rating (out)        rating for the identity
vb@239
   358
//
vb@239
   359
//  return value:
vb@239
   360
//      error status or PEP_STATUS_OK on success
vb@251
   361
//
vb@251
   362
//  caveat:
vb@251
   363
//      the ownership of ident remains with the caller
vb@1009
   364
DYNAMIC_API PEP_STATUS identity_rating(
vb@239
   365
        PEP_SESSION session,
vb@239
   366
        pEp_identity *ident,
vb@1004
   367
        PEP_rating *rating
vb@239
   368
    );
vb@239
   369
vb@239
   370
vb@507
   371
// get_binary_path() - retrieve path of cryptotech binary if available
vb@507
   372
//
vb@507
   373
//  parameters:
vb@507
   374
//      tech (in)           cryptotech to get the binary for
vb@507
   375
//      path (out)          path to cryptotech binary or NULL if not available
roker@540
   376
//                          **path is owned by the library, do not change it!
vb@507
   377
DYNAMIC_API PEP_STATUS get_binary_path(PEP_cryptotech tech, const char **path);
vb@507
   378
roker@1869
   379
krista@1307
   380
// get_trustwords() - get full trustwords string for a *pair* of identities
krista@1307
   381
//
krista@1307
   382
//    parameters:
krista@1307
   383
//        session (in)        session handle
krista@1307
   384
//        id1 (in)            identity of first party in communication - fpr can't be NULL  
krista@1307
   385
//        id2 (in)            identity of second party in communication - fpr can't be NULL
krista@1307
   386
//        lang (in)           C string with ISO 639-1 language code
krista@1307
   387
//        words (out)         pointer to C string with all trustwords UTF-8 encoded,
krista@1307
   388
//                            separated by a blank each
krista@1307
   389
//                            NULL if language is not supported or trustword
krista@1307
   390
//                            wordlist is damaged or unavailable
krista@1307
   391
//        wsize (out)         length of full trustwords string
krista@1307
   392
//        full (in)           if true, generate ALL trustwords for these identities.
krista@1307
   393
//                            else, generate a fixed-size subset. (TODO: fixed-minimum-entropy
krista@1307
   394
//                            subset in next version)
krista@1307
   395
//
krista@1307
   396
//    return value:
krista@1307
   397
//        PEP_STATUS_OK            trustwords retrieved
krista@1307
   398
//        PEP_OUT_OF_MEMORY        out of memory
krista@1307
   399
//        PEP_TRUSTWORD_NOT_FOUND  at least one trustword not found
krista@1307
   400
//
krista@1307
   401
//    caveat:
krista@1307
   402
//        the word pointer goes to the ownership of the caller
krista@1307
   403
//        the caller is responsible to free() it (on Windoze use pEp_free())
krista@1307
   404
//
krista@1307
   405
DYNAMIC_API PEP_STATUS get_trustwords(
roker@1509
   406
    PEP_SESSION session, const pEp_identity* id1, const pEp_identity* id2,
krista@1307
   407
    const char* lang, char **words, size_t *wsize, bool full
krista@1307
   408
);
vb@507
   409
roker@1869
   410
edouard@1553
   411
// get_message_trustwords() - get full trustwords string for message sender and reciever identities 
edouard@1553
   412
//
edouard@1553
   413
//    parameters:
edouard@1553
   414
//        session (in)        session handle
edouard@1553
   415
//        msg (in)            message to get sender identity from
edouard@1553
   416
//        keylist (in)        NULL if message to be decrypted,
edouard@1553
   417
//                            keylist returned by decrypt_message() otherwise
edouard@1553
   418
//        received_by (in)    identity for account receiving message can't be NULL
edouard@1553
   419
//        lang (in)           C string with ISO 639-1 language code
edouard@1553
   420
//        words (out)         pointer to C string with all trustwords UTF-8 encoded,
edouard@1553
   421
//                            separated by a blank each
edouard@1553
   422
//                            NULL if language is not supported or trustword
edouard@1553
   423
//                            wordlist is damaged or unavailable
edouard@1553
   424
//        full (in)           if true, generate ALL trustwords for these identities.
edouard@1553
   425
//                            else, generate a fixed-size subset. (TODO: fixed-minimum-entropy
edouard@1553
   426
//                            subset in next version)
edouard@1553
   427
//
edouard@1553
   428
//    return value:
edouard@1553
   429
//        PEP_STATUS_OK            trustwords retrieved
edouard@1553
   430
//        PEP_OUT_OF_MEMORY        out of memory
edouard@1553
   431
//        PEP_TRUSTWORD_NOT_FOUND  at least one trustword not found
edouard@1553
   432
//        error status of decrypt_message() if decryption fails.
edouard@1553
   433
//
edouard@1553
   434
//    caveat:
edouard@1553
   435
//        the word pointer goes to the ownership of the caller
edouard@1553
   436
//        the caller is responsible to free() it (on Windoze use pEp_free())
edouard@1553
   437
//
edouard@1553
   438
DYNAMIC_API PEP_STATUS get_message_trustwords(
edouard@1553
   439
    PEP_SESSION session, 
edouard@1553
   440
    message *msg,
edouard@1553
   441
    stringlist_t *keylist,
edouard@1553
   442
    pEp_identity* received_by,
edouard@1553
   443
    const char* lang, char **words, bool full
edouard@1553
   444
);
edouard@1553
   445
edouard@1815
   446
// re_evaluate_message_rating() - re-evaluate already decrypted message rating
edouard@1815
   447
//
edouard@1815
   448
//  parameters:
edouard@1815
   449
//      session (in)            session handle
edouard@1815
   450
//      msg (in)                message to get the rating for
edouard@1815
   451
//      x_keylist (in)          decrypted message recipients keys fpr
edouard@1815
   452
//      x_enc_status (in)       original rating for the decrypted message
edouard@1815
   453
//      rating (out)            rating for the message
edouard@1815
   454
//
edouard@1815
   455
//  return value:
edouard@1815
   456
//      PEP_ILLEGAL_VALUE       if decrypted message doesn't contain 
edouard@1815
   457
//                              X-EncStatus optional field and x_enc_status is 
edouard@1815
   458
//                              pEp_rating_udefined
edouard@1815
   459
//                              or if decrypted message doesn't contain 
edouard@1815
   460
//                              X-Keylist optional field and x_keylist is NULL
edouard@1815
   461
//      PEP_OUT_OF_MEMORY       if not enough memory could be allocated
edouard@1815
   462
//
edouard@1815
   463
//  caveat:
edouard@1815
   464
//      msg->from must point to a valid pEp_identity
edouard@1815
   465
//      the ownership of msg remains with the caller
edouard@1815
   466
//	    the ownership of x_keylist remains with to the caller
edouard@1815
   467
edouard@1815
   468
DYNAMIC_API PEP_STATUS re_evaluate_message_rating(
edouard@1815
   469
    PEP_SESSION session,
edouard@1815
   470
    message *msg,
edouard@1815
   471
    stringlist_t *x_keylist,
edouard@1815
   472
    PEP_rating x_enc_status,
edouard@1815
   473
    PEP_rating *rating
edouard@1815
   474
);
vb@37
   475
#ifdef __cplusplus
vb@37
   476
}
vb@37
   477
#endif