pEpCOMServerAdapter.idl
author Volker Birk <vb@pep-project.org>
Sun, 21 Feb 2016 18:32:07 +0100
changeset 58 a0214629bc44
parent 57 0b6002476e85
child 59 c03abab41702
permissions -rw-r--r--
defaultvalue for maxlines param
     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     HRESULT verbose_logging([in] BOOL enable);
    19 
    20     typedef   enum _pEp_STATUS {
    21         pEp_STATUS_OK = 0,
    22 
    23         pEp_KEY_NOT_FOUND = 0x0201,
    24         pEp_KEY_HAS_AMBIG_NAME = 0x0202,
    25         pEp_GET_KEY_FAILED = 0x0203,
    26 
    27         pEp_UNENCRYPTED = 0x0400,
    28         pEp_VERIFIED = 0x0401,
    29         pEp_DECRYPTED = 0x0402,
    30         pEp_DECRYPTED_AND_VERIFIED = 0x0403,
    31         pEp_DECRYPT_WRONG_FORMAT = 0x0404,
    32         pEp_DECRYPT_NO_KEY = 0x0405,
    33         pEp_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
    34         pEp_VERIFY_NO_KEY = 0x0407,
    35         pEp_VERIFIED_AND_TRUSTED = 0x0408,
    36 
    37         pEp_ILLEGAL_VALUE = -4,
    38         pEp_BUFFER_TOO_SMALL = -3,
    39         pEp_OUT_OF_MEMORY = -2,
    40         pEp_UNKNOWN_ERROR = -1
    41     } pEp_STATUS;
    42 
    43     HRESULT log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
    44     HRESULT decrypt([in] BSTR ctext, [out] BSTR * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
    45     HRESULT decrypt_b([in] BSTR ctext, [out] SAFEARRAY(BYTE) * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
    46     HRESULT encrypt([in] SAFEARRAY(BSTR) key_list, [in] BSTR ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
    47     HRESULT encrypt_b([in] SAFEARRAY(BSTR) key_list, [in] SAFEARRAY(BYTE) ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
    48     HRESULT verify([in] BSTR text, [in] BSTR signature, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * verify_status);
    49     HRESULT trustword([in] LONG value, [in, defaultvalue("en")] BSTR lang, [out, retval] BSTR * word);
    50     HRESULT trustwords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG max_words, [out, retval] BSTR * words);
    51     HRESULT get_crashdump_log([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
    52 
    53     typedef enum _pEp_comm_type {
    54         pEp_ct_unknown = 0,
    55 
    56         // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
    57 
    58         pEp_ct_no_encryption = 0x01,                // generic
    59         pEp_ct_no_encrypted_channel = 0x02,
    60         pEp_ct_key_not_found = 0x03,
    61         pEp_ct_key_expired = 0x04,
    62         pEp_ct_key_revoked = 0x05,
    63         pEp_ct_key_b0rken = 0x06,
    64         pEp_ct_my_key_not_included = 0x09,
    65 
    66         pEp_ct_security_by_obscurity = 0x0a,
    67         pEp_ct_b0rken_crypto = 0x0b,
    68         pEp_ct_key_too_short = 0x0e,
    69 
    70         pEp_ct_compromized = 0x0f,                  // known compromized connection
    71 
    72         // range 0x10 to 0x3f: unconfirmed encryption
    73 
    74         pEp_ct_unconfirmed_encryption = 0x10,       // generic
    75         pEp_ct_OpenPGP_1024_RSA_unconfirmed = 0x11,	// RSA 1024 is weak
    76         pEp_ct_OpenPGP_unconfirmed = 0x3f,          // key at least 2048 bit RSA
    77         // or 1024 bit DSA
    78 
    79         // range 0x40 to 0x7f: unconfirmed encryption and anonymization
    80 
    81         pEp_ct_unconfirmed_enc_anon = 0x40,         // generic
    82         pEp_ct_pEp_unconfirmed = 0x7f,
    83 
    84         pEp_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
    85 
    86         // range 0x81 to 0x8f: reserved
    87         // range 0x90 to 0xbf: confirmed encryption
    88 
    89         pEp_ct_confirmed_encryption = 0x90,         // generic
    90         pEp_ct_OpenPGP_1024_RSA = 0x91, // RSA 1024 is weak
    91         pEp_ct_OpenPGP = 0xbf, // key at least 2048 bit RSA or 1024 bit DSA
    92 
    93         // range 0xc0 to 0xff: confirmed encryption and anonymization
    94 
    95         pEp_ct_confirmed_enc_anon = 0xc0,           // generic
    96         pEp_ct_pEp = 0xff
    97     } pEp_comm_type;
    98 
    99     [uuid(0CB90E62-8A6A-4CA0-99D7-481704051FF0)] struct pEp_identity_s {
   100         BSTR address;
   101         BSTR fpr;
   102         BSTR user_id;
   103         BSTR username;
   104         pEp_comm_type comm_type;
   105         BSTR lang;
   106     };
   107 
   108     HRESULT get_identity([in] BSTR address, [out, retval] struct pEp_identity_s * ident);
   109     HRESULT set_identity([in] struct pEp_identity_s * ident);
   110     HRESULT generate_keypair([in] struct pEp_identity_s * ident, [out, retval] BSTR * fpr);
   111     HRESULT delete_keypair([in] BSTR fpr);
   112     HRESULT import_key([in] BSTR key_data);
   113     HRESULT import_key_b([in] SAFEARRAY(BYTE) key_data);
   114     HRESULT export_key([in] BSTR fpr, [out, retval] BSTR * key_data);
   115     HRESULT recv_key([in] BSTR pattern);
   116     HRESULT find_keys([in] BSTR pattern, [out, retval] SAFEARRAY(BSTR) * key_list);
   117     HRESULT send_key([in] BSTR pattern);
   118 
   119     HRESULT start_keyserver_lookup();
   120     HRESULT stop_keyserver_lookup();
   121 
   122     HRESULT examine_identity([in] struct pEp_identity_s * ident);
   123     HRESULT myself([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   124     HRESULT update_identity([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   125     HRESULT key_compromized([in] struct pEp_identity_s *ident);
   126     HRESULT key_reset_trust([in] struct pEp_identity_s *ident);
   127     HRESULT trust_personal_key([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   128 
   129     // Message API
   130 
   131     typedef enum _pEp_color {
   132         pEp_rating_undefined = 0,
   133         pEp_rating_cannot_decrypt,
   134         pEp_rating_have_no_key,
   135         pEp_rating_unencrypted,
   136         pEp_rating_unreliable,
   137         pEp_rating_reliable,
   138         pEp_rating_yellow = pEp_rating_reliable,
   139         pEp_rating_trusted,
   140         pEp_rating_green = pEp_rating_trusted,
   141         pEp_rating_trusted_and_anonymized,
   142         pEp_rating_fully_anonymous,
   143 
   144         pEp_rating_mistrust = -1,
   145         pEp_rating_red = pEp_rating_mistrust,
   146         pEp_rating_b0rken = -2,
   147         pEp_rating_under_attack = -3
   148     } pEp_color;
   149 
   150     typedef enum _pEp_text_format {
   151         pEp_text_format_plain = 0,
   152         pEp_text_format_html,
   153         pEp_text_format_other = 0xff
   154     } pEp_text_format;
   155 
   156     typedef  enum _pEp_msg_direction {
   157         pEp_dir_incoming = 0,
   158         pEp_dir_outgoing
   159     } pEp_msg_direction;
   160 
   161     typedef  enum _pEp_MIME_format {
   162         pEp_MIME_none = 0,                      // message is not MIME encoded
   163         pEp_MIME_fields_omitted,                // message content but no fields
   164         pEp_MIME                                // message is fully MIME encoded
   165     } pEp_MIME_format;
   166 
   167     typedef  enum _pEp_enc_format {
   168         pEp_enc_none = 0,                       // message is not encrypted
   169         pEp_enc_pieces,                         // inline PGP + PGP extensions
   170         pEp_enc_S_MIME,                         // RFC5751
   171         pEp_enc_PGP_MIME,                       // RFC3156
   172         pEp_enc_pEp                             // pEp encryption format
   173     } pEp_enc_format;
   174 
   175     [uuid(3A8A4F13-3402-4C4C-94AB-598D87869380)] struct opt_field {
   176         BSTR name;
   177         BSTR value;
   178     };
   179 
   180     [uuid(61DA7AD4-192E-4616-8678-B19AEFB45B45)] struct blob {
   181         SAFEARRAY(BYTE) value;
   182         BSTR mime_type;
   183         BSTR filename;
   184     };
   185 
   186     [uuid(D763A8F3-BA23-4229-A037-1BB7BDC3E0C8)] struct text_message {
   187         pEp_msg_direction dir;
   188         BSTR id;
   189         BSTR shortmsg;
   190         BSTR longmsg;
   191         BSTR longmsg_formatted;
   192         SAFEARRAY(struct blob) attachments;
   193         hyper sent;
   194         hyper recv;
   195         struct pEp_identity_s from;
   196         SAFEARRAY(struct pEp_identity_s) to;
   197         struct pEp_identity_s recv_by;
   198         SAFEARRAY(struct pEp_identity_s) cc;
   199         SAFEARRAY(struct pEp_identity_s) bcc;
   200         SAFEARRAY(struct pEp_identity_s) reply_to;
   201         SAFEARRAY(BSTR) references;
   202         SAFEARRAY(BSTR) keywords;
   203         BSTR comments;
   204         SAFEARRAY(struct opt_field) opt_fields;
   205     };
   206 
   207     HRESULT encrypt_message([in] struct text_message *src, [out] struct text_message * dst, [in] SAFEARRAY(BSTR) extra);
   208     HRESULT decrypt_message([in] struct text_message *src, [out] struct text_message * dst, [out] SAFEARRAY(BSTR) *keylist, [out, retval] pEp_color *rating);
   209     HRESULT outgoing_message_color([in] struct text_message *msg, [out, retval] pEp_color * pVal);
   210     HRESULT identity_color([in] struct pEp_identity_s * ident, [out, retval] pEp_color * pVal);
   211 };
   212 
   213 [
   214     uuid(3EC2E1A4-40E8-48E4-A7B0-1876D34F9462),
   215     version(1.0),
   216 ]
   217 library pEpCOMServerAdapterLib
   218 {
   219     importlib("stdole2.tlb");
   220     [
   221         uuid(B6BC9B8E-D9E2-4419-A3A4-7B4B58175549)
   222     ]
   223     dispinterface _IpEpEngineEvents
   224     {
   225     properties:
   226     methods:
   227     };
   228     [
   229         uuid(EF1B073D-5058-4E0E-829E-B4D22CA21EA2)
   230     ]
   231     coclass pEpEngine {
   232         [default] interface IpEpEngine;
   233         [default, source] dispinterface _IpEpEngineEvents;
   234     };
   235 };