pEpCOMServerAdapter.idl
author Markus Schaber <markus@pep-security.net>
Sun, 21 Aug 2016 02:01:20 +0200
branchoutlook_mime_support
changeset 150 316269fc987e
parent 85 8939007c795b
child 155 0264d4b637a4
permissions -rw-r--r--
Add a new overload of the encrypt_message funciton which contains the
pEp_enc_format parameter, this is needed for for the pgp_mime support, as
we need to be able to select the new format.

Using a branch, as the changes need to be analyzed whether they're correct and
really applicable.
     1 // pEpCOMServerAdapter.idl : IDL source for pEpCOMServerAdapter
     2 //
     3 
     4 // This file will be processed by the MIDL tool to
     5 // produce the type library (pEpCOMServerAdapter.tlb) and marshalling code.
     6 
     7 import "oaidl.idl";
     8 import "ocidl.idl";
     9 
    10 
    11 typedef enum _sync_handshake_result_s {
    12 	SYNC_HANDSHAKE_CANCEL_S = -1,
    13 	SYNC_HANDSHAKE_ACCEPTED_S = 0,
    14 	SYNC_HANDSHAKE_REJECTED_S = 1
    15 } sync_handshake_result_s;
    16 
    17 [
    18 	object,
    19 	uuid(3BA1B15B-27EF-433C-B780-0D08F46B0FF3),
    20 	oleautomation,
    21 	nonextensible,
    22 	pointer_default(unique)
    23 ]
    24 interface IpEpEngineCallbacks : IUnknown {
    25 	[id(1)] HRESULT MessageToSend([in] struct text_message * msg);
    26 	[id(2)] HRESULT ShowHandshake([in] struct pEp_identity_s * self, [in] struct pEp_identity_s * partner, [out, retval] sync_handshake_result_s * result);
    27 };
    28 
    29 
    30 [
    31     object,
    32     uuid(9A9F4422-CF0A-45D7-90CD-1D1B7B2A4540),
    33     oleautomation,
    34     nonextensible,
    35     pointer_default(unique)
    36 ]
    37 interface IpEpEngine : IUnknown {
    38     // runtime config of the adapter
    39 
    40     HRESULT verbose_logging([in] VARIANT_BOOL enable);
    41 
    42     // runtime config of the engine
    43 
    44     HRESULT passive_mode([in] VARIANT_BOOL enable);
    45     HRESULT unencrypted_subject([in] VARIANT_BOOL enable);
    46 
    47     // basic API
    48 
    49     typedef enum _pEp_STATUS {
    50         pEp_STATUS_OK = 0,
    51 
    52         pEp_INIT_CANNOT_LOAD_GPGME = 0x0110,
    53         pEp_INIT_GPGME_INIT_FAILED = 0x0111,
    54         pEp_INIT_NO_GPG_HOME = 0x0112,
    55         pEp_INIT_NETPGP_INIT_FAILED = 0x0113,
    56 
    57         pEp_INIT_SQLITE3_WITHOUT_MUTEX = 0x0120,
    58         pEp_INIT_CANNOT_OPEN_DB = 0x0121,
    59         pEp_INIT_CANNOT_OPEN_SYSTEM_DB = 0x0122,
    60 
    61         pEp_KEY_NOT_FOUND = 0x0201,
    62         pEp_KEY_HAS_AMBIG_NAME = 0x0202,
    63         pEp_GET_KEY_FAILED = 0x0203,
    64 
    65         pEp_CANNOT_FIND_IDENTITY = 0x0301,
    66         pEp_CANNOT_SET_PERSON = 0x0381,
    67         pEp_CANNOT_SET_PGP_KEYPAIR = 0x0382,
    68         pEp_CANNOT_SET_IDENTITY = 0x0383,
    69         pEp_CANNOT_SET_TRUST = 0x0384,
    70 
    71         pEp_UNENCRYPTED = 0x0400,
    72         pEp_VERIFIED = 0x0401,
    73         pEp_DECRYPTED = 0x0402,
    74         pEp_DECRYPTED_AND_VERIFIED = 0x0403,
    75         pEp_DECRYPT_WRONG_FORMAT = 0x0404,
    76         pEp_DECRYPT_NO_KEY = 0x0405,
    77         pEp_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
    78         pEp_VERIFY_NO_KEY = 0x0407,
    79         pEp_VERIFIED_AND_TRUSTED = 0x0408,
    80         pEp_CANNOT_DECRYPT_UNKNOWN = 0x04ff,
    81 
    82         pEp_TRUSTWORD_NOT_FOUND = 0x0501,
    83 
    84         pEp_CANNOT_CREATE_KEY = 0x0601,
    85         pEp_CANNOT_SEND_KEY = 0x0602,
    86 
    87         pEp_PHRASE_NOT_FOUND = 0x0701,
    88 
    89         pEp_COMMIT_FAILED = 0xff01,
    90 
    91         pEp_CANNOT_CREATE_TEMP_FILE = -5,
    92         pEp_ILLEGAL_VALUE = -4,
    93         pEp_BUFFER_TOO_SMALL = -3,
    94         pEp_OUT_OF_MEMORY = -2,
    95         pEp_UNKNOWN_ERROR = -1
    96     } pEp_STATUS;
    97 
    98     HRESULT log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
    99     HRESULT decrypt([in] BSTR ctext, [out] BSTR * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
   100     HRESULT decrypt_b([in] BSTR ctext, [out] SAFEARRAY(BYTE) * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
   101     HRESULT encrypt([in] SAFEARRAY(BSTR) key_list, [in] BSTR ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
   102     HRESULT encrypt_b([in] SAFEARRAY(BSTR) key_list, [in] SAFEARRAY(BYTE) ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
   103     HRESULT verify([in] BSTR text, [in] BSTR signature, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * verify_status);
   104     HRESULT trustword([in] LONG value, [in, defaultvalue("en")] BSTR lang, [out, retval] BSTR * word);
   105     HRESULT trustwords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG max_words, [out, retval] BSTR * words);
   106     HRESULT get_crashdump_log([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
   107     HRESULT get_languagelist([out, retval] BSTR * languages);
   108     HRESULT get_phrase([in] BSTR lang, [in] LONG phrase_id, [out, retval] BSTR * phrase);
   109 
   110     typedef enum _pEp_comm_type {
   111         pEp_ct_unknown = 0,
   112 
   113         // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
   114 
   115         pEp_ct_no_encryption = 0x01,                // generic
   116         pEp_ct_no_encrypted_channel = 0x02,
   117         pEp_ct_key_not_found = 0x03,
   118         pEp_ct_key_expired = 0x04,
   119         pEp_ct_key_revoked = 0x05,
   120         pEp_ct_key_b0rken = 0x06,
   121         pEp_ct_my_key_not_included = 0x09,
   122 
   123         pEp_ct_security_by_obscurity = 0x0a,
   124         pEp_ct_b0rken_crypto = 0x0b,
   125         pEp_ct_key_too_short = 0x0c,
   126 
   127         pEp_ct_compromized = 0x0e,                  // known compromized connection
   128         pEp_ct_mistrusted = 0x0f,                   // known mistrusted key
   129 
   130         // range 0x10 to 0x3f: unconfirmed encryption
   131 
   132         pEp_ct_unconfirmed_encryption = 0x10,       // generic
   133         pEp_ct_OpenPGP_weak_unconfirmed = 0x11,     // RSA 1024 is weak
   134 
   135         pEp_ct_to_be_checked = 0x20,                // generic
   136         pEp_ct_SMIME_unconfirmed = 0x21,
   137         pEp_ct_CMS_unconfirmed = 0x22,
   138 
   139         pEp_ct_strong_but_unconfirmed = 0x30,       // generic
   140         pEp_ct_OpenPGP_unconfirmed = 0x38,          // key at least 2048 bit RSA or EC
   141         pEp_ct_OTR_unconfirmed = 0x3a,
   142 
   143         // range 0x40 to 0x7f: unconfirmed encryption and anonymization
   144 
   145         pEp_ct_unconfirmed_enc_anon = 0x40,         // generic
   146         pEp_ct_pEp_unconfirmed = 0x7f,
   147 
   148         pEp_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
   149 
   150         // range 0x81 to 0x8f: reserved
   151         // range 0x90 to 0xbf: confirmed encryption
   152 
   153         pEp_ct_confirmed_encryption = 0x90,         // generic
   154         pEp_ct_OpenPGP_weak = 0x91,                 // RSA 1024 is weak
   155 
   156         pEp_ct_to_be_checked_confirmed = 0xa0,      //generic
   157         pEp_ct_SMIME = 0xa1,
   158         pEp_ct_CMS = 0xa2,
   159 
   160         pEp_ct_strong_encryption = 0xb0,            // generic
   161         pEp_ct_OpenPGP = 0xb8,                      // key at least 2048 bit RSA or EC
   162         pEp_ct_OTR = 0xba,
   163 
   164         // range 0xc0 to 0xff: confirmed encryption and anonymization
   165 
   166         pEp_ct_confirmed_enc_anon = 0xc0,           // generic
   167         pEp_ct_pEp = 0xff
   168     } pEp_comm_type;
   169 
   170     [uuid(0CB90E62-8A6A-4CA0-99D7-481704051FF0)] struct pEp_identity_s {
   171         BSTR address;
   172         BSTR fpr;
   173         BSTR user_id;
   174         BSTR username;
   175         pEp_comm_type comm_type;
   176         BSTR lang;
   177     };
   178 
   179     HRESULT get_identity([in] BSTR address, [in] BSTR user_id, [out, retval] struct pEp_identity_s * ident);
   180     HRESULT set_identity([in] struct pEp_identity_s * ident);
   181     HRESULT generate_keypair([in] struct pEp_identity_s * ident, [out, retval] BSTR * fpr);
   182     HRESULT delete_keypair([in] BSTR fpr);
   183     HRESULT import_key([in] BSTR key_data);
   184     HRESULT import_key_b([in] SAFEARRAY(BYTE) key_data);
   185     HRESULT export_key([in] BSTR fpr, [out, retval] BSTR * key_data);
   186     HRESULT recv_key([in] BSTR pattern);
   187     HRESULT find_keys([in] BSTR pattern, [out, retval] SAFEARRAY(BSTR) * key_list);
   188     HRESULT send_key([in] BSTR pattern);
   189 
   190     HRESULT start_keyserver_lookup();
   191     HRESULT stop_keyserver_lookup();
   192 
   193     HRESULT examine_identity([in] struct pEp_identity_s * ident);
   194     HRESULT myself([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   195     HRESULT update_identity([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   196     HRESULT key_compromized([in] struct pEp_identity_s *ident);
   197     HRESULT key_reset_trust([in] struct pEp_identity_s *ident);
   198     HRESULT trust_personal_key([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   199 
   200     // Blacklist API
   201 
   202     HRESULT blacklist_add([in] BSTR fpr);
   203     HRESULT blacklist_delete([in] BSTR fpr);
   204     HRESULT blacklist_is_listed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
   205     HRESULT blacklist_retrieve([out, retval] SAFEARRAY(BSTR) *blacklist);
   206 
   207     // Message API
   208 
   209     typedef enum _pEp_color {
   210         pEp_rating_undefined = 0,
   211         pEp_rating_cannot_decrypt,
   212         pEp_rating_have_no_key,
   213         pEp_rating_unencrypted,
   214         pEp_rating_unencrypted_for_some,
   215         pEp_rating_unreliable,
   216         pEp_rating_reliable,
   217         pEp_rating_yellow = pEp_rating_reliable,
   218         pEp_rating_trusted,
   219         pEp_rating_green = pEp_rating_trusted,
   220         pEp_rating_trusted_and_anonymized,
   221         pEp_rating_fully_anonymous,
   222 
   223         pEp_rating_mistrust = -1,
   224         pEp_rating_red = pEp_rating_mistrust,
   225         pEp_rating_b0rken = -2,
   226         pEp_rating_under_attack = -3
   227     } pEp_color;
   228 
   229     typedef enum _pEp_text_format {
   230         pEp_text_format_plain = 0,
   231         pEp_text_format_html,
   232         pEp_text_format_other = 0xff
   233     } pEp_text_format;
   234 
   235     typedef  enum _pEp_msg_direction {
   236         pEp_dir_incoming = 0,
   237         pEp_dir_outgoing
   238     } pEp_msg_direction;
   239 
   240     typedef  enum _pEp_enc_format {
   241         pEp_enc_none = 0,                       // message is not encrypted
   242         pEp_enc_pieces,                         // inline PGP + PGP extensions
   243         pEp_enc_S_MIME,                         // RFC5751
   244         pEp_enc_PGP_MIME,                       // RFC3156
   245         pEp_enc_pEp                             // pEp encryption format
   246     } pEp_enc_format;
   247 
   248     [uuid(3A8A4F13-3402-4C4C-94AB-598D87869380)] struct opt_field {
   249         BSTR name;
   250         BSTR value;
   251     };
   252 
   253     [uuid(61DA7AD4-192E-4616-8678-B19AEFB45B45)] struct blob {
   254         SAFEARRAY(BYTE) value;
   255         BSTR mime_type;
   256         BSTR filename;
   257     };
   258 
   259     [uuid(D763A8F3-BA23-4229-A037-1BB7BDC3E0C8)] struct text_message {
   260         pEp_msg_direction dir;
   261         BSTR id;
   262         BSTR shortmsg;
   263         BSTR longmsg;
   264         BSTR longmsg_formatted;
   265         SAFEARRAY(struct blob) attachments;
   266         hyper sent;
   267         hyper recv;
   268         struct pEp_identity_s from;
   269         SAFEARRAY(struct pEp_identity_s) to;
   270         struct pEp_identity_s recv_by;
   271         SAFEARRAY(struct pEp_identity_s) cc;
   272         SAFEARRAY(struct pEp_identity_s) bcc;
   273         SAFEARRAY(struct pEp_identity_s) reply_to;
   274         SAFEARRAY(BSTR) references;
   275         SAFEARRAY(BSTR) keywords;
   276         BSTR comments;
   277         SAFEARRAY(struct opt_field) opt_fields;
   278     };
   279 
   280     HRESULT encrypt_message([in] struct text_message *src, [out] struct text_message * dst, [in] SAFEARRAY(BSTR) extra);
   281     HRESULT decrypt_message([in] struct text_message *src, [out] struct text_message * dst, [out] SAFEARRAY(BSTR) *keylist, [out, retval] pEp_color *rating);
   282     HRESULT outgoing_message_color([in] struct text_message *msg, [out, retval] pEp_color * pVal);
   283     HRESULT identity_color([in] struct pEp_identity_s * ident, [out, retval] pEp_color * pVal);
   284 
   285 
   286 	HRESULT register_callbacks([in] IpEpEngineCallbacks* new_callback);
   287 
   288 	HRESULT unregister_callbacks([in] IpEpEngineCallbacks* obsolete_callback);
   289 
   290 	// new members should be added to the end of this list...
   291 	HRESULT encrypt_message_ex([in] struct text_message *src, [out] struct text_message * dst, [in] SAFEARRAY(BSTR) extra, [in] pEp_enc_format enc_format);
   292 };
   293 
   294 [
   295     uuid(3EC2E1A4-40E8-48E4-A7B0-1876D34F9462),
   296     version(1.0),
   297 ]
   298 library pEpCOMServerAdapterLib
   299 {
   300     importlib("stdole2.tlb");
   301     [
   302         uuid(B6BC9B8E-D9E2-4419-A3A4-7B4B58175549)
   303     ]
   304     dispinterface _IpEpEngineEvents
   305     {
   306     properties:
   307     methods:
   308 		// test code - remove before shipping
   309 		// [id(1)] HRESULT TestEvent([in] LONG test,[in] BSTR testtest);
   310 	};
   311     [
   312         uuid(EF1B073D-5058-4E0E-829E-B4D22CA21EA2)
   313     ]
   314     coclass pEpEngine {
   315         [default] interface IpEpEngine;
   316         [default, source] dispinterface _IpEpEngineEvents;
   317     };
   318 };