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