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