michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __NS_CMS_H__ michael@0: #define __NS_CMS_H__ michael@0: michael@0: #include "nsISupports.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsXPIDLString.h" michael@0: #include "nsIInterfaceRequestor.h" michael@0: #include "nsICMSMessage.h" michael@0: #include "nsICMSMessage2.h" michael@0: #include "nsIX509Cert3.h" michael@0: #include "nsVerificationJob.h" michael@0: #include "nsICMSEncoder.h" michael@0: #include "nsICMSDecoder.h" michael@0: #include "sechash.h" michael@0: #include "cms.h" michael@0: #include "nsNSSShutDown.h" michael@0: michael@0: #define NS_CMSMESSAGE_CID \ michael@0: { 0xa4557478, 0xae16, 0x11d5, { 0xba,0x4b,0x00,0x10,0x83,0x03,0xb1,0x17 } } michael@0: michael@0: class nsCMSMessage : public nsICMSMessage, michael@0: public nsICMSMessage2, michael@0: public nsNSSShutDownObject michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSICMSMESSAGE michael@0: NS_DECL_NSICMSMESSAGE2 michael@0: michael@0: nsCMSMessage(); michael@0: nsCMSMessage(NSSCMSMessage* aCMSMsg); michael@0: virtual ~nsCMSMessage(); michael@0: michael@0: void referenceContext(nsIInterfaceRequestor* aContext) {m_ctx = aContext;} michael@0: NSSCMSMessage* getCMS() {return m_cmsMsg;} michael@0: private: michael@0: nsCOMPtr m_ctx; michael@0: NSSCMSMessage * m_cmsMsg; michael@0: NSSCMSSignerInfo* GetTopLevelSignerInfo(); michael@0: nsresult CommonVerifySignature(unsigned char* aDigestData, uint32_t aDigestDataLen); michael@0: michael@0: nsresult CommonAsyncVerifySignature(nsISMimeVerificationListener *aListener, michael@0: unsigned char* aDigestData, uint32_t aDigestDataLen); michael@0: michael@0: virtual void virtualDestroyNSSReference(); michael@0: void destructorSafeDestroyNSSReference(); michael@0: michael@0: friend class nsSMimeVerificationJob; michael@0: }; michael@0: michael@0: // =============================================== michael@0: // nsCMSDecoder - implementation of nsICMSDecoder michael@0: // =============================================== michael@0: michael@0: #define NS_CMSDECODER_CID \ michael@0: { 0x9dcef3a4, 0xa3bc, 0x11d5, { 0xba, 0x47, 0x00, 0x10, 0x83, 0x03, 0xb1, 0x17 } } michael@0: michael@0: class nsCMSDecoder : public nsICMSDecoder, michael@0: public nsNSSShutDownObject michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSICMSDECODER michael@0: michael@0: nsCMSDecoder(); michael@0: virtual ~nsCMSDecoder(); michael@0: michael@0: private: michael@0: nsCOMPtr m_ctx; michael@0: NSSCMSDecoderContext *m_dcx; michael@0: virtual void virtualDestroyNSSReference(); michael@0: void destructorSafeDestroyNSSReference(); michael@0: }; michael@0: michael@0: // =============================================== michael@0: // nsCMSEncoder - implementation of nsICMSEncoder michael@0: // =============================================== michael@0: michael@0: #define NS_CMSENCODER_CID \ michael@0: { 0xa15789aa, 0x8903, 0x462b, { 0x81, 0xe9, 0x4a, 0xa2, 0xcf, 0xf4, 0xd5, 0xcb } } michael@0: class nsCMSEncoder : public nsICMSEncoder, michael@0: public nsNSSShutDownObject michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSICMSENCODER michael@0: michael@0: nsCMSEncoder(); michael@0: virtual ~nsCMSEncoder(); michael@0: michael@0: private: michael@0: nsCOMPtr m_ctx; michael@0: NSSCMSEncoderContext *m_ecx; michael@0: virtual void virtualDestroyNSSReference(); michael@0: void destructorSafeDestroyNSSReference(); michael@0: }; michael@0: michael@0: #endif