security/manager/ssl/src/nsCMS.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     6 #ifndef __NS_CMS_H__
     7 #define __NS_CMS_H__
     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"
    23 #define NS_CMSMESSAGE_CID \
    24   { 0xa4557478, 0xae16, 0x11d5, { 0xba,0x4b,0x00,0x10,0x83,0x03,0xb1,0x17 } }
    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
    35   nsCMSMessage();
    36   nsCMSMessage(NSSCMSMessage* aCMSMsg);
    37   virtual ~nsCMSMessage();
    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);
    47   nsresult CommonAsyncVerifySignature(nsISMimeVerificationListener *aListener,
    48                                       unsigned char* aDigestData, uint32_t aDigestDataLen);
    50   virtual void virtualDestroyNSSReference();
    51   void destructorSafeDestroyNSSReference();
    53 friend class nsSMimeVerificationJob;
    54 };
    56 // ===============================================
    57 // nsCMSDecoder - implementation of nsICMSDecoder
    58 // ===============================================
    60 #define NS_CMSDECODER_CID \
    61   { 0x9dcef3a4, 0xa3bc, 0x11d5, { 0xba, 0x47, 0x00, 0x10, 0x83, 0x03, 0xb1, 0x17 } }
    63 class nsCMSDecoder : public nsICMSDecoder,
    64                      public nsNSSShutDownObject
    65 {
    66 public:
    67   NS_DECL_THREADSAFE_ISUPPORTS
    68   NS_DECL_NSICMSDECODER
    70   nsCMSDecoder();
    71   virtual ~nsCMSDecoder();
    73 private:
    74   nsCOMPtr<nsIInterfaceRequestor> m_ctx;
    75   NSSCMSDecoderContext *m_dcx;
    76   virtual void virtualDestroyNSSReference();
    77   void destructorSafeDestroyNSSReference();
    78 };
    80 // ===============================================
    81 // nsCMSEncoder - implementation of nsICMSEncoder
    82 // ===============================================
    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
    93   nsCMSEncoder();
    94   virtual ~nsCMSEncoder();
    96 private:
    97   nsCOMPtr<nsIInterfaceRequestor> m_ctx;
    98   NSSCMSEncoderContext *m_ecx;
    99   virtual void virtualDestroyNSSReference();
   100   void destructorSafeDestroyNSSReference();
   101 };
   103 #endif

mercurial