pEpCOMServerAdapter.idl
author Markus Schaber <markus@pep-security.net>
Sat, 12 Nov 2016 00:29:25 +0100
changeset 204 21b7749b5beb
parent 202 92fcb5658a34
child 217 7ebb44e5bf85
permissions -rw-r--r--
COM-41: Preliminary fix for the exception althouhg we still have
some discussion ongoing.
     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         pEpDecryptFlagConsumed = 0x2,
   184         pEpDecryptFlagDiscarded = 0x4
   185     } pEpDecryptFlags;
   186 
   187     typedef [v1_enum] enum pEpMsgDirection {
   188         pEpDirIncoming = 0,
   189         pEpDirOutgoing
   190     } pEpMsgDirection;
   191 
   192     [uuid(47FB0795-6B64-455C-BB0E-54998CAB8ACB)] struct StringPair {
   193         BSTR Name;
   194         BSTR Value;
   195     };
   196 
   197     [uuid(634EB7CE-99AA-460D-BDF8-F7CDA7232CA6)] struct Blob {
   198         SAFEARRAY(BYTE) value;
   199         BSTR MimeType;
   200         BSTR Filename;
   201     };
   202 
   203     [uuid(B6F40887-E761-4A47-B204-A0193EE0284D)] struct TextMessage {
   204         pEpMsgDirection Dir;
   205         BSTR Id;
   206         BSTR ShortMsg;
   207         BSTR LongMsg;
   208         BSTR LongMsgFormatted;
   209         SAFEARRAY(struct Blob) Attachments;
   210         hyper Sent; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   211         hyper Recv; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   212         struct pEpIdentity From;
   213         SAFEARRAY(struct pEpIdentity) To;
   214         struct pEpIdentity RecvBy;
   215         SAFEARRAY(struct pEpIdentity) Cc;
   216         SAFEARRAY(struct pEpIdentity) Bcc;
   217         SAFEARRAY(struct pEpIdentity) ReplyTo;
   218         SAFEARRAY(BSTR) References;
   219         SAFEARRAY(BSTR) Keywords;
   220         BSTR Comments;
   221         SAFEARRAY(struct StringPair) OptFields;
   222     };
   223 
   224     HRESULT EncryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [in] SAFEARRAY(BSTR) extra, [in, defaultvalue(pEpEncryptFlagsNone)] pEpEncryptFlags flags);
   225     HRESULT DecryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [out] SAFEARRAY(BSTR) *keylist, [out] pEpDecryptFlags* flags, [out, retval] pEpRating *rating);
   226 
   227     HRESULT OutgoingMessageRating([in] struct TextMessage *msg, [out, retval] pEpRating * pVal);
   228     HRESULT IdentityRating([in] struct pEpIdentity * ident, [out, retval] pEpRating * pVal);
   229     HRESULT ColorFromRating([in] pEpRating rating, [out, retval] pEpColor* pVal);
   230 
   231     // callback / keysync API
   232     HRESULT RegisterCallbacks([in] IpEpEngineCallbacks* newCallback);
   233     HRESULT UnregisterCallbacks();
   234 };
   235 
   236 [
   237     uuid(564A4350-419E-47F1-B0DF-6FCCF0CD0BBC),
   238     version(1.0),
   239 ]
   240 library pEpCOMServerAdapterLib
   241 {
   242     importlib("stdole2.tlb");
   243 
   244     [
   245         uuid(5FF6682B-727B-4DFE-A68D-28982874C0C7)
   246     ]
   247     coclass pEpEngine {
   248         [default] interface IpEpEngine;
   249         interface IpEpEngineCallbacks;
   250     };
   251 };