pEpCOMServerAdapter.idl
author Dean
Tue, 04 Oct 2016 12:31:52 +0200
branchkeysync
changeset 174 1fa1296363f9
parent 172 112b0fac353d
child 177 4d197f1c3abb
permissions -rw-r--r--
Formatting and spelling fixes
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
	object,
markus@172
    12
	uuid(4DA92647-A858-448E-B01F-BE4DCB8C86A1),
markus@84
    13
	oleautomation,
markus@84
    14
	nonextensible,
markus@84
    15
	pointer_default(unique)
markus@84
    16
]
markus@84
    17
interface IpEpEngineCallbacks : IUnknown {
markus@172
    18
markus@172
    19
    typedef [v1_enum] enum SyncHandshakeResult {
markus@172
    20
	    SyncHandshakeCancel = -1,
markus@172
    21
	    SyncHandshakeAccepted = 0,
markus@172
    22
	    SyncHandshakeRejected = 1
markus@172
    23
    } SyncHandshakeResult;
markus@172
    24
markus@172
    25
	[id(1)] HRESULT MessageToSend([in] struct TextMessage * msg);
markus@172
    26
	[id(2)] HRESULT ShowHandshake([in] struct pEpIdentity * self, [in] struct pEpIdentity * partner, [out, retval] SyncHandshakeResult * result);
markus@84
    27
};
markus@84
    28
markus@84
    29
vb@0
    30
