|
|
@ -7,6 +7,70 @@ |
|
|
|
// written by Volker Birk |
|
|
|
|
|
|
|
|
|
|
|
enum text_format { |
|
|
|
hex text_format_plain 0x0; |
|
|
|
hex text_format_html 0x01; |
|
|
|
hex text_format_other 0xff; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum msg_direction { |
|
|
|
hex dir_incoming 0x0; |
|
|
|
hex dir_outgoing 0x01; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum enc_format { |
|
|
|
hex enc_none 0x0 doc='message is not encrypted'; |
|
|
|
hex enc_pieces 0x01 doc='inline PGP + PGP extensions'; |
|
|
|
hex enc_S_MIME 0x02 doc='RFC5751'; |
|
|
|
hex enc_PGP_MIME 0x04 doc='RFC3156'; |
|
|
|
hex enc_PEP 0x08 doc='pEp encryption format'; |
|
|
|
hex enc_PGP_MIME_Outlook1 0x10 doc='Message B0rken by Outlook type 1'; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum message_wrap_type { |
|
|
|
message_default doc='typical inner/outer message 2.0'; |
|
|
|
message_transport doc='e.g. for onion layers'; |
|
|
|
message_key_reset doc='for wrapped key reset information'; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
struct message { |
|
|
|
field msg_direction dir; |
|
|
|
field string id doc='UTF-8 string of message ID'; |
|
|
|
field string shortmsg doc='UTF-8 string of short message'; |
|
|
|
field string longmsg doc='UTF-8 string of long message'(plain)'; |
|
|
|
field string longmsg_formatted doc='UTF-8 string of long message (formatted)'; |
|
|
|
field bloblist_t attachments doc='blobs with attachements'; |
|
|
|
field char rawmsg_ref doc='reference to raw message data'; |
|
|
|
field size_t rawmsg_size doc='size of raw message data'; |
|
|
|
field timestamp sent doc='when the message is sent'; |
|
|
|
field timestamp recv doc='when the message is received'; |
|
|
|
field pEp_identity from doc='whom the message is from'; |
|
|
|
field identity_list to doc='whom the message is to'; |
|
|
|
field pEp_identity recv_by doc='via which identity the message is received'; |
|
|
|
field identity_list cc doc='whom a CC is being sent'; |
|
|
|
field identity_list bcc doc='whom a BCC is being sent'; |
|
|
|
field identity_list reply_to doc='where a reply should go to'; |
|
|
|
field string in_reply_to doc='list of UTF-8 strings with MessageIDs of refering messages'; |
|
|
|
field struct _message refering_msg_ref doc='reference to refering message'; |
|
|
|
field string references doc='list of UTF-8 strings with references'; |
|
|
|
field struct _message_ref_list refered_by doc='list of references to messages being refered'; |
|
|
|
field string keywords doc='list of UTF-8 strings with keywords'; |
|
|
|
field string char comments doc='UTF-8 string with comments'; |
|
|
|
field stringpair_list_t opt_fields doc='optional fields'; |
|
|
|
field enc_format enc_format doc='format of encrypted data'; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
struct message_ref_list { |
|
|
|
field message msg_ref doc='reference to message'; |
|
|
|
field struct _message_ref_list next; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protocol session { |
|
|
|
method encrypt_message |
|
|
|
doc="encrypt message in memory" |
|
|
@ -26,9 +90,9 @@ protocol session { |
|
|
|
doc=""" |
|
|
|
pointer to new encrypted message or #NV if no encryption could |
|
|
|
take place |
|
|
|
""" |
|
|
|
"""; |
|
|
|
|
|
|
|
use enc_format enc_format doc="encrypted format"; |
|
|
|
use enc_format format doc="encrypted format"; |
|
|
|
|
|
|
|
// flags |
|
|
|
|
|
|
@ -39,19 +103,18 @@ protocol session { |
|
|
|
flag force_no_attached_key 0x4; |
|
|
|
flag inner_message 0x8 doc='This is mainly used by pEp clients to send private keys to their own PGP-only device.'; |
|
|
|
flag force_version_1 0x10 doc='This is mainly used by pEp clients to send private keys to their own PGP-only device'; |
|
|
|
flag key_reset_only 0x20 |
|
|
|
flag key_reset_only 0x20; |
|
|
|
} |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
|
throws key_has_ambig_name |
|
|
|
doc="at least one of the receipient keys has an ambiguous name"; |
|
|
|
throws key_has_ambig_name doc="at least one of the receipient keys has an ambiguous name"; |
|
|
|
|
|
|
|
throws unencrypted |
|
|
|
doc=""" |
|
|
|
on demand or no recipients with usable key, is left unencrypted, |
|
|
|
and key is attached to it |
|
|
|
""" |
|
|
|
"""; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -63,12 +126,12 @@ protocol session { |
|
|
|
use message src doc="message to encrypt"; |
|
|
|
|
|
|
|
create message dst |
|
|
|
doc="pointer to new encrypted message or NULL if no encryption could take place"; |
|
|
|
doc="pointer to new encrypted message or NULL if no encryption could take place"; |
|
|
|
|
|
|
|
const char to_fpr |
|
|
|
doc="fingerprint of the recipient key to which the private key should be encrypted"; |
|
|
|
use const char to_fpr |
|
|
|
doc="fingerprint of the recipient key to which the private key should be encrypted"; |
|
|
|
|
|
|
|
use enc_format enc_format doc="encrypted format"; |
|
|
|
use enc_format format doc="encrypted format"; |
|
|
|
|
|
|
|
// flags |
|
|
|
|
|
|
@ -79,19 +142,18 @@ protocol session { |
|
|
|
flag force_no_attached_key 0x4; |
|
|
|
flag inner_message 0x8 doc='This is mainly used by pEp clients to send private keys to their own PGP-only device.'; |
|
|
|
flag force_version_1 0x10 doc='This is mainly used by pEp clients to send private keys to their own PGP-only device'; |
|
|
|
flag key_reset_only 0x20 |
|
|
|
flag key_reset_only 0x20; |
|
|
|
} |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
|
throws key_has_ambig_name |
|
|
|
doc="at least one of the receipient keys has an ambiguous name"; |
|
|
|
throws key_has_ambig_name doc="at least one of the receipient keys has an ambiguous name"; |
|
|
|
|
|
|
|
throws unencrypted |
|
|
|
doc=""" |
|
|
|
on demand or no recipients with usable key, is left unencrypted, |
|
|
|
and key is attached to it |
|
|
|
""" |
|
|
|
"""; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -105,17 +167,17 @@ protocol session { |
|
|
|
|
|
|
|
use identity target_id |
|
|
|
doc=""" |
|
|
|
self identity this message should be encrypted for. message is NOT encrypted for |
|
|
|
identities other than the target_id (and then, only if the target_id refers to self!) |
|
|
|
self identity this message should be encrypted for. Message is NOT encrypted for |
|
|
|
identities other than the target_id (and then, only if the target_id refers to self!). |
|
|
|
"""; |
|
|
|
|
|
|
|
use message src doc="message to encrypt"; |
|
|
|
|
|
|
|
provide hash_list extra doc="extra keys for encryption"; |
|
|
|
use hash_list extra doc="extra keys for encryption"; |
|
|
|
|
|
|
|
create message dst doc="pointer to new encrypted message or NULL on failure"; |
|
|
|
|
|
|
|
use enc_format enc_format? doc="encrypted format"; |
|
|
|
use enc_format format doc="encrypted format"; |
|
|
|
|
|
|
|
// flags |
|
|
|
|
|
|
@ -126,59 +188,16 @@ protocol session { |
|
|
|
flag force_no_attached_key 0x4; |
|
|
|
flag inner_message 0x8 doc='This is mainly used by pEp clients to send private keys to their own PGP-only device.'; |
|
|
|
flag force_version_1 0x10 doc='This is mainly used by pEp clients to send private keys to their own PGP-only device'; |
|
|
|
flag key_reset_only 0x20 |
|
|
|
flag key_reset_only 0x20; |
|
|
|
} |
|
|
|
|
|
|
|
// exceptions |
|
|
|
// exceptions doc="(FIXME: This may not be correct or complete)" |
|
|
|
|
|
|
|
throws key_not_found |
|
|
|
doc="at least one of the receipient keys could not be found"; |
|
|
|
throws key_not_found doc="at least one of the receipient keys could not be found"; |
|
|
|
|
|
|
|
throws key_has_ambig_name |
|
|
|
doc="at least one of the receipient keys has an ambiguous name"; |
|
|
|
throws key_has_ambig_name doc="at least one of the receipient keys has an ambiguous name"; |
|
|
|
|
|
|
|
throws get_key_failed |
|
|
|
doc="cannot retrieve key" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
method color_from_rating |
|
|
|
doc="calculate color from rating" |
|
|
|
{ |
|
|
|
// parms |
|
|
|
|
|
|
|
provide color_from_rating rating |
|
|
|
doc="color representing that rating"; |
|
|
|
|
|
|
|
// ratings |
|
|
|
|
|
|
|
ratings { |
|
|
|
rating_undefined 0; |
|
|
|
rating_cannot_decrypt, |
|
|
|
rating_have_no_key, |
|
|
|
rating_unencrypted, |
|
|
|
rating_unencrypted_for_some doc="don't use this any more", |
|
|
|
rating_unreliable, |
|
|
|
rating_reliable, |
|
|
|
rating_trusted, |
|
|
|
rating_trusted_and_anonymized, |
|
|
|
rating_fully_anonymous, |
|
|
|
rating_mistrust -1; |
|
|
|
rating_b0rken -2; |
|
|
|
rating_under_attack -3 |
|
|
|
} |
|
|
|
|
|
|
|
// colors |
|
|
|
|
|
|
|
colors { |
|
|
|
color_no_color 0; |
|
|
|
color_yellow, |
|
|
|
color_green, |
|
|
|
color_red -1 |
|
|
|
} |
|
|
|
|
|
|
|
// return value |
|
|
|
doc="color representing that rating" |
|
|
|
throws get_key_failed doc="cannot retrieve key"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -195,8 +214,7 @@ protocol session { |
|
|
|
etc) intentionally; when this happens, decrypt_flag_src_modified is set. |
|
|
|
"""; |
|
|
|
|
|
|
|
create message dst |
|
|
|
doc="pointer to new decrypted message or NULL on failure"; |
|
|
|
create message dst doc="pointer to new decrypted message or NULL on failure"; |
|
|
|
|
|
|
|
supply hash_list keylist |
|
|
|
doc=""" |
|
|
@ -205,10 +223,11 @@ protocol session { |
|
|
|
out: stringlist with keyids used for signing and encryption. first |
|
|
|
first key is signer, additional keys are the ones it was encrypted |
|
|
|
to. Only signer and whichever of the user's keys was used are reliable. |
|
|
|
The ownership of keylist goes to the caller. |
|
|
|
If src is unencrypted this function returns unencrypted and sets dst to NULL. |
|
|
|
"""; |
|
|
|
|
|
|
|
return rating rating |
|
|
|
doc="rating for the message"; |
|
|
|
return rating msg_rating doc="rating for the message"; |
|
|
|
|
|
|
|
// flags |
|
|
|
|
|
|
@ -217,7 +236,7 @@ protocol session { |
|
|
|
doc=""" |
|
|
|
private key was imported for one of our addresses (NOT trusted |
|
|
|
or set to be used - handshake/trust is required for that) |
|
|
|
""" |
|
|
|
"""; |
|
|
|
decrypt_flag_consume 0x2 doc=’used by sync'; |
|
|
|
decrypt_flag_ignore 0x4 doc=’used by sync'; |
|
|
|
decrypt_flag_src_modified 0x8 |
|
|
@ -231,13 +250,12 @@ protocol session { |
|
|
|
doc=""" |
|
|
|
input flags. Used to signal that decrypt function should engage in behaviour |
|
|
|
specified for when the server storing the source is untrusted. |
|
|
|
""" |
|
|
|
"""; |
|
|
|
} |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
|
throws decrypted |
|
|
|
doc="if message decrypted but not verified"; |
|
|
|
throws decrypted doc="if message decrypted but not verified"; |
|
|
|
|
|
|
|
throws cannot_reencrypt |
|
|
|
doc=""" |
|
|
@ -249,12 +267,19 @@ protocol session { |
|
|
|
doc=""" |
|
|
|
if src is unencrypted this function returns unencrypted and sets |
|
|
|
dst to NULL. |
|
|
|
""" |
|
|
|
"""; |
|
|
|
|
|
|
|
throws any doc="error status"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
method own_message_private_key_details |
|
|
|
doc="details on own key in own message" |
|
|
|
doc=""" |
|
|
|
details on own key in own message. Note: In order to obtain details about key |
|
|
|
to be possibly imported as a replacement of key currently used as own identity, |
|
|
|
application passes message that have been previously flagged by decrypt_message() |
|
|
|
as own message containing own key to this function. |
|
|
|
""" |
|
|
|
{ |
|
|
|
//parms |
|
|
|
|
|
|
@ -264,8 +289,11 @@ protocol session { |
|
|
|
can check own signature. |
|
|
|
"""; |
|
|
|
|
|
|
|
create identity ident |
|
|
|
doc="identity containing uid, address and fpr of key" |
|
|
|
create identity ident doc="identity containing uid, address and fpr of key"; |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
|
throws any doc="error status" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -280,8 +308,11 @@ protocol session { |
|
|
|
Dir must be dir_outgoing. |
|
|
|
"""; |
|
|
|
|
|
|
|
create rating rating |
|
|
|
doc="rating for the message" |
|
|
|
return rating msg_rating doc="rating for the message"; |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
|
throws any doc="error status" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -296,8 +327,11 @@ protocol session { |
|
|
|
Dir must be dir_outgoing. |
|
|
|
"""; |
|
|
|
|
|
|
|
create rating rating |
|
|
|
doc="rating preview for the message" |
|
|
|
return rating msg_rating doc="rating preview for the message"; |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
|
throws any doc="error status" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -306,27 +340,13 @@ protocol session { |
|
|
|
{ |
|
|
|
//parms |
|
|
|
|
|
|
|
use identity ident |
|
|
|
doc="identity to get the rating for"; |
|
|
|
|
|
|
|
create rating rating |
|
|
|
doc="rating for the identity" |
|
|
|
} |
|
|
|
|
|
|
|
use identity ident doc="identity to get the rating for"; |
|
|
|
|
|
|
|
method get_binary_path |
|
|
|
doc="retrieve path of cryptotech binary if available" |
|
|
|
{ |
|
|
|
//parms |
|
|
|
return rating identity_rating doc="rating for the identity"; |
|
|
|
|
|
|
|
use @type tech |
|
|
|
doc="cryptotech to get the binary for"; |
|
|
|
// exceptions |
|
|
|
|
|
|
|
use @type path |
|
|
|
doc=""" |
|
|
|
path to cryptotech binary or NULL if not available. **path is owned by |
|
|
|
the library, do not change it! |
|
|
|
""" |
|
|
|
throws any doc="error status" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -335,14 +355,11 @@ protocol session { |
|
|
|
{ |
|
|
|
//parms |
|
|
|
|
|
|
|
provide const identity id1 |
|
|
|
doc="identity of first party in communication - fpr can't be NULL"; |
|
|
|
use const identity id1 doc="identity of first party in communication - fpr can't be NULL"; |
|
|
|
|
|
|
|
provide const identity id2 |
|
|
|
doc="identity of second party in communication - fpr can't be NULL"; |
|
|
|
use const identity id2 doc="identity of second party in communication - fpr can't be NULL"; |
|
|
|
|
|
|
|
provide const char lang |
|
|
|
doc="C string with ISO 639-1 language code"; |
|
|
|
use const char lang doc="C string with ISO 639-1 language code"; |
|
|
|
|
|
|
|
create char words |
|
|
|
doc=""" |
|
|
@ -353,15 +370,14 @@ protocol session { |
|
|
|
The caller is responsible to free() it (on Windoze use pEp_free()) |
|
|
|
"""; |
|
|
|
|
|
|
|
create size_t wsize |
|
|
|
doc="length of full trustwords string"; |
|
|
|
create size_t wsize doc="length of full trustwords string"; |
|
|
|
|
|
|
|
provide bool full |
|
|
|
use bool full |
|
|
|
doc=""" |
|
|
|
if true, generate ALL trustwords for these identities. |
|
|
|
else, generate a fixed-size subset. (TODO: fixed-minimum-entropy |
|
|
|
subset in next version) |
|
|
|
""" |
|
|
|
"""; |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
@ -369,7 +385,7 @@ protocol session { |
|
|
|
doc="out of memory"; |
|
|
|
|
|
|
|
throws trustword_not_found |
|
|
|
doc="at least one trustword not found" |
|
|
|
doc="at least one trustword not found"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -378,17 +394,14 @@ protocol session { |
|
|
|
{ |
|
|
|
//parms |
|
|
|
|
|
|
|
provide message msg |
|
|
|
doc="message to get sender identity from"; |
|
|
|
use message msg doc="message to get sender identity from"; |
|
|
|
|
|
|
|
provide hash_list keylist |
|
|
|
use hash_list keylist |
|
|
|
doc="NULL if message to be decrypted, keylist returned by decrypt_message() otherwise."; |
|
|
|
|
|
|
|
provide identity received_by |
|
|
|
doc="identity for account receiving message can't be NULL"; |
|
|
|
use identity received_by doc="identity for account receiving message can't be NULL"; |
|
|
|
|
|
|
|
provide const char lang |
|
|
|
doc="C string with ISO 639-1 language code"; |
|
|
|
use string lang doc="C string with ISO 639-1 language code"; |
|
|
|
|
|
|
|
create char words |
|
|
|
doc=""" |
|
|
@ -398,20 +411,20 @@ protocol session { |
|
|
|
The caller is responsible to free() it (on Windoze use pEp_free()) |
|
|
|
"""; |
|
|
|
|
|
|
|
provide bool full |
|
|
|
use bool full |
|
|
|
doc=""" |
|
|
|
if true, generate ALL trustwords for these identities. |
|
|
|
else, generate a fixed-size subset. (TODO: fixed-minimum-entropy |
|
|
|
subset in next version) |
|
|
|
""" |
|
|
|
"""; |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
|
throws out_of_memory |
|
|
|
doc="out of memory"; |
|
|
|
throws out_of_memory doc="out of memory"; |
|
|
|
|
|
|
|
throws trustword_not_found |
|
|
|
doc="at least one trustword not found" |
|
|
|
throws trustword_not_found doc="at least one trustword not found"; |
|
|
|
|
|
|
|
throws like decrypt_message doc="error status of decrypt_message() if decryption fails" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -423,14 +436,11 @@ protocol session { |
|
|
|
use message msg |
|
|
|
doc="message to get the rating for. msg->from must point to a valid pEp_identity"; |
|
|
|
|
|
|
|
use hash_list x_keylist |
|
|
|
doc="decrypted message recipients keys fpr"; |
|
|
|
use hash_list x_keylist doc="decrypted message recipients keys fpr"; |
|
|
|
|
|
|
|
provide rating x_enc_status |
|
|
|
doc="original rating for the decrypted message"; |
|
|
|
use rating x_enc_status doc="original rating for the decrypted message"; |
|
|
|
|
|
|
|
create message rating |
|
|
|
doc="rating for the message" |
|
|
|
return rating msg_rating doc="rating for the message"; |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
@ -441,8 +451,7 @@ protocol session { |
|
|
|
contain X-Keylist optional field and x_keylist is NULL. |
|
|
|
"""; |
|
|
|
|
|
|
|
throws out_of_memory |
|
|
|
doc="if not enough memory could be allocated" |
|
|
|
throws out_of_memory doc="if not enough memory could be allocated"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -451,14 +460,11 @@ protocol session { |
|
|
|
{ |
|
|
|
//parms |
|
|
|
|
|
|
|
provide const char user_id |
|
|
|
doc="string with user ID"; |
|
|
|
use string user_id doc="string with user ID"; |
|
|
|
|
|
|
|
provide const char fpr |
|
|
|
doc="string with fingerprint"; |
|
|
|
use string fpr doc="string with fingerprint"; |
|
|
|
|
|
|
|
create rating rating |
|
|
|
doc="rating of key for this user" |
|
|
|
return rating key_rating doc="rating of key for this user"; |
|
|
|
|
|
|
|
// exceptions |
|
|
|
|
|
|
@ -468,11 +474,37 @@ protocol session { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func color_from_rating |
|
|
|
doc="calculate color from rating" |
|
|
|
{ |
|
|
|
// parms |
|
|
|
|
|
|
|
provide color_from_rating rating doc="color representing that rating" |
|
|
|
|
|
|
|
// return value |
|
|
|
return color rating_color doc="color representing that rating" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func get_binary_path |
|
|
|
doc="retrieve path of cryptotech binary if available" |
|
|
|
{ |
|
|
|
//parms |
|
|
|
|
|
|
|
use cryptotech tech |
|
|
|
doc="cryptotech to get the binary for"; |
|
|
|
|
|
|
|
use string path |
|
|
|
doc=""" |
|
|
|
path to cryptotech binary or NULL if not available. **path is owned by |
|
|
|
the library, do not change it!; |
|
|
|
""" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -484,6 +516,37 @@ protocol session { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ratings |
|
|
|
|
|
|
|
ratings { |
|
|
|
item rating_undefined 0; |
|
|
|
item rating_cannot_decrypt 1; |
|
|
|
item rating_have_no_key 2; |
|
|
|
item rating_unencrypted 3; |
|
|
|
item rating_unencrypted_for_some doc="don't use this any more", |
|
|
|
item rating_unreliable 4; |
|
|
|
item rating_reliable 5; |
|
|
|
item rating_trusted 6; |
|
|
|
item rating_trusted_and_anonymized 7; |
|
|
|
item rating_fully_anonymous 8; |
|
|
|
item rating_mistrust -1; |
|
|
|
item rating_b0rken -2; |
|
|
|
item rating_under_attack -3; |
|
|
|
} |
|
|
|
|
|
|
|
// colors |
|
|
|
|
|
|
|
colors { |
|
|
|
item color_no_color 0; |
|
|
|
item color_yellow 1; |
|
|
|
item color_green 2; |
|
|
|
item color_red -1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|