pEpCOMServerAdapter.idl
author Markus Schaber <markus@pep-security.net>
Wed, 07 Feb 2018 18:53:25 +0100
branchCOM-74
changeset 270 c713a265866f
parent 267 ae02fcd56811
child 271 92866cd8b0c4
permissions -rw-r--r--
COM-74: Expose _PEP_enc_format to app for EncryptMessage

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