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