|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef __NS_CMS_H__ |
|
7 #define __NS_CMS_H__ |
|
8 |
|
9 #include "nsISupports.h" |
|
10 #include "nsCOMPtr.h" |
|
11 #include "nsXPIDLString.h" |
|
12 #include "nsIInterfaceRequestor.h" |
|
13 #include "nsICMSMessage.h" |
|
14 #include "nsICMSMessage2.h" |
|
15 #include "nsIX509Cert3.h" |
|
16 #include "nsVerificationJob.h" |
|
17 #include "nsICMSEncoder.h" |
|
18 #include "nsICMSDecoder.h" |
|
19 #include "sechash.h" |
|
20 #include "cms.h" |
|
21 #include "nsNSSShutDown.h" |
|
22 |
|
23 #define NS_CMSMESSAGE_CID \ |
|
24 { 0xa4557478, 0xae16, 0x11d5, { 0xba,0x4b,0x00,0x10,0x83,0x03,0xb1,0x17 } } |
|
25 |
|
26 class nsCMSMessage : public nsICMSMessage, |
|
27 public nsICMSMessage2, |
|
28 public nsNSSShutDownObject |
|
29 { |
|
30 public: |
|
31 NS_DECL_THREADSAFE_ISUPPORTS |
|
32 NS_DECL_NSICMSMESSAGE |
|
33 NS_DECL_NSICMSMESSAGE2 |
|
34 |
|
35 nsCMSMessage(); |
|
36 nsCMSMessage(NSSCMSMessage* aCMSMsg); |
|
37 virtual ~nsCMSMessage(); |
|
38 |
|
39 void referenceContext(nsIInterfaceRequestor* aContext) {m_ctx = aContext;} |
|
40 NSSCMSMessage* getCMS() {return m_cmsMsg;} |
|
41 private: |
|
42 nsCOMPtr<nsIInterfaceRequestor> m_ctx; |
|
43 NSSCMSMessage * m_cmsMsg; |
|
44 NSSCMSSignerInfo* GetTopLevelSignerInfo(); |
|
45 nsresult CommonVerifySignature(unsigned char* aDigestData, uint32_t aDigestDataLen); |
|
46 |
|
47 nsresult CommonAsyncVerifySignature(nsISMimeVerificationListener *aListener, |
|
48 unsigned char* aDigestData, uint32_t aDigestDataLen); |
|
49 |
|
50 virtual void virtualDestroyNSSReference(); |
|
51 void destructorSafeDestroyNSSReference(); |
|
52 |
|
53 friend class nsSMimeVerificationJob; |
|
54 }; |
|
55 |
|
56 // =============================================== |
|
57 // nsCMSDecoder - implementation of nsICMSDecoder |
|
58 // =============================================== |
|
59 |
|
60 #define NS_CMSDECODER_CID \ |
|
61 { 0x9dcef3a4, 0xa3bc, 0x11d5, { 0xba, 0x47, 0x00, 0x10, 0x83, 0x03, 0xb1, 0x17 } } |
|
62 |
|
63 class nsCMSDecoder : public nsICMSDecoder, |
|
64 public nsNSSShutDownObject |
|
65 { |
|
66 public: |
|
67 NS_DECL_THREADSAFE_ISUPPORTS |
|
68 NS_DECL_NSICMSDECODER |
|
69 |
|
70 nsCMSDecoder(); |
|
71 virtual ~nsCMSDecoder(); |
|
72 |
|
73 private: |
|
74 nsCOMPtr<nsIInterfaceRequestor> m_ctx; |
|
75 NSSCMSDecoderContext *m_dcx; |
|
76 virtual void virtualDestroyNSSReference(); |
|
77 void destructorSafeDestroyNSSReference(); |
|
78 }; |
|
79 |
|
80 // =============================================== |
|
81 // nsCMSEncoder - implementation of nsICMSEncoder |
|
82 // =============================================== |
|
83 |
|
84 #define NS_CMSENCODER_CID \ |
|
85 { 0xa15789aa, 0x8903, 0x462b, { 0x81, 0xe9, 0x4a, 0xa2, 0xcf, 0xf4, 0xd5, 0xcb } } |
|
86 class nsCMSEncoder : public nsICMSEncoder, |
|
87 public nsNSSShutDownObject |
|
88 { |
|
89 public: |
|
90 NS_DECL_THREADSAFE_ISUPPORTS |
|
91 NS_DECL_NSICMSENCODER |
|
92 |
|
93 nsCMSEncoder(); |
|
94 virtual ~nsCMSEncoder(); |
|
95 |
|
96 private: |
|
97 nsCOMPtr<nsIInterfaceRequestor> m_ctx; |
|
98 NSSCMSEncoderContext *m_ecx; |
|
99 virtual void virtualDestroyNSSReference(); |
|
100 void destructorSafeDestroyNSSReference(); |
|
101 }; |
|
102 |
|
103 #endif |