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