vb@39
|
1 |
#pragma once
|
vb@39
|
2 |
|
vb@102
|
3 |
#include "pEpEngine.h"
|
vb@102
|
4 |
#include "keymanagement.h"
|
vb@101
|
5 |
#include "message.h"
|
vb@101
|
6 |
|
vb@37
|
7 |
#ifdef __cplusplus
|
vb@37
|
8 |
extern "C" {
|
vb@37
|
9 |
#endif
|
vb@37
|
10 |
|
vb@39
|
11 |
|
vb@235
|
12 |
void import_attached_keys(PEP_SESSION session, const message *msg);
|
vb@236
|
13 |
void attach_own_key(PEP_SESSION session, message *msg);
|
vb@235
|
14 |
|
vb@235
|
15 |
|
vb@39
|
16 |
// encrypt_message() - encrypt message in memory
|
vb@39
|
17 |
//
|
vb@39
|
18 |
// parameters:
|
vb@48
|
19 |
// session (in) session handle
|
vb@48
|
20 |
// src (in) message to encrypt
|
vb@48
|
21 |
// extra (in) extra keys for encryption
|
vb@83
|
22 |
// dst (out) pointer to new encrypted message or NULL on failure
|
vb@84
|
23 |
// enc_format (in) encrypted format
|
vb@39
|
24 |
//
|
vb@39
|
25 |
// return value:
|
vb@48
|
26 |
// PEP_STATUS_OK on success
|
vb@48
|
27 |
// PEP_KEY_NOT_FOUND at least one of the receipient keys
|
vb@48
|
28 |
// could not be found
|
vb@48
|
29 |
// PEP_KEY_HAS_AMBIG_NAME at least one of the receipient keys has
|
vb@48
|
30 |
// an ambiguous name
|
vb@48
|
31 |
// PEP_GET_KEY_FAILED cannot retrieve key
|
vb@83
|
32 |
//
|
vb@83
|
33 |
// caveat:
|
vb@83
|
34 |
// the ownership of the new message goes to the caller
|
vb@117
|
35 |
// if src is unencrypted this function returns PEP_UNENCRYPTED and sets
|
vb@117
|
36 |
// dst to NULL
|
vb@38
|
37 |
|
vb@44
|
38 |
DYNAMIC_API PEP_STATUS encrypt_message(
|
vb@37
|
39 |
PEP_SESSION session,
|
vb@113
|
40 |
message *src,
|
vb@37
|
41 |
stringlist_t *extra,
|
vb@38
|
42 |
message **dst,
|
vb@81
|
43 |
PEP_enc_format enc_format
|
vb@37
|
44 |
);
|
vb@37
|
45 |
|
vb@39
|
46 |
|
vb@39
|
47 |
// decrypt_message() - decrypt message in memory
|
vb@39
|
48 |
//
|
vb@39
|
49 |
// parameters:
|
vb@48
|
50 |
// session (in) session handle
|
vb@48
|
51 |
// src (in) message to decrypt
|
vb@113
|
52 |
// mime (in) MIME encoding wanted
|
vb@83
|
53 |
// dst (out) pointer to new decrypted message or NULL on failure
|
vb@39
|
54 |
//
|
vb@39
|
55 |
// return value:
|
vb@39
|
56 |
// error status or PEP_STATUS_OK on success
|
vb@83
|
57 |
//
|
vb@83
|
58 |
// caveat:
|
vb@83
|
59 |
// the ownership of the new message goes to the caller
|
vb@39
|
60 |
|
vb@44
|
61 |
DYNAMIC_API PEP_STATUS decrypt_message(
|
vb@37
|
62 |
PEP_SESSION session,
|
vb@113
|
63 |
message *src,
|
vb@113
|
64 |
PEP_MIME_format mime,
|
vb@113
|
65 |
message **dst
|
vb@37
|
66 |
);
|
vb@37
|
67 |
|
vb@189
|
68 |
|
vb@232
|
69 |
typedef enum _PEP_color {
|
vb@237
|
70 |
PEP_rating_undefined = 0,
|
vb@237
|
71 |
PEP_rating_unencrypted,
|
vb@237
|
72 |
PEP_rating_unreliable,
|
vb@237
|
73 |
PEP_rating_reliable,
|
vb@237
|
74 |
PEP_rating_yellow = PEP_rating_reliable,
|
vb@237
|
75 |
PEP_rating_trusted,
|
vb@237
|
76 |
PEP_rating_green = PEP_rating_trusted,
|
vb@237
|
77 |
PEP_rating_trusted_and_anonymized,
|
vb@237
|
78 |
PEP_rating_fully_anonymous,
|
vb@189
|
79 |
|
vb@237
|
80 |
PEP_rating_under_attack = -1,
|
vb@237
|
81 |
PEP_rating_red = PEP_rating_under_attack,
|
vb@237
|
82 |
PEP_rating_b0rken = -2
|
vb@232
|
83 |
} PEP_color;
|
vb@189
|
84 |
|
vb@194
|
85 |
// get_message_color() - get color for a message
|
vb@189
|
86 |
//
|
vb@189
|
87 |
// parameters:
|
vb@189
|
88 |
// session (in) session handle
|
vb@189
|
89 |
// msg (in) message to get the color for
|
vb@189
|
90 |
// color (out) color for the message
|
vb@189
|
91 |
//
|
vb@189
|
92 |
// return value:
|
vb@189
|
93 |
// error status or PEP_STATUS_OK on success
|
vb@190
|
94 |
//
|
vb@190
|
95 |
// caveat:
|
vb@190
|
96 |
// msg->from must point to a valid pEp_identity
|
vb@189
|
97 |
|
vb@194
|
98 |
DYNAMIC_API PEP_STATUS get_message_color(
|
vb@189
|
99 |
PEP_SESSION session,
|
vb@190
|
100 |
message *msg,
|
vb@232
|
101 |
PEP_color *color
|
vb@189
|
102 |
);
|
vb@189
|
103 |
|
vb@37
|
104 |
#ifdef __cplusplus
|
vb@37
|
105 |
}
|
vb@37
|
106 |
#endif
|
vb@37
|
107 |
|