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