pEpCOMServerAdapter.idl
author Markus Schaber <markus@pep-security.net>
Wed, 07 Feb 2018 19:42:45 +0100
branchCOM-74
changeset 272 0cd9b4cde17c
parent 271 92866cd8b0c4
child 273 30be98685afa
permissions -rw-r--r--
COM-74: Expose _PEP_enc_format to app for EncryptMessage

- Suppress exception in the now-common case of PEP_KEY_NOT_FOUND as requested by Thomas.
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@181
    11
    object,
markus@181
    12
    uuid(4DA92647-A858-448E-B01F-BE4DCB8C86A1),
markus@181
    13
    oleautomation,
markus@181
    14
    nonextensible,
markus@181
    15
    pointer_default(unique)
markus@84
    16
]
markus@84
    17
interface IpEpEngineCallbacks : IUnknown {
markus@240
    18
    typedef [v1_enum] enum SyncHandshakeSignal {
markus@240
    19
        SyncNotifyUndefined = 0,
markus@243
    20
markus@243
    21
        // request show handshake dialog
markus@240
    22
        SyncNotifyInitAddOurDevice = 1,
markus@240
    23
        SyncNotifyInitAddOtherDevice = 2,
markus@240
    24
        SyncNotifyInitFormGroup = 3,
markus@240
    25
        SyncNotifyInitMoveOurDevice = 4,
markus@243
    26
markus@243
    27
        // handshake process timed out
markus@240
    28
        SyncNotifyTimeout = 5,
markus@243
    29
markus@243
    30
        // handshake accepted by user
markus@240
    31
        SyncNotifyAcceptedDeviceAdded = 6,
markus@240
    32
        SyncNotifyAcceptedGroupCreated = 7,
markus@243
    33
        SyncNotifyAcceptedDeviceMoved = 8,
markus@243
    34
markus@243
    35
        // handshake dialog must be closed
markus@243
    36
        SyncNotifyOvertaken = 9,
markus@240
    37
    } SyncHandshakeSignal;
markus@172
    38
markus@172
    39
    typedef [v1_enum] enum SyncHandshakeResult {
markus@181
    40
        SyncHandshakeCancel = -1,
markus@181
    41
        SyncHandshakeAccepted = 0,
markus@181
    42
        SyncHandshakeRejected = 1
markus@172
    43
    } SyncHandshakeResult;
markus@172
    44
markus@181
    45
    [id(1)] HRESULT MessageToSend([in] struct TextMessage * msg);
markus@271
    46
vb@227
    47
    [id(2)] HRESULT NotifyHandshake([in] struct pEpIdentity * self, [in] struct pEpIdentity * partner, [in] SyncHandshakeSignal signal, [out, retval] SyncHandshakeResult * result);
markus@84
    48
markus@232
    49
    [id(3)] HRESULT NeedFastPolling([in] VARIANT_BOOL enableFastPolling);
markus@232
    50
};
markus@84
    51
vb@0
    52
[
vb@0
    53
    object,
markus@172
    54
    uuid(045E49AF-0975-4876-A53B-8CA5AB28C0F8),
vb@0
    55
    oleautomation,
vb@0
    56
    nonextensible,
vb@0
    57
    pointer_default(unique)
vb@0
    58
]
vb@0
    59
interface IpEpEngine : IUnknown {
markus@177
    60
vb@60
    61
    // runtime config of the adapter
vb@60
    62
markus@271
    63
    [id(1)] HRESULT VerboseLogging([in] VARIANT_BOOL enable);
vb@51
    64
vb@60
    65
    // runtime config of the engine
vb@60
    66
markus@271
    67
    [id(2)] HRESULT PassiveMode([in] VARIANT_BOOL enable);
markus@271
    68
    [id(3)] HRESULT UnencryptedSubject([in] VARIANT_BOOL enable);
vb@60
    69
vb@60
    70
    // basic API
vb@60
    71
markus@271
    72
    [id(4)] HRESULT ExportKey([in] BSTR fpr, [out, retval] BSTR * keyData);
markus@271
    73
    [id(5)] HRESULT Log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
markus@271
    74
    [id(6)] HRESULT Trustwords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG maxWords, [out, retval] BSTR * words);
