1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/ssl/src/nsCMS.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,103 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef __NS_CMS_H__ 1.10 +#define __NS_CMS_H__ 1.11 + 1.12 +#include "nsISupports.h" 1.13 +#include "nsCOMPtr.h" 1.14 +#include "nsXPIDLString.h" 1.15 +#include "nsIInterfaceRequestor.h" 1.16 +#include "nsICMSMessage.h" 1.17 +#include "nsICMSMessage2.h" 1.18 +#include "nsIX509Cert3.h" 1.19 +#include "nsVerificationJob.h" 1.20 +#include "nsICMSEncoder.h" 1.21 +#include "nsICMSDecoder.h" 1.22 +#include "sechash.h" 1.23 +#include "cms.h" 1.24 +#include "nsNSSShutDown.h" 1.25 + 1.26 +#define NS_CMSMESSAGE_CID \ 1.27 + { 0xa4557478, 0xae16, 0x11d5, { 0xba,0x4b,0x00,0x10,0x83,0x03,0xb1,0x17 } } 1.28 + 1.29 +class nsCMSMessage : public nsICMSMessage, 1.30 + public nsICMSMessage2, 1.31 + public nsNSSShutDownObject 1.32 +{ 1.33 +public: 1.34 + NS_DECL_THREADSAFE_ISUPPORTS 1.35 + NS_DECL_NSICMSMESSAGE 1.36 + NS_DECL_NSICMSMESSAGE2 1.37 + 1.38 + nsCMSMessage(); 1.39 + nsCMSMessage(NSSCMSMessage* aCMSMsg); 1.40 + virtual ~nsCMSMessage(); 1.41 + 1.42 + void referenceContext(nsIInterfaceRequestor* aContext) {m_ctx = aContext;} 1.43 + NSSCMSMessage* getCMS() {return m_cmsMsg;} 1.44 +private: 1.45 + nsCOMPtr<nsIInterfaceRequestor> m_ctx; 1.46 + NSSCMSMessage * m_cmsMsg; 1.47 + NSSCMSSignerInfo* GetTopLevelSignerInfo(); 1.48 + nsresult CommonVerifySignature(unsigned char* aDigestData, uint32_t aDigestDataLen); 1.49 + 1.50 + nsresult CommonAsyncVerifySignature(nsISMimeVerificationListener *aListener, 1.51 + unsigned char* aDigestData, uint32_t aDigestDataLen); 1.52 + 1.53 + virtual void virtualDestroyNSSReference(); 1.54 + void destructorSafeDestroyNSSReference(); 1.55 + 1.56 +friend class nsSMimeVerificationJob; 1.57 +}; 1.58 + 1.59 +// =============================================== 1.60 +// nsCMSDecoder - implementation of nsICMSDecoder 1.61 +// =============================================== 1.62 + 1.63 +#define NS_CMSDECODER_CID \ 1.64 + { 0x9dcef3a4, 0xa3bc, 0x11d5, { 0xba, 0x47, 0x00, 0x10, 0x83, 0x03, 0xb1, 0x17 } } 1.65 + 1.66 +class nsCMSDecoder : public nsICMSDecoder, 1.67 + public nsNSSShutDownObject 1.68 +{ 1.69 +public: 1.70 + NS_DECL_THREADSAFE_ISUPPORTS 1.71 + NS_DECL_NSICMSDECODER 1.72 + 1.73 + nsCMSDecoder(); 1.74 + virtual ~nsCMSDecoder(); 1.75 + 1.76 +private: 1.77 + nsCOMPtr<nsIInterfaceRequestor> m_ctx; 1.78 + NSSCMSDecoderContext *m_dcx; 1.79 + virtual void virtualDestroyNSSReference(); 1.80 + void destructorSafeDestroyNSSReference(); 1.81 +}; 1.82 + 1.83 +// =============================================== 1.84 +// nsCMSEncoder - implementation of nsICMSEncoder 1.85 +// =============================================== 1.86 + 1.87 +#define NS_CMSENCODER_CID \ 1.88 + { 0xa15789aa, 0x8903, 0x462b, { 0x81, 0xe9, 0x4a, 0xa2, 0xcf, 0xf4, 0xd5, 0xcb } } 1.89 +class nsCMSEncoder : public nsICMSEncoder, 1.90 + public nsNSSShutDownObject 1.91 +{ 1.92 +public: 1.93 + NS_DECL_THREADSAFE_ISUPPORTS 1.94 + NS_DECL_NSICMSENCODER 1.95 + 1.96 + nsCMSEncoder(); 1.97 + virtual ~nsCMSEncoder(); 1.98 + 1.99 +private: 1.100 + nsCOMPtr<nsIInterfaceRequestor> m_ctx; 1.101 + NSSCMSEncoderContext *m_ecx; 1.102 + virtual void virtualDestroyNSSReference(); 1.103 + void destructorSafeDestroyNSSReference(); 1.104 +}; 1.105 + 1.106 +#endif