pEpCOMServerAdapter.idl
author Volker Birk <vb@pep-project.org>
Mon, 07 Mar 2016 15:28:09 +0100
changeset 62 e01f81c9c881
parent 61 d5bf2b6538f8
child 65 4736900394cb
permissions -rw-r--r--
updateing to pEpEngine
     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, [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     // Message API
   181 
   182     typedef enum _pEp_color {
   183         pEp_rating_undefined = 0,
   184         pEp_rating_cannot_decrypt,
   185         pEp_rating_have_no_key,
   186         pEp_rating_unencrypted,
   187         pEp_rating_unencrypted_for_some,
   188         pEp_rating_unreliable,
   189         pEp_rating_reliable,
   190         pEp_rating_yellow = pEp_rating_reliable,
   191         pEp_rating_trusted,
   192         pEp_rating_green = pEp_rating_trusted,
   193         pEp_rating_trusted_and_anonymized,
   194         pEp_rating_fully_anonymous,
   195 
   196         pEp_rating_mistrust = -1,
   197         pEp_rating_red = pEp_rating_mistrust,
   198         pEp_rating_b0rken = -2,
   199         pEp_rating_under_attack = -3
   200     } pEp_color;
   201 
   202     typedef enum _pEp_text_format {
   203         pEp_text_format_plain = 0,
   204         pEp_text_format_html,
   205         pEp_text_format_other = 0xff
   206     } pEp_text_format;
   207 
   208     typedef  enum _pEp_msg_direction {
   209         pEp_dir_incoming = 0,
   210         pEp_dir_outgoing
   211     } pEp_msg_direction;
   212 
   213     typedef  enum _pEp_enc_format {
   214         pEp_enc_none = 0,                       // message is not encrypted
   215         pEp_enc_pieces,                         // inline PGP + PGP extensions
   216         pEp_enc_S_MIME,                         // RFC5751
   217         pEp_enc_PGP_MIME,                       // RFC3156
   218         pEp_enc_pEp                             // pEp encryption format
   219     } pEp_enc_format;
   220 
   221     [uuid(3A8A4F13-3402-4C4C-94AB-598D87869380)] struct opt_field {
   222         BSTR name;
   223         BSTR value;
   224     };
   225 
   226     [uuid(61DA7AD4-192E-4616-8678-B19AEFB45B45)] struct blob {
   227         SAFEARRAY(BYTE) value;
   228         BSTR mime_type;
   229         BSTR filename;
   230     };
   231 
   232     [uuid(D763A8F3-BA23-4229-A037-1BB7BDC3E0C8)] struct text_message {
   233         pEp_msg_direction dir;
   234         BSTR id;
   235         BSTR shortmsg;
   236         BSTR longmsg;
   237         BSTR longmsg_formatted;
   238         SAFEARRAY(struct blob) attachments;
   239         hyper sent;
   240         hyper recv;
   241         struct pEp_identity_s from;
   242         SAFEARRAY(struct pEp_identity_s) to;
   243         struct pEp_identity_s recv_by;
   244         SAFEARRAY(struct pEp_identity_s) cc;
   245         SAFEARRAY(struct pEp_identity_s) bcc;
   246         SAFEARRAY(struct pEp_identity_s) reply_to;
   247         SAFEARRAY(BSTR) references;
   248         SAFEARRAY(BSTR) keywords;
   249         BSTR comments;
   250         SAFEARRAY(struct opt_field) opt_fields;
   251     };
   252 
   253     HRESULT encrypt_message([in] struct text_message *src, [out] struct text_message * dst, [in] SAFEARRAY(BSTR) extra);
   254     HRESULT decrypt_message([in] struct text_message *src, [out] struct text_message * dst, [out] SAFEARRAY(BSTR) *keylist, [out, retval] pEp_color *rating);
   255     HRESULT outgoing_message_color([in] struct text_message *msg, [out, retval] pEp_color * pVal);
   256     HRESULT identity_color([in] struct pEp_identity_s * ident, [out, retval] pEp_color * pVal);
   257 };
   258 
   259 [
   260     uuid(3EC2E1A4-40E8-48E4-A7B0-1876D34F9462),
   261     version(1.0),
   262 ]
   263 library pEpCOMServerAdapterLib
   264 {
   265     importlib("stdole2.tlb");
   266     [
   267         uuid(B6BC9B8E-D9E2-4419-A3A4-7B4B58175549)
   268     ]
   269     dispinterface _IpEpEngineEvents
   270     {
   271     properties:
   272     methods:
   273     };
   274     [
   275         uuid(EF1B073D-5058-4E0E-829E-B4D22CA21EA2)
   276     ]
   277     coclass pEpEngine {
   278         [default] interface IpEpEngine;
   279         [default, source] dispinterface _IpEpEngineEvents;
   280     };
   281 };