diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/extensions/smime/nsICMSMessage.idl | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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); +}; |