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@259
|
6 |
#include "cryptotech.h"
|
vb@101
|
7 |
|
vb@37
|
8 |
#ifdef __cplusplus
|
vb@37
|
9 |
extern "C" {
|
vb@37
|
10 |
#endif
|
vb@37
|
11 |
|
vb@39
|
12 |
|
vb@235
|
13 |
void import_attached_keys(PEP_SESSION session, const message *msg);
|
vb@236
|
14 |
void attach_own_key(PEP_SESSION session, message *msg);
|
vb@258
|
15 |
PEP_cryptotech determine_encryption_format(message *msg);
|
vb@235
|
16 |
|
vb@39
|
17 |
// encrypt_message() - encrypt message in memory
|
vb@39
|
18 |
//
|
vb@39
|
19 |
// parameters:
|
vb@48
|
20 |
// session (in) session handle
|
vb@48
|
21 |
// src (in) message to encrypt
|
vb@48
|
22 |
// extra (in) extra keys for encryption
|
vb@83
|
23 |
// dst (out) pointer to new encrypted message or NULL on failure
|
vb@84
|
24 |
// enc_format (in) encrypted format
|
vb@39
|
25 |
//
|
vb@39
|
26 |
// return value:
|
vb@48
|
27 |
// PEP_STATUS_OK on success
|
vb@48
|
28 |
// PEP_KEY_NOT_FOUND at least one of the receipient keys
|
vb@48
|
29 |
// could not be found
|
vb@48
|
30 |
// PEP_KEY_HAS_AMBIG_NAME at least one of the receipient keys has
|
vb@48
|
31 |
// an ambiguous name
|
vb@48
|
32 |
// PEP_GET_KEY_FAILED cannot retrieve key
|
vb@83
|
33 |
//
|
vb@83
|
34 |
// caveat:
|
vb@251
|
35 |
// the ownershop of src remains with the caller
|
vb@251
|
36 |
// the ownership of dst goes to the caller
|
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@232
|
47 |
typedef enum _PEP_color {
|
vb@237
|
48 |
PEP_rating_undefined = 0,
|
vb@256
|
49 |
PEP_rating_cannot_decrypt,
|
vb@267
|
50 |
PEP_rating_have_no_key,
|
vb@237
|
51 |
PEP_rating_unencrypted,
|
vb@486
|
52 |
PEP_rating_unencrypted_for_some,
|
vb@237
|
53 |
PEP_rating_unreliable,
|
vb@237
|
54 |
PEP_rating_reliable,
|
vb@237
|
55 |
PEP_rating_yellow = PEP_rating_reliable,
|
vb@237
|
56 |
PEP_rating_trusted,
|
vb@237
|
57 |
PEP_rating_green = PEP_rating_trusted,
|
vb@237
|
58 |
PEP_rating_trusted_and_anonymized,
|
vb@237
|
59 |
PEP_rating_fully_anonymous,
|
vb@189
|
60 |
|
Edouard@442
|
61 |
PEP_rating_mistrust = -1,
|
Edouard@442
|
62 |
PEP_rating_red = PEP_rating_mistrust,
|
Edouard@442
|
63 |
PEP_rating_b0rken = -2,
|
vb@436
|
64 |
PEP_rating_under_attack = -3
|
vb@232
|
65 |
} PEP_color;
|
vb@189
|
66 |
|
vb@251
|
67 |
// decrypt_message() - decrypt message in memory
|
vb@251
|
68 |
//
|
vb@251
|
69 |
// parameters:
|
vb@251
|
70 |
// session (in) session handle
|
vb@251
|
71 |
// src (in) message to decrypt
|
vb@251
|
72 |
// dst (out) pointer to new decrypted message or NULL on failure
|
vb@251
|
73 |
// keylist (out) stringlist with keyids
|
vb@251
|
74 |
// color (out) color for the message
|
vb@251
|
75 |
//
|
vb@251
|
76 |
// return value:
|
vb@251
|
77 |
// error status or PEP_STATUS_OK on success
|
vb@251
|
78 |
//
|
vb@251
|
79 |
// caveat:
|
vb@251
|
80 |
// the ownership of src remains with the caller
|
vb@251
|
81 |
// the ownership of dst goes to the caller
|
vb@251
|
82 |
// the ownership of keylist goes to the caller
|
vb@330
|
83 |
// if src is unencrypted this function returns PEP_UNENCRYPTED and sets
|
vb@330
|
84 |
// dst to NULL
|
vb@251
|
85 |
|
vb@251
|
86 |
DYNAMIC_API PEP_STATUS decrypt_message(
|
vb@251
|
87 |
PEP_SESSION session,
|
vb@251
|
88 |
message *src,
|
vb@251
|
89 |
message **dst,
|
vb@251
|
90 |
stringlist_t **keylist,
|
vb@251
|
91 |
PEP_color *color
|
vb@251
|
92 |
);
|
vb@251
|
93 |
|
vb@251
|
94 |
|
vb@251
|
95 |
// outgoing_message_color() - get color for an outgoing message
|
vb@189
|
96 |
//
|
vb@189
|
97 |
// parameters:
|
vb@189
|
98 |
// session (in) session handle
|
vb@189
|
99 |
// msg (in) message to get the color for
|
vb@189
|
100 |
// color (out) color for the message
|
vb@189
|
101 |
//
|
vb@189
|
102 |
// return value:
|
vb@189
|
103 |
// error status or PEP_STATUS_OK on success
|
vb@190
|
104 |
//
|
vb@190
|
105 |
// caveat:
|
vb@190
|
106 |
// msg->from must point to a valid pEp_identity
|
vb@251
|
107 |
// msg->dir must be PEP_dir_outgoing
|
vb@251
|
108 |
// the ownership of msg remains with the caller
|
vb@189
|
109 |
|
vb@251
|
110 |
DYNAMIC_API PEP_STATUS outgoing_message_color(
|
vb@189
|
111 |
PEP_SESSION session,
|
vb@190
|
112 |
message *msg,
|
vb@232
|
113 |
PEP_color *color
|
vb@189
|
114 |
);
|
vb@189
|
115 |
|
vb@239
|
116 |
|
vb@240
|
117 |
// identity_color() - get color for a single identity
|
vb@239
|
118 |
//
|
vb@239
|
119 |
// parameters:
|
vb@239
|
120 |
// session (in) session handle
|
vb@239
|
121 |
// ident (in) identity to get the color for
|
vb@239
|
122 |
// color (out) color for the identity
|
vb@239
|
123 |
//
|
vb@239
|
124 |
// return value:
|
vb@239
|
125 |
// error status or PEP_STATUS_OK on success
|
vb@251
|
126 |
//
|
vb@251
|
127 |
// caveat:
|
vb@251
|
128 |
// the ownership of ident remains with the caller
|
vb@239
|
129 |
|
vb@240
|
130 |
DYNAMIC_API PEP_STATUS identity_color(
|
vb@239
|
131 |
PEP_SESSION session,
|
vb@239
|
132 |
pEp_identity *ident,
|
vb@239
|
133 |
PEP_color *color
|
vb@239
|
134 |
);
|
vb@239
|
135 |
|
vb@239
|
136 |
|
vb@507
|
137 |
// get_binary_path() - retrieve path of cryptotech binary if available
|
vb@507
|
138 |
//
|
vb@507
|
139 |
// parameters:
|
vb@507
|
140 |
// tech (in) cryptotech to get the binary for
|
vb@507
|
141 |
// path (out) path to cryptotech binary or NULL if not available
|
vb@507
|
142 |
|
vb@507
|
143 |
DYNAMIC_API PEP_STATUS get_binary_path(PEP_cryptotech tech, const char **path);
|
vb@507
|
144 |
|
vb@507
|
145 |
|
vb@37
|
146 |
#ifdef __cplusplus
|
vb@37
|
147 |
}
|
vb@37
|
148 |
#endif
|
vb@37
|
149 |
|