markus@271
    75
    [id(7)] HRESULT GetTrustwords([in] struct pEpIdentity * id1, [in] struct pEpIdentity * id2, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] VARIANT_BOOL full, [out, retval] BSTR * words);
markus@271
    76
    [id(8)] HRESULT GetCrashdumpLog([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
markus@271
    77
    [id(9)] HRESULT GetEngineVersion([out, retval] BSTR * engineVersion);
markus@271
    78
    [id(10)] HRESULT GetLanguageList([out, retval] BSTR * languages);
vb@0
    79
markus@172
    80
    typedef [v1_enum] enum pEpComType {
markus@172
    81
        pEpCtUnknown = 0,
vb@0
    82
vb@0
    83
        // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
vb@0
    84
markus@172
    85
        pEpCtNoEncryption = 0x01,                // generic
markus@172
    86
        pEpCtNoEncryptedChannel = 0x02,
markus@172
    87
        pEpCtKeyNotFound = 0x03,
markus@172
    88
        pEpCtKeyExpired = 0x04,
markus@172
    89
        pEpCtKeyRevoked = 0x05,
markus@172
    90
        pEpCtKeyB0rken = 0x06,
markus@172
    91
        pEpCtMyKeyNotIncluded = 0x09,
vb@0
    92
markus@172
    93
        pEpCtSecurityByObscurity = 0x0a,
markus@172
    94
        pEpCtB0rkenCrypto = 0x0b,
markus@172
    95
        pEpCtKeyTooShort = 0x0c,
vb@0
    96
Dean@174
    97
        pEpCtCompromised = 0x0e,                 // known compromized connection
Dean@174
    98
        pEpCtMistrusted = 0x0f,                  // known mistrusted key
vb@0
    99
vb@0
   100
        // range 0x10 to 0x3f: unconfirmed encryption
vb@0
   101
markus@172
   102
        pEpCtUnconfirmedEncryption = 0x10,       // generic
Dean@174
   103
        pEpCtOpenPGPWeakUnconfirmed = 0x11,      // RSA 1024 is weak
vb@62
   104
Dean@174
   105
        pEpCtToBeChecked = 0x20,                 // generic
markus@172
   106
        pEpCtSMIMEUnconfirmed = 0x21,
markus@172
   107
        pEpCtCMSUnconfirmed = 0x22,
vb@62
   108
Dean@174
   109
        pEpCtStrongButUnconfirmed = 0x30,        // generic
markus@172
   110
        pEpCtOpenPGPUnconfirmed = 0x38,          // key at least 2048 bit RSA or EC
markus@172
   111
        pEpCtOTRUnconfirmed = 0x3a,
vb@0
   112
vb@0
   113
        // range 0x40 to 0x7f: unconfirmed encryption and anonymization
vb@0
   114
Dean@174
   115
        pEpCtUnconfirmedEncAnon = 0x40,          // generic
markus@172
   116
        pEpCtpEpUnconfirmed = 0x7f,
vb@0
   117
Dean@174
   118
        pEpCtConfirmed = 0x80,                   // this bit decides if trust is confirmed
vb@0
   119
vb@0
   120
        // range 0x81 to 0x8f: reserved
vb@0
   121
        // range 0x90 to 0xbf: confirmed encryption
vb@0
   122
markus@172
   123
        pEpCtConfirmedEncryption = 0x90,         // generic
markus@172
   124
        pEpCtOpenPGPWeak = 0x91,                 // RSA 1024 is weak
vb@62
   125
Dean@174
   126
        pEpCtToBeCheckedConfirmed = 0xa0,        // generic
markus@172
   127
        pEpCtSMIME = 0xa1,
markus@172
   128
        pEpCtCMS = 0xa2,
vb@62
   129
markus@172
   130
        pEpCtStrongEncryption = 0xb0,            // generic
Dean@174
   131
        pEpCtOpenPGP = 0xb8,                     // key at least 2048 bit RSA or EC
markus@172
   132
        pEpCtOTR = 0xba,
vb@0
   133
vb@0
   134
        // range 0xc0 to 0xff: confirmed encryption and anonymization
vb@0
   135
Dean@174
   136
        pEpCtConfirmedEncAnon = 0xc0,            // generic
markus@172
   137
        pEpCtpEp = 0xff
markus@172
   138
    } pEpComType;
vb@0
   139
markus@240
   140
    typedef [v1_enum] enum pEpIdentityFlags {
markus@240
   141
        pEpIdfNone = 0,
markus@240
   142
        pEpIdfNotForSync = 0x0001,
markus@240
   143
        pEpIdfList = 0x0002,
markus@240
   144
        pEpIdfDevicegroup = 0x0100
markus@240
   145
    } pEpIdentityFlags;
vb@217
   146
markus@181
   147
    [uuid(C3A3814E-567F-4D1C-9F44-9B1DA3957A89)] struct pEpIdentity {
markus@180
   148
        BSTR Address;
markus@180
   149
        BSTR Fpr;
markus@180
   150
        BSTR UserId;
markus@180
   151
        BSTR UserName;
markus@180
   152
        pEpComType CommType;
markus@180
   153
        BSTR Lang;
markus@240
   154
        pEpIdentityFlags Flags;
vb@0
   155
    };
markus@181
   156
markus@271
   157
    [id(11)] HRESULT SetIdentityFlags([in] struct pEpIdentity *identity, [in] pEpIdentityFlags flags);
markus@271
   158
    [id(12)] HRESULT UnsetIdentityFlags([in] struct pEpIdentity *identity, [in] pEpIdentityFlags flags);
vb@218
   159
markus@177
   160
    // Keymanagement API
Dean@183
   161
markus@271
   162
    [id(13)] HRESULT StartKeyserverLookup();
markus@271
   163
    [id(14)] HRESULT StopKeyserverLookup();
vb@24
   164
markus@271
   165
    [id(15)] HRESULT Myself([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
markus@271
   166
    [id(16)] HRESULT UpdateIdentity([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
markus@271
   167
    [id(17)] HRESULT KeyMistrusted([in] struct pEpIdentity *ident);
markus@271
   168
    [id(18)] HRESULT KeyResetTrust([in] struct pEpIdentity *ident);
markus@271
   169
    [id(19)] HRESULT TrustPersonalKey([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
markus@271
   170
    [id(20)] HRESULT OwnIdentitiesRetrieve([out, retval] SAFEARRAY(struct pEpIdentity)* ownIdentities);
markus@271
   171
    [id(21)] HRESULT UndoLastMistrust();
vb@4
   172
vb@65
   173
    // Blacklist API
vb@65
   174
markus@271
   175
    [id(22)] HRESULT BlacklistAdd([in] BSTR fpr);
markus@271
   176
    [id(23)] HRESULT BlacklistDelete([in] BSTR fpr);
markus@271
   177
    [id(24)] HRESULT BlacklistIsListed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
markus@271
   178
    [id(25)] HRESULT BlacklistRetrieve([out, retval] SAFEARRAY(BSTR) *blacklist);
vb@65
   179
markus@181
   180
    // PGP compatibility functions
Dean@174
   181
markus@271
   182
    [id(26)] HRESULT OpenPGPListKeyinfo([in] BSTR searchPattern, [out, retval] SAFEARRAY(struct StringPair)* keyinfoList);
krista@157
   183
vb@15
   184
    // Message API
vb@12
   185
markus@181
   186
    typedef [v1_enum] enum pEpRating {
markus@181
   187
        pEpRatingUndefined = 0,
markus@181
   188
        pEpRatingCannotDecrypt,
markus@181
   189
        pEpRatingHaveNoKey,
markus@181
   190
        pEpRatingUnencrypted,
markus@181
   191
        pEpRatingUnencryptedForSome,
markus@181
   192
        pEpRatingUnreliable,
markus@181
   193
        pEpRatingReliable,
markus@181
   194
        pEpRatingTrusted,
markus@181
   195
        pEpRatingTrustedAndAnonymized,
markus@181
   196
        pEpRatingFullyAnonymous,
markus@166
   197
markus@181
   198
        pEpRatingMistrust = -1,
markus@181
   199
        pEpRatingB0rken = -2,
markus@181
   200
        pEpRatingUnderAttack = -3
markus@181
   201
    } pEpRating;
markus@166
   202
markus@181
   203
    typedef [v1_enum] enum pEpColor {
markus@181
   204
        pEpColorNoColor = 0,
markus@181
   205
        pEpColorYellow,
markus@181
   206
        pEpColorGreen,
markus@181
   207
        pEpColorRed = -1,
markus@181
   208
    } pEpColor;
vb@33
   209
markus@181
   210
    typedef [v1_enum] enum pEpEncryptFlags {
markus@242
   211
        pEpEncryptFlagDefault = 0,
markus@181
   212
        pEpEncryptFlagForceEncryption = 0x1,
markus@242
   213
markus@242
   214
        // This flag is for special uses and should not be used
markus@240
   215
        // by normal pEp clients!
markus@242
   216
        pEpEncryptFlagForceUnsigned = 0x2,
markus@242
   217
markus@242
   218
        // This flag is for special uses and should not be used
markus@242
   219
        // by normal pEp clients!
markus@242
   220
        pEpEncryptFlagForceNoAttachedKey = 0x4,
markus@242
   221
markus@181
   222
    } pEpEncryptFlags;
markus@167
   223
markus@181
   224
    typedef [v1_enum] enum pEpDecryptFlags {
markus@181
   225
        pEpDecryptFlagsNone = 0,
Dean@202
   226
        pEpDecryptFlagOwnPrivateKey = 0x1,
edouard@231
   227
        pEpDecryptFlagConsume = 0x2,
edouard@231
   228
        pEpDecryptFlagIgnore = 0x4
markus@181
   229
    } pEpDecryptFlags;
markus@167
   230
markus@172
   231
    typedef [v1_enum] enum pEpMsgDirection {
markus@172
   232
        pEpDirIncoming = 0,
markus@172
   233
        pEpDirOutgoing
markus@172
   234
    } pEpMsgDirection;
vb@33
   235
markus@271
   236
    typedef [v1_enum] enum pEpEncFormat {
markus@271
   237
        pEpEncNone = 0,                       // message is not encrypted
markus@271
   238
        pEpEncPieces,                         // inline PGP + PGP extensions
markus@271
   239
        pEpEncSMime,                          // RFC5751
markus@271
   240
        pEpEncPgpMime,                        // RFC3156
markus@271
   241
        pEpEncPep,                            // pEp encryption format
markus@271
   242
        pEpEncPgpMimeOutlook1                 // Message B0rken by Outlook type 1
markus@271
   243
    } pEpEncFormat;
markus@271
   244
markus@181
   245
    [uuid(47FB0795-6B64-455C-BB0E-54998CAB8ACB)] struct StringPair {
markus@180
   246
        BSTR Name;
markus@180
   247
        BSTR Value;
vb@33
   248
    };
vb@33
   249
markus@181
   250
    [uuid(634EB7CE-99AA-460D-BDF8-F7CDA7232CA6)] struct Blob {
vb@33
   251
        SAFEARRAY(BYTE) value;
markus@180
   252
        BSTR MimeType;
markus@180
   253
        BSTR Filename;
vb@33
   254
    };
vb@33
   255
markus@181
   256
    [uuid(B6F40887-E761-4A47-B204-A0193EE0284D)] struct TextMessage {
markus@180
   257
        pEpMsgDirection Dir;
markus@180
   258
        BSTR Id;
markus@182
   259
        BSTR ShortMsg;
markus@182
   260
        BSTR LongMsg;
markus@182
   261
        BSTR LongMsgFormatted;
markus@180
   262
        SAFEARRAY(struct Blob) Attachments;
markus@180
   263
        hyper Sent; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
markus@180
   264
        hyper Recv; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
markus@180
   265
        struct pEpIdentity From;
markus@180
   266
        SAFEARRAY(struct pEpIdentity) To;
markus@180
   267
        struct pEpIdentity RecvBy;
markus@180
   268
        SAFEARRAY(struct pEpIdentity) Cc;
markus@180
   269
        SAFEARRAY(struct pEpIdentity) Bcc;
markus@180
   270
        SAFEARRAY(struct pEpIdentity) ReplyTo;
markus@180
   271
        SAFEARRAY(BSTR) References;
markus@180
   272
        SAFEARRAY(BSTR) Keywords;
markus@180
   273
        BSTR Comments;
markus@180
   274
        SAFEARRAY(struct StringPair) OptFields;
vb@33
   275
    };
vb@33
   276
markus@271
   277
    [id(27)] HRESULT EncryptMessage(
markus@241
   278
        [in] struct TextMessage *src,
markus@241
   279
        [out] struct TextMessage * dst,
markus@241
   280
        [in] SAFEARRAY(BSTR) extra,
markus@271
   281
        [in, defaultvalue(pEpEncryptFlagDefault)] pEpEncryptFlags flags,
markus@271
   282
        // Use pEpEncFormat.pEpEncNone for unencrypted, outgoing messages.
markus@271
   283
        // Default is pEpEncFormat.pEpEncPep, all other formats are only 
markus@271
   284
        // for compatibility and not intended for normal use.
markus@271
   285
        [in, defaultvalue(pEpEncPep)] pEpEncFormat encFormat);
markus@241
   286
markus@271
   287
    [id(28)] HRESULT DecryptMessage(
markus@241
   288
        [in] struct TextMessage *src,
markus@241
   289
        [out] struct TextMessage * dst,
markus@241
   290
        [out] SAFEARRAY(BSTR) *keylist,
markus@241
   291
        [out] pEpDecryptFlags* flags,
markus@241
   292
        [out, retval] pEpRating *rating);
markus@177
   293
markus@271
   294
    [id(29)] HRESULT OutgoingMessageRating([in] struct TextMessage *msg, [out, retval] pEpRating * pVal);
markus@271
   295
    [id(30)] HRESULT IdentityRating([in] struct pEpIdentity * ident, [out, retval] pEpRating * pVal);
markus@271
   296
    [id(31)] HRESULT ColorFromRating([in] pEpRating rating, [out, retval] pEpColor* pVal);
markus@84
   297
markus@271
   298
    [id(32)] HRESULT GetMessageTrustwords(
markus@232
   299
        [in] struct TextMessage *msg,
markus@232
   300
        [in] struct pEpIdentity * receivedBy,
markus@232
   301
        [in] SAFEARRAY(BSTR) keylist,
markus@232
   302
        [in, defaultvalue("en")] BSTR lang,
markus@232
   303
        [in, defaultvalue(0)] VARIANT_BOOL full,
markus@232
   304
        [out, retval] BSTR * words
markus@232
   305
    );
markus@238
   306
markus@271
   307
    [id(33)] HRESULT EncryptMessageForSelf(
markus@254
   308
        [in] struct pEpIdentity* targetId,
markus@271
   309
        [in] struct TextMessage* src,
markus@240
   310
        [out] struct TextMessage* dst,
markus@242
   311
        [in, defaultvalue(pEpEncryptFlagDefault)] pEpEncryptFlags flags
markus@238
   312
    );
markus@254
   313
markus@271
   314
    [id(34)] HRESULT ReEvaluateMessageRating(
markus@254
   315
        [in] struct TextMessage *src,
markus@254
   316
        [in] SAFEARRAY(BSTR) x_KeyList, // referring to X-KeyList mail header
markus@254
   317
        [in] pEpRating x_EncStatus, // referring to X-EncStatus mail header
markus@254
   318
        [out, retval] pEpRating *rating
markus@254
   319
    );
markus@264
   320
markus@271
   321
    // callback / keysync API
markus@271
   322
    [id(35)] HRESULT RegisterCallbacks([in] IpEpEngineCallbacks* newCallback);
markus@271
   323
    [id(36)] HRESULT UnregisterCallbacks();
markus@232
   324
};
markus@232
   325
markus@232
   326
[
markus@172
   327
    uuid(564A4350-419E-47F1-B0DF-6FCCF0CD0BBC),
vb@0
   328
    version(1.0),
vb@0
   329
]
vb@0
   330
library pEpCOMServerAdapterLib
vb@0
   331
{
vb@0
   332
    importlib("stdole2.tlb");
markus@181
   333
vb@0
   334
    [
markus@172
   335
        uuid(5FF6682B-727B-4DFE-A68D-28982874C0C7)
vb@0
   336
    ]
vb@0
   337
    coclass pEpEngine {
markus@271
   338
        [default] interface IpEpEngine;
markus@271
   339
        interface IpEpEngineCallbacks;
vb@0
   340
    };
vb@0
   341
};