diff options
Diffstat (limited to '')
-rw-r--r-- | comm/mailnews/extensions/smime/nsICMSMessage.idl | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/comm/mailnews/extensions/smime/nsICMSMessage.idl b/comm/mailnews/extensions/smime/nsICMSMessage.idl new file mode 100644 index 0000000000..ed863e5418 --- /dev/null +++ b/comm/mailnews/extensions/smime/nsICMSMessage.idl @@ -0,0 +1,96 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsISMimeVerificationListener; + +%{ C++ +#define NS_CMSMESSAGE_CONTRACTID "@mozilla.org/nsCMSMessage;1" +%} + +/* + * At the time the ptr type is eliminated in both interfaces, both should be + * made scriptable. + */ +[ptr] native UnsignedCharPtr(unsigned char); + +interface nsIX509Cert; + +[uuid(cd76ec81-02f0-41a3-8852-c0acce0bab53)] +interface nsICMSVerifyFlags : nsISupports +{ + const long NONE = 0; + const long VERIFY_ALLOW_WEAK_SHA1 = 1 << 0; +}; + +/** + * nsICMSMessage + * Interface to a CMS Message + */ +[uuid(c6d51c22-73e9-4dad-86b9-bde584e33c63)] +interface nsICMSMessage : nsISupports +{ + void contentIsSigned(out boolean aSigned); + void contentIsEncrypted(out boolean aEncrypted); + void getSignerCommonName(out string aName); + void getSignerEmailAddress(out string aEmail); + void getSignerCert(out nsIX509Cert scert); + void getEncryptionCert(out nsIX509Cert ecert); + void getSigningTime(out PRTime aTime); + + /** + * @param verifyFlags - Optional flags from nsICMSVerifyFlags. + */ + void verifySignature(in long verifyFlags); + + /** + * @param verifyFlags - Optional flags from nsICMSVerifyFlags. + */ + void verifyDetachedSignature(in long verifyFlags, + in Array<octet> aDigestData, + in int16_t aDigestType); + void CreateEncrypted(in Array<nsIX509Cert> aRecipientCerts); + + /* The parameter aDigestType must be one of the values in nsICryptoHash */ + void CreateSigned(in nsIX509Cert scert, in nsIX509Cert ecert, + in Array<octet> aDigestData, in int16_t aDigestType); + + /** + * Async version of nsICMSMessage::VerifySignature. + * Code will be executed on a background thread and + * availability of results will be notified using a + * call to nsISMimeVerificationListener. + */ + void asyncVerifySignature(in long verifyFlags, + in nsISMimeVerificationListener listener); + + /** + * Async version of nsICMSMessage::VerifyDetachedSignature. + * Code will be executed on a background thread and + * availability of results will be notified using a + * call to nsISMimeVerificationListener. + * + * Set aDigestType to one of the values from nsICryptoHash. + */ + void asyncVerifyDetachedSignature(in long verifyFlags, + in nsISMimeVerificationListener listener, + in Array<octet> aDigestData, + in int16_t aDigestType); +}; + +[uuid(5226d698-0773-4f25-b94c-7944b3fc01d3)] +interface nsISMimeVerificationListener : nsISupports { + + /** + * Notify that results are ready, that have been requested + * using nsICMSMessage::asyncVerify[Detached]Signature() + * + * verificationResultCode matches synchronous result code from + * nsICMSMessage::verify[Detached]Signature + */ + void notify(in nsICMSMessage verifiedMessage, + in nsresult verificationResultCode); +}; |