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