[
vb@0
    31
    object,
markus@172
    32
    uuid(045E49AF-0975-4876-A53B-8CA5AB28C0F8),
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
markus@172
    40
    HRESULT VerboseLogging([in] VARIANT_BOOL enable);
vb@51
    41
vb@60
    42
    // runtime config of the engine
vb@60
    43
markus@172
    44
    HRESULT PassiveMode([in] VARIANT_BOOL enable);
markus@172
    45
    HRESULT UnencryptedSubject([in] VARIANT_BOOL enable);
vb@60
    46
vb@60
    47
    // basic API
vb@60
    48
markus@172
    49
   // // TODO: Remove this enum, it is not needed in the interface, but it currently is still used in the code...
markus@172
    50
   //typedef [v1_enum] enum pEpStatus {
markus@172
    51
   //     pEpStatusOK = 0,
vb@0
    52
markus@172
    53
   //     pEp_INIT_CANNOT_LOAD_GPGME = 0x0110,
markus@172
    54
   //     pEp_INIT_GPGME_INIT_FAILED = 0x0111,
markus@172
    55
   //     pEp_INIT_NO_GPG_HOME = 0x0112,
markus@172
    56
   //     pEp_INIT_NETPGP_INIT_FAILED = 0x0113,
vb@62
    57
markus@172
    58
   //     pEp_INIT_SQLITE3_WITHOUT_MUTEX = 0x0120,
markus@172
    59
   //     pEp_INIT_CANNOT_OPEN_DB = 0x0121,
markus@172
    60
   //     pEp_INIT_CANNOT_OPEN_SYSTEM_DB = 0x0122,
vb@62
    61
markus@172
    62
   //     pEp_KEY_NOT_FOUND = 0x0201,
markus@172
    63
   //     pEp_KEY_HAS_AMBIG_NAME = 0x0202,
markus@172
    64
   //     pEp_GET_KEY_FAILED = 0x0203,
vb@0
    65
markus@172
    66
   //     pEp_CANNOT_FIND_IDENTITY = 0x0301,
markus@172
    67
   //     pEp_CANNOT_SET_PERSON = 0x0381,
markus@172
    68
   //     pEp_CANNOT_SET_PGP_KEYPAIR = 0x0382,
markus@172
    69
   //     pEp_CANNOT_SET_IDENTITY = 0x0383,
markus@172
    70
   //     pEp_CANNOT_SET_TRUST = 0x0384,
vb@62
    71
markus@172
    72
   //     pEp_UNENCRYPTED = 0x0400,
markus@172
    73
   //     pEp_VERIFIED = 0x0401,
markus@172
    74
   //     pEp_DECRYPTED = 0x0402,
markus@172
    75
   //     pEp_DECRYPTED_AND_VERIFIED = 0x0403,
markus@172
    76
   //     pEp_DECRYPT_WRONG_FORMAT = 0x0404,
markus@172
    77
   //     pEp_DECRYPT_NO_KEY = 0x0405,
markus@172
    78
   //     pEp_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
markus@172
    79
   //     pEp_VERIFY_NO_KEY = 0x0407,
markus@172
    80
   //     pEp_VERIFIED_AND_TRUSTED = 0x0408,
markus@172
    81
   //     pEp_CANNOT_DECRYPT_UNKNOWN = 0x04ff,
vb@0
    82
markus@172
    83
   //     pEp_TRUSTWORD_NOT_FOUND = 0x0501,
vb@62
    84
markus@172
    85
   //     pEp_CANNOT_CREATE_KEY = 0x0601,
markus@172
    86
   //     pEp_CANNOT_SEND_KEY = 0x0602,
vb@62
    87
markus@172
    88
   //     pEp_PHRASE_NOT_FOUND = 0x0701,
vb@62
    89
markus@172
    90
   //     pEp_COMMIT_FAILED = 0xff01,
vb@62
    91
markus@172
    92
   //     pEp_CANNOT_CREATE_TEMP_FILE = -5,
markus@172
    93
   //     pEp_ILLEGAL_VALUE = -4,
markus@172
    94
   //     pEp_BUFFER_TOO_SMALL = -3,
markus@172
    95
   //     pEp_OUT_OF_MEMORY = -2,
markus@172
    96
   //     pEp_UNKNOWN_ERROR = -1
markus@172
    97
   // } pEpStatus;
vb@0
    98
markus@172
    99
    // HRESULT log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
markus@172
   100
    // HRESULT decrypt([in] BSTR ctext, [out] BSTR * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEpStatus * decrypt_status);
markus@172
   101
    // HRESULT decrypt_b([in] BSTR ctext, [out] SAFEARRAY(BYTE) * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEpStatus * decrypt_status);
markus@172
   102
    // HRESULT encrypt([in] SAFEARRAY(BSTR) key_list, [in] BSTR ptext, [out] BSTR * ctext, [out, retval] pEpStatus * status);
markus@172
   103
    // HRESULT encrypt_b([in] SAFEARRAY(BSTR) key_list, [in] SAFEARRAY(BYTE) ptext, [out] BSTR * ctext, [out, retval] pEpStatus * status);
markus@172
   104
    // HRESULT verify([in] BSTR text, [in] BSTR signature, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEpStatus * verify_status);
markus@172
   105
    // HRESULT trustword([in] LONG value, [in, defaultvalue("en")] BSTR lang, [out, retval] BSTR * word);
markus@172
   106
    HRESULT TrustWords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG max_words, [out, retval] BSTR * words);
