pEpCOMServerAdapter.idl
author Markus Schaber <markus@pep-security.net>
Sat, 05 Nov 2016 10:22:14 +0100
changeset 193 896f1ea47f31
parent 190 8d1c4f057dea
child 200 e8368b1b8763
permissions -rw-r--r--
COM-20: Memory leak in CpEpEngine::blacklist_retrieve
     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(4DA92647-A858-448E-B01F-BE4DCB8C86A1),
    13     oleautomation,
    14     nonextensible,
    15     pointer_default(unique)
    16 ]
    17 interface IpEpEngineCallbacks : IUnknown {
    18 
    19     typedef [v1_enum] enum SyncHandshakeResult {
    20         SyncHandshakeCancel = -1,
    21         SyncHandshakeAccepted = 0,
    22         SyncHandshakeRejected = 1
    23     } SyncHandshakeResult;
    24 
    25     [id(1)] HRESULT MessageToSend([in] struct TextMessage * msg);
    26     [id(2)] HRESULT ShowHandshake([in] struct pEpIdentity * self, [in] struct pEpIdentity * partner, [out, retval] SyncHandshakeResult * result);
    27 };
    28 
    29 
    30 [
    31     object,
    32     uuid(045E49AF-0975-4876-A53B-8CA5AB28C0F8),
    33     oleautomation,
    34     nonextensible,
    35     pointer_default(unique)
    36 ]
    37 interface IpEpEngine : IUnknown {
    38 
    39     // runtime config of the adapter
    40 
    41     HRESULT VerboseLogging([in] VARIANT_BOOL enable);
    42 
    43     // runtime config of the engine
    44 
    45     HRESULT PassiveMode([in] VARIANT_BOOL enable);
    46     HRESULT UnencryptedSubject([in] VARIANT_BOOL enable);
    47 
    48     // basic API
    49 
    50     HRESULT ExportKey([in] BSTR fpr, [out, retval] BSTR * keyData);
    51     HRESULT Log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
    52     HRESULT TrustWords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG maxWords, [out, retval] BSTR * words);
    53     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);
    54     HRESULT GetCrashdumpLog([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
    55     HRESULT GetEngineVersion([out, retval] BSTR * engineVersion);
    56     HRESULT GetLanguageList([out, retval] BSTR * languages);
    57 
    58     typedef [v1_enum] enum pEpComType {
    59         pEpCtUnknown = 0,
    60 
    61         // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
    62 
    63         pEpCtNoEncryption = 0x01,                // generic
    64         pEpCtNoEncryptedChannel = 0x02,
    65         pEpCtKeyNotFound = 0x03,
    66         pEpCtKeyExpired = 0x04,
    67         pEpCtKeyRevoked = 0x05,
    68         pEpCtKeyB0rken = 0x06,
    69         pEpCtMyKeyNotIncluded = 0x09,
    70 
    71         pEpCtSecurityByObscurity = 0x0a,
    72         pEpCtB0rkenCrypto = 0x0b,
    73         pEpCtKeyTooShort = 0x0c,
    74 
    75         pEpCtCompromised = 0x0e,                 // known compromized connection
    76         pEpCtMistrusted = 0x0f,                  // known mistrusted key
    77 
    78         // range 0x10 to 0x3f: unconfirmed encryption
    79 
    80         pEpCtUnconfirmedEncryption = 0x10,       // generic
    81         pEpCtOpenPGPWeakUnconfirmed = 0x11,      // RSA 1024 is weak
    82 
    83         pEpCtToBeChecked = 0x20,                 // generic
    84         pEpCtSMIMEUnconfirmed = 0x21,
    85         pEpCtCMSUnconfirmed = 0x22,
    86 
    87         pEpCtStrongButUnconfirmed = 0x30,        // generic
    88         pEpCtOpenPGPUnconfirmed = 0x38,          // key at least 2048 bit RSA or EC
    89         pEpCtOTRUnconfirmed = 0x3a,
    90 
    91         // range 0x40 to 0x7f: unconfirmed encryption and anonymization
    92 
    93         pEpCtUnconfirmedEncAnon = 0x40,          // generic
    94         pEpCtpEpUnconfirmed = 0x7f,
    95 
    96         pEpCtConfirmed = 0x80,                   // this bit decides if trust is confirmed
    97 
    98         // range 0x81 to 0x8f: reserved
    99         // range 0x90 to 0xbf: confirmed encryption
   100 
   101         pEpCtConfirmedEncryption = 0x90,         // generic
   102         pEpCtOpenPGPWeak = 0x91,                 // RSA 1024 is weak
   103 
   104         pEpCtToBeCheckedConfirmed = 0xa0,        // generic
   105         pEpCtSMIME = 0xa1,
   106         pEpCtCMS = 0xa2,
   107 
   108         pEpCtStrongEncryption = 0xb0,            // generic
   109         pEpCtOpenPGP = 0xb8,                     // key at least 2048 bit RSA or EC
   110         pEpCtOTR = 0xba,
   111 
   112         // range 0xc0 to 0xff: confirmed encryption and anonymization
   113 
   114         pEpCtConfirmedEncAnon = 0xc0,            // generic
   115         pEpCtpEp = 0xff
   116     } pEpComType;
   117 
   118     [uuid(C3A3814E-567F-4D1C-9F44-9B1DA3957A89)] struct pEpIdentity {
   119         BSTR Address;
   120         BSTR Fpr;
   121         BSTR UserId;
   122         BSTR UserName;
   123         pEpComType CommType;
   124         BSTR Lang;
   125     };
   126 
   127     // Keymanagement API
   128 
   129     HRESULT StartKeyserverLookup();
   130     HRESULT StopKeyserverLookup();
   131 
   132     HRESULT Myself([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   133     HRESULT UpdateIdentity([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   134     HRESULT KeyMistrusted([in] struct pEpIdentity *ident);
   135     HRESULT KeyResetTrust([in] struct pEpIdentity *ident);
   136     HRESULT TrustPersonalKey([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   137 
   138     // Blacklist API
   139 
   140     HRESULT BlacklistAdd([in] BSTR fpr);
   141     HRESULT BlacklistDelete([in] BSTR fpr);
   142     HRESULT BlacklistIsListed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
   143     HRESULT BlacklistRetrieve([out, retval] SAFEARRAY(BSTR) *blacklist);
   144 
   145     // PGP compatibility functions
   146 
   147     HRESULT OpenPGPListKeyinfo([in] BSTR searchPattern, [out, retval] SAFEARRAY(struct StringPair)* keyinfoList);
   148 
   149     // Message API
   150 
   151     typedef [v1_enum] enum pEpRating {
   152         pEpRatingUndefined = 0,
   153         pEpRatingCannotDecrypt,
   154         pEpRatingHaveNoKey,
   155         pEpRatingUnencrypted,
   156         pEpRatingUnencryptedForSome,
   157         pEpRatingUnreliable,
   158         pEpRatingReliable,
   159         pEpRatingTrusted,
   160         pEpRatingTrustedAndAnonymized,
   161         pEpRatingFullyAnonymous,
   162 
   163         pEpRatingMistrust = -1,
   164         pEpRatingB0rken = -2,
   165         pEpRatingUnderAttack = -3
   166     } pEpRating;
   167 
   168     typedef [v1_enum] enum pEpColor {
   169         pEpColorNoColor = 0,
   170         pEpColorYellow,
   171         pEpColorGreen,
   172         pEpColorRed = -1,
   173     } pEpColor;
   174 
   175     typedef [v1_enum] enum pEpEncryptFlags {
   176         pEpEncryptFlagsNone = 0,
   177         pEpEncryptFlagForceEncryption = 0x1,
   178     } pEpEncryptFlags;
   179 
   180     typedef [v1_enum] enum pEpDecryptFlags {
   181         pEpDecryptFlagsNone = 0,
   182         pEpDecryptFlagOwnPrivateKey = 0x1
   183     } pEpDecryptFlags;
   184 
   185     typedef [v1_enum] enum pEpMsgDirection {
   186         pEpDirIncoming = 0,
   187         pEpDirOutgoing
   188     } pEpMsgDirection;
   189 
   190     [uuid(47FB0795-6B64-455C-BB0E-54998CAB8ACB)] struct StringPair {
   191         BSTR Name;
   192         BSTR Value;
   193     };
   194 
   195     [uuid(634EB7CE-99AA-460D-BDF8-F7CDA7232CA6)] struct Blob {
   196         SAFEARRAY(BYTE) value;
   197         BSTR MimeType;
   198         BSTR Filename;
   199     };
   200 
   201     [uuid(B6F40887-E761-4A47-B204-A0193EE0284D)] struct TextMessage {
   202         pEpMsgDirection Dir;
   203         BSTR Id;
   204         BSTR ShortMsg;
   205         BSTR LongMsg;
   206         BSTR LongMsgFormatted;
   207         SAFEARRAY(struct Blob) Attachments;
   208         hyper Sent; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   209         hyper Recv; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   210         struct pEpIdentity From;
   211         SAFEARRAY(struct pEpIdentity) To;
   212         struct pEpIdentity RecvBy;
   213         SAFEARRAY(struct pEpIdentity) Cc;
   214         SAFEARRAY(struct pEpIdentity) Bcc;
   215         SAFEARRAY(struct pEpIdentity) ReplyTo;
   216         SAFEARRAY(BSTR) References;
   217         SAFEARRAY(BSTR) Keywords;
   218         BSTR Comments;
   219         SAFEARRAY(struct StringPair) OptFields;
   220     };
   221 
   222     HRESULT EncryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [in] SAFEARRAY(BSTR) extra, [in, defaultvalue(pEpEncryptFlagsNone)] pEpEncryptFlags flags);
   223     HRESULT DecryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [out] SAFEARRAY(BSTR) *keylist, [out] pEpDecryptFlags* flags, [out, retval] pEpRating *rating);
   224 
   225     HRESULT OutgoingMessageRating([in] struct TextMessage *msg, [out, retval] pEpRating * pVal);
   226     HRESULT IdentityRating([in] struct pEpIdentity * ident, [out, retval] pEpRating * pVal);
   227     HRESULT ColorFromRating([in] pEpRating rating, [out, retval] pEpColor* pVal);
   228 
   229     // callback / keysync API
   230     HRESULT RegisterCallbacks([in] IpEpEngineCallbacks* newCallback);
   231     HRESULT UnregisterCallbacks();
   232 };
   233 
   234 [
   235     uuid(564A4350-419E-47F1-B0DF-6FCCF0CD0BBC),
   236     version(1.0),
   237 ]
   238 library pEpCOMServerAdapterLib
   239 {
   240     importlib("stdole2.tlb");
   241 
   242     [
   243         uuid(5FF6682B-727B-4DFE-A68D-28982874C0C7)
   244     ]
   245     coclass pEpEngine {
   246         [default] interface IpEpEngine;
   247         interface IpEpEngineCallbacks;
   248     };
   249 };