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