markus@172
   107
    HRESULT GetCrashdumpLog([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
markus@172
   108
    HRESULT GetEngineVersion([out, retval] BSTR * engine_version);
markus@172
   109
    HRESULT GetLanguagelist([out, retval] BSTR * languages);
markus@172
   110
    // HRESULT get_phrase([in] BSTR lang, [in] LONG phrase_id, [out, retval] BSTR * phrase);
vb@0
   111
markus@172
   112
    typedef [v1_enum] enum pEpComType {
markus@172
   113
        pEpCtUnknown = 0,
vb@0
   114
vb@0
   115
        // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
vb@0
   116
markus@172
   117
        pEpCtNoEncryption = 0x01,                // generic
markus@172
   118
        pEpCtNoEncryptedChannel = 0x02,
markus@172
   119
        pEpCtKeyNotFound = 0x03,
markus@172
   120
        pEpCtKeyExpired = 0x04,
markus@172
   121
        pEpCtKeyRevoked = 0x05,
markus@172
   122
        pEpCtKeyB0rken = 0x06,
markus@172
   123
        pEpCtMyKeyNotIncluded = 0x09,
vb@0
   124
markus@172
   125
        pEpCtSecurityByObscurity = 0x0a,
markus@172
   126
        pEpCtB0rkenCrypto = 0x0b,
markus@172
   127
        pEpCtKeyTooShort = 0x0c,
vb@0
   128
Dean@174
   129
        pEpCtCompromised = 0x0e,                 // known compromized connection
Dean@174
   130
        pEpCtMistrusted = 0x0f,                  // known mistrusted key
vb@0
   131
vb@0
   132
        // range 0x10 to 0x3f: unconfirmed encryption
vb@0
   133
markus@172
   134
        pEpCtUnconfirmedEncryption = 0x10,       // generic
Dean@174
   135
        pEpCtOpenPGPWeakUnconfirmed = 0x11,      // RSA 1024 is weak
vb@62
   136
Dean@174
   137
        pEpCtToBeChecked = 0x20,                 // generic
markus@172
   138
        pEpCtSMIMEUnconfirmed = 0x21,
markus@172
   139
        pEpCtCMSUnconfirmed = 0x22,
vb@62
   140
Dean@174
   141
        pEpCtStrongButUnconfirmed = 0x30,        // generic
markus@172
   142
        pEpCtOpenPGPUnconfirmed = 0x38,          // key at least 2048 bit RSA or EC
markus@172
   143
        pEpCtOTRUnconfirmed = 0x3a,
vb@0
   144
vb@0
   145
        // range 0x40 to 0x7f: unconfirmed encryption and anonymization
vb@0
   146
Dean@174
   147
        pEpCtUnconfirmedEncAnon = 0x40,          // generic
markus@172
   148
        pEpCtpEpUnconfirmed = 0x7f,
vb@0
   149
Dean@174
   150
        pEpCtConfirmed = 0x80,                   // this bit decides if trust is confirmed
vb@0
   151
vb@0
   152
        // range 0x81 to 0x8f: reserved
vb@0
   153
        // range 0x90 to 0xbf: confirmed encryption
vb@0
   154
markus@172
   155
        pEpCtConfirmedEncryption = 0x90,         // generic
markus@172
   156
        pEpCtOpenPGPWeak = 0x91,                 // RSA 1024 is weak
vb@62
   157
Dean@174
   158
        pEpCtToBeCheckedConfirmed = 0xa0,        // generic
markus@172
   159
        pEpCtSMIME = 0xa1,
markus@172
   160
        pEpCtCMS = 0xa2,
vb@62
   161
markus@172
   162
        pEpCtStrongEncryption = 0xb0,            // generic
Dean@174
   163
        pEpCtOpenPGP = 0xb8,                     // key at least 2048 bit RSA or EC
markus@172
   164
        pEpCtOTR = 0xba,
vb@0
   165
vb@0
   166
        // range 0xc0 to 0xff: confirmed encryption and anonymization
vb@0
   167
Dean@174
   168
        pEpCtConfirmedEncAnon = 0xc0,            // generic
markus@172
   169
        pEpCtpEp = 0xff
markus@172
   170
    } pEpComType;
vb@0
   171
markus@172
   172
    [uuid(0CB90E62-8A6A-4CA0-99D7-481704051FF0)] struct pEpIdentity {
vb@0
   173
        BSTR address;
vb@0
   174
        BSTR fpr;
vb@0
   175
        BSTR user_id;
vb@0
   176
        BSTR username;
markus@172
   177
        pEpComType comm_type;
vb@0
   178
        BSTR lang;
vb@0
   179
    };
vb@0
   180
markus@172
   181
    //HRESULT get_identity([in] BSTR address, [in] BSTR user_id, [out, retval] struct pEpIdentity * ident);
markus@172
   182
    //HRESULT set_identity([in] struct pEpIdentity * ident);
markus@172
   183
    //HRESULT generate_keypair([in] struct pEpIdentity * ident, [out, retval] BSTR * fpr);
markus@172
   184
    //HRESULT delete_keypair([in] BSTR fpr);
markus@172
   185
    //HRESULT import_key([in] BSTR key_data);
markus@172
   186
    //HRESULT import_key_b([in] SAFEARRAY(BYTE) key_data);
markus@172
   187
    //HRESULT export_key([in] BSTR fpr, [out, retval] BSTR * key_data);
markus@172
   188
    //HRESULT recv_key([in] BSTR pattern);
markus@172
   189
    //HRESULT find_keys([in] BSTR pattern, [out, retval] SAFEARRAY(BSTR) * key_list);
markus@172
   190
    //HRESULT send_key([in] BSTR pattern);
vb@0
   191
markus@172
   192
    HRESULT StartKeyserverLookup();
markus@172
   193
    HRESULT StopKeyserverLookup();
vb@24
   194
markus@172
   195
    //HRESULT examine_identity([in] struct pEpIdentity * ident);
markus@172
   196
    HRESULT Myself([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
markus@172
   197
    HRESULT UpdateIdentity([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
markus@172
   198
    HRESULT KeyMistrusted([in] struct pEpIdentity *ident);
markus@172
   199
    HRESULT KeyResetTrust([in] struct pEpIdentity *ident);
markus@172
   200
    HRESULT TrustPersonalKey([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
vb@4
   201
vb@65
   202
    // Blacklist API
vb@65
   203
markus@172
   204
    HRESULT BlacklistAdd([in] BSTR fpr);
markus@172
   205
    HRESULT BlacklistDelete([in] BSTR fpr);
markus@172
   206
    HRESULT BlacklistIsListed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
markus@172
   207
    HRESULT BlacklistRetreive([out, retval] SAFEARRAY(BSTR) *blacklist);
vb@65
   208
krista@157
   209
	// PGP compatibility functions
Dean@174
   210
markus@171
   211
	HRESULT OpenPGP_list_keyinfo([in] BSTR search_pattern, [out, retval] SAFEARRAY(struct StringPair)* keyinfo_list);
krista@157
   212
vb@15
   213
    // Message API
vb@12
   214
markus@172
   215
	typedef [v1_enum] enum pEpRating {
markus@172
   216
		pEpRatingUndefined = 0,
markus@172
   217
		pEpRatingCannotDecrypt,
markus@172
   218
		pEpRatingHaveNoKey,
markus@172
   219
		pEpRatingUnencrypted,
markus@172
   220
		pEpRatingUnencryptedForSome,
markus@172
   221
		pEpRatingUnreliable,
markus@172
   222
		pEpRatingReliable,
markus@172
   223
		pEpRatingTrusted,
markus@172
   224
		pEpRatingTrustedAndAnonymized,
markus@172
   225
		pEpRatingFullyAnonymous,
markus@166
   226
markus@172
   227
		pEpRatingMistrust = -1,
markus@172
   228
		pEpRatingB0rken = -2,
markus@172
   229
		pEpRatingUnderAttack = -3
markus@172
   230
	} pEpRating;
markus@166
   231
markus@172
   232
	typedef [v1_enum] enum pEpColor {
markus@172
   233
		pEpColorNoColor = 0,
markus@172
   234
		pEpColorYellow,
markus@172
   235
		pEpColorGreen,
markus@172
   236
		pEpColorRed = -1,
markus@172
   237
	} pEpColor;
vb@33
   238
markus@167
   239
	typedef [v1_enum] enum pEpEncryptFlags {
markus@167
   240
		pEpEncryptFlagsNone = 0,
markus@167
   241
		pEpEncryptFlagForceEncryption = 0x1,
markus@167
   242
	} pEpEncryptFlags;
markus@167
   243
markus@167
   244
	typedef [v1_enum] enum pEpDecryptFlags {
markus@167
   245
		pEpDecryptFlagsNone = 0,
markus@167
   246
		pEpDecryptFlagOwnPrivateKey = 0x1
markus@167
   247
	} pEpDecryptFlags;
markus@167
   248
markus@172
   249
    typedef [v1_enum] enum pEpMsgDirection {
markus@172
   250
        pEpDirIncoming = 0,
markus@172
   251
        pEpDirOutgoing
markus@172
   252
    } pEpMsgDirection;
vb@33
   253
markus@172
   254
    //typedef  enum _pEp_enc_format {
markus@172
   255
    //    pEp_enc_none = 0,                       // message is not encrypted
markus@172
   256
    //    pEp_enc_pieces,                         // inline PGP + PGP extensions
markus@172
   257
    //    pEp_enc_S_MIME,                         // RFC5751
markus@172
   258
    //    pEp_enc_PGP_MIME,                       // RFC3156
markus@172
   259
    //    pEp_enc_pEp                             // pEp encryption format
markus@172
   260
    //} pEp_enc_format;
vb@33
   261
markus@171
   262
    [uuid(3A8A4F13-3402-4C4C-94AB-598D87869380)] struct StringPair {
vb@33
   263
        BSTR name;
vb@33
   264
        BSTR value;
vb@33
   265
    };
vb@33
   266
markus@172
   267
    [uuid(61DA7AD4-192E-4616-8678-B19AEFB45B45)] struct Blob {
vb@33
   268
        SAFEARRAY(BYTE) value;
vb@33
   269
        BSTR mime_type;
vb@33
   270
        BSTR filename;
vb@33
   271
    };
vb@33
   272
markus@172
   273
    [uuid(D763A8F3-BA23-4229-A037-1BB7BDC3E0C8)] struct TextMessage {
markus@172
   274
        pEpMsgDirection dir;
vb@33
   275
        BSTR id;
vb@33
   276
        BSTR shortmsg;
vb@33
   277
        BSTR longmsg;
vb@33
   278
        BSTR longmsg_formatted;
markus@172
   279
        SAFEARRAY(struct Blob) attachments;
markus@172
   280
        hyper sent; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
markus@172
   281
        hyper recv; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
markus@172
   282
        struct pEpIdentity from;
markus@172
   283
        SAFEARRAY(struct pEpIdentity) to;
markus@172
   284
        struct pEpIdentity recv_by;
markus@172
   285
        SAFEARRAY(struct pEpIdentity) cc;
markus@172
   286
        SAFEARRAY(struct pEpIdentity) bcc;
markus@172
   287
        SAFEARRAY(struct pEpIdentity) reply_to;
vb@33
   288
        SAFEARRAY(BSTR) references;
vb@33
   289
        SAFEARRAY(BSTR) keywords;
vb@33
   290
        BSTR comments;
markus@171
   291
        SAFEARRAY(struct StringPair) opt_fields;
vb@33
   292
    };
vb@33
   293
markus@172
   294
    HRESULT EncryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [in] SAFEARRAY(BSTR) extra, [in, defaultvalue(pEpEncryptFlagsNone)] pEpEncryptFlags flags);
markus@172
   295
    HRESULT DecryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [out] SAFEARRAY(BSTR) *keylist, [out] pEpDecryptFlags* flags, [out, retval] pEpRating *rating);
markus@172
   296
    HRESULT OutgoingMessageRating([in] struct TextMessage *msg, [out, retval] pEpRating * pVal);
markus@172
   297
    HRESULT IdentityRating([in] struct pEpIdentity * ident, [out, retval] pEpRating * pVal);
markus@172
   298
	HRESULT ColorFromRating([in] pEpRating rating, [out, retval] pEpColor* pVal);
markus@84
   299
markus@172
   300
	HRESULT RegisterCallbacks([in] IpEpEngineCallbacks* new_callback);
markus@172
   301
	HRESULT UnregisterCallbacks([in] IpEpEngineCallbacks* obsolete_callback);
vb@8
   302
};
vb@4
   303
vb@8
   304
[
markus@172
   305
    uuid(564A4350-419E-47F1-B0DF-6FCCF0CD0BBC),
vb@0
   306
    version(1.0),
vb@0
   307
]
vb@0
   308
library pEpCOMServerAdapterLib
vb@0
   309
{
vb@0
   310
    importlib("stdole2.tlb");
markus@172
   311
    
vb@0
   312
    [
markus@172
   313
        uuid(5FF6682B-727B-4DFE-A68D-28982874C0C7)
vb@0
   314
    ]
vb@0
   315
    coclass pEpEngine {
vb@0
   316
        [default] interface IpEpEngine;
vb@0
   317
    };
vb@0
   318
};