pEpCOMServerAdapter.idl
author Markus Schaber <markus@pep-security.net>
Thu, 01 Sep 2016 23:58:16 +0200
branchoutlook_mime_support
changeset 156 8c9f8ce2c3a8
parent 155 0264d4b637a4
child 162 38cdf441c2cb
permissions -rw-r--r--
Hardwire format to PGP/MIME in the com server adapter, as discussed on
dev@.
     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_engine_version([out, retval] BSTR * engine_version);
   108     HRESULT get_languagelist([out, retval] BSTR * languages);
   109     HRESULT get_phrase([in] BSTR lang, [in] LONG phrase_id, [out, retval] BSTR * phrase);
   110 
   111     typedef enum _pEp_comm_type {
   112         pEp_ct_unknown = 0,
   113 
   114         // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
   115 
   116         pEp_ct_no_encryption = 0x01,                // generic
   117         pEp_ct_no_encrypted_channel = 0x02,
   118         pEp_ct_key_not_found = 0x03,
   119         pEp_ct_key_expired = 0x04,
   120         pEp_ct_key_revoked = 0x05,
   121         pEp_ct_key_b0rken = 0x06,
   122         pEp_ct_my_key_not_included = 0x09,
   123 
   124         pEp_ct_security_by_obscurity = 0x0a,
   125         pEp_ct_b0rken_crypto = 0x0b,
   126         pEp_ct_key_too_short = 0x0c,
   127 
   128         pEp_ct_compromized = 0x0e,                  // known compromized connection
   129         pEp_ct_mistrusted = 0x0f,                   // known mistrusted key
   130 
   131         // range 0x10 to 0x3f: unconfirmed encryption
   132 
   133         pEp_ct_unconfirmed_encryption = 0x10,       // generic
   134         pEp_ct_OpenPGP_weak_unconfirmed = 0x11,     // RSA 1024 is weak
   135 
   136         pEp_ct_to_be_checked = 0x20,                // generic
   137         pEp_ct_SMIME_unconfirmed = 0x21,
   138         pEp_ct_CMS_unconfirmed = 0x22,
   139 
   140         pEp_ct_strong_but_unconfirmed = 0x30,       // generic
   141         pEp_ct_OpenPGP_unconfirmed = 0x38,          // key at least 2048 bit RSA or EC
   142         pEp_ct_OTR_unconfirmed = 0x3a,
   143 
   144         // range 0x40 to 0x7f: unconfirmed encryption and anonymization
   145 
   146         pEp_ct_unconfirmed_enc_anon = 0x40,         // generic
   147         pEp_ct_pEp_unconfirmed = 0x7f,
   148 
   149         pEp_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
   150 
   151         // range 0x81 to 0x8f: reserved
   152         // range 0x90 to 0xbf: confirmed encryption
   153 
   154         pEp_ct_confirmed_encryption = 0x90,         // generic
   155         pEp_ct_OpenPGP_weak = 0x91,                 // RSA 1024 is weak
   156 
   157         pEp_ct_to_be_checked_confirmed = 0xa0,      //generic
   158         pEp_ct_SMIME = 0xa1,
   159         pEp_ct_CMS = 0xa2,
   160 
   161         pEp_ct_strong_encryption = 0xb0,            // generic
   162         pEp_ct_OpenPGP = 0xb8,                      // key at least 2048 bit RSA or EC
   163         pEp_ct_OTR = 0xba,
   164 
   165         // range 0xc0 to 0xff: confirmed encryption and anonymization
   166 
   167         pEp_ct_confirmed_enc_anon = 0xc0,           // generic
   168         pEp_ct_pEp = 0xff
   169     } pEp_comm_type;
   170 
   171     [uuid(0CB90E62-8A6A-4CA0-99D7-481704051FF0)] struct pEp_identity_s {
   172         BSTR address;
   173         BSTR fpr;
   174         BSTR user_id;
   175         BSTR username;
   176         pEp_comm_type comm_type;
   177         BSTR lang;
   178     };
   179 
   180     HRESULT get_identity([in] BSTR address, [in] BSTR user_id, [out, retval] struct pEp_identity_s * ident);
   181     HRESULT set_identity([in] struct pEp_identity_s * ident);
   182     HRESULT generate_keypair([in] struct pEp_identity_s * ident, [out, retval] BSTR * fpr);
   183     HRESULT delete_keypair([in] BSTR fpr);
   184     HRESULT import_key([in] BSTR key_data);
   185     HRESULT import_key_b([in] SAFEARRAY(BYTE) key_data);
   186     HRESULT export_key([in] BSTR fpr, [out, retval] BSTR * key_data);
   187     HRESULT recv_key([in] BSTR pattern);
   188     HRESULT find_keys([in] BSTR pattern, [out, retval] SAFEARRAY(BSTR) * key_list);
   189     HRESULT send_key([in] BSTR pattern);
   190 
   191     HRESULT start_keyserver_lookup();
   192     HRESULT stop_keyserver_lookup();
   193 
   194     HRESULT examine_identity([in] struct pEp_identity_s * ident);
   195     HRESULT myself([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   196     HRESULT update_identity([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   197     HRESULT key_compromized([in] struct pEp_identity_s *ident);
   198     HRESULT key_reset_trust([in] struct pEp_identity_s *ident);
   199     HRESULT trust_personal_key([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   200 
   201     // Blacklist API
   202 
   203     HRESULT blacklist_add([in] BSTR fpr);
   204     HRESULT blacklist_delete([in] BSTR fpr);
   205     HRESULT blacklist_is_listed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
   206     HRESULT blacklist_retrieve([out, retval] SAFEARRAY(BSTR) *blacklist);
   207 
   208     // Message API
   209 
   210     typedef enum _pEp_color {
   211         pEp_rating_undefined = 0,
   212         pEp_rating_cannot_decrypt,
   213         pEp_rating_have_no_key,
   214         pEp_rating_unencrypted,
   215         pEp_rating_unencrypted_for_some,
   216         pEp_rating_unreliable,
   217         pEp_rating_reliable,
   218         pEp_rating_yellow = pEp_rating_reliable,
   219         pEp_rating_trusted,
   220         pEp_rating_green = pEp_rating_trusted,
   221         pEp_rating_trusted_and_anonymized,
   222         pEp_rating_fully_anonymous,
   223 
   224         pEp_rating_mistrust = -1,
   225         pEp_rating_red = pEp_rating_mistrust,
   226         pEp_rating_b0rken = -2,
   227         pEp_rating_under_attack = -3
   228     } pEp_color;
   229 
   230     typedef enum _pEp_text_format {
   231         pEp_text_format_plain = 0,
   232         pEp_text_format_html,
   233         pEp_text_format_other = 0xff
   234     } pEp_text_format;
   235 
   236     typedef  enum _pEp_msg_direction {
   237         pEp_dir_incoming = 0,
   238         pEp_dir_outgoing
   239     } pEp_msg_direction;
   240 
   241     typedef  enum _pEp_enc_format {
   242         pEp_enc_none = 0,                       // message is not encrypted
   243         pEp_enc_pieces,                         // inline PGP + PGP extensions
   244         pEp_enc_S_MIME,                         // RFC5751
   245         pEp_enc_PGP_MIME,                       // RFC3156
   246         pEp_enc_pEp                             // pEp encryption format
   247     } pEp_enc_format;
   248 
   249     [uuid(3A8A4F13-3402-4C4C-94AB-598D87869380)] struct opt_field {
   250         BSTR name;
   251         BSTR value;
   252     };
   253 
   254     [uuid(61DA7AD4-192E-4616-8678-B19AEFB45B45)] struct blob {
   255         SAFEARRAY(BYTE) value;
   256         BSTR mime_type;
   257         BSTR filename;
   258     };
   259 
   260     [uuid(D763A8F3-BA23-4229-A037-1BB7BDC3E0C8)] struct text_message {
   261         pEp_msg_direction dir;
   262         BSTR id;
   263         BSTR shortmsg;
   264         BSTR longmsg;
   265         BSTR longmsg_formatted;
   266         SAFEARRAY(struct blob) attachments;
   267         hyper sent;
   268         hyper recv;
   269         struct pEp_identity_s from;
   270         SAFEARRAY(struct pEp_identity_s) to;
   271         struct pEp_identity_s recv_by;
   272         SAFEARRAY(struct pEp_identity_s) cc;
   273         SAFEARRAY(struct pEp_identity_s) bcc;
   274         SAFEARRAY(struct pEp_identity_s) reply_to;
   275         SAFEARRAY(BSTR) references;
   276         SAFEARRAY(BSTR) keywords;
   277         BSTR comments;
   278         SAFEARRAY(struct opt_field) opt_fields;
   279     };
   280 
   281     HRESULT encrypt_message([in] struct text_message *src, [out] struct text_message * dst, [in] SAFEARRAY(BSTR) extra);
   282     HRESULT decrypt_message([in] struct text_message *src, [out] struct text_message * dst, [out] SAFEARRAY(BSTR) *keylist, [out, retval] pEp_color *rating);
   283     HRESULT outgoing_message_color([in] struct text_message *msg, [out, retval] pEp_color * pVal);
   284     HRESULT identity_color([in] struct pEp_identity_s * ident, [out, retval] pEp_color * pVal);
   285 
   286 
   287 	HRESULT register_callbacks([in] IpEpEngineCallbacks* new_callback);
   288 
   289 	HRESULT unregister_callbacks([in] IpEpEngineCallbacks* obsolete_callback);
   290 };
   291 
   292 [
   293     uuid(3EC2E1A4-40E8-48E4-A7B0-1876D34F9462),
   294     version(1.0),
   295 ]
   296 library pEpCOMServerAdapterLib
   297 {
   298     importlib("stdole2.tlb");
   299     [
   300         uuid(B6BC9B8E-D9E2-4419-A3A4-7B4B58175549)
   301     ]
   302     dispinterface _IpEpEngineEvents
   303     {
   304     properties:
   305     methods:
   306 		// test code - remove before shipping
   307 		// [id(1)] HRESULT TestEvent([in] LONG test,[in] BSTR testtest);
   308 	};
   309     [
   310         uuid(EF1B073D-5058-4E0E-829E-B4D22CA21EA2)
   311     ]
   312     coclass pEpEngine {
   313         [default] interface IpEpEngine;
   314         [default, source] dispinterface _IpEpEngineEvents;
   315     };
   316 };