security/manager/ssl/src/nsNSSCertificateDB.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef __NSNSSCERTIFICATEDB_H__
     6 #define __NSNSSCERTIFICATEDB_H__
     8 #include "nsIX509CertDB.h"
     9 #include "nsIX509CertDB2.h"
    10 #include "nsNSSShutDown.h"
    11 #include "mozilla/RefPtr.h"
    12 #include "mozilla/Mutex.h"
    13 #include "certt.h"
    15 class nsCString;
    16 class nsIArray;
    17 class nsRecentBadCerts;
    19 class nsNSSCertificateDB : public nsIX509CertDB
    20                          , public nsIX509CertDB2
    21                          , public nsNSSShutDownObject
    23 {
    24 public:
    25   NS_DECL_THREADSAFE_ISUPPORTS
    26   NS_DECL_NSIX509CERTDB
    27   NS_DECL_NSIX509CERTDB2
    29   nsNSSCertificateDB(); 
    30   virtual ~nsNSSCertificateDB();
    32   // Use this function to generate a default nickname for a user
    33   // certificate that is to be imported onto a token.
    34   static void
    35   get_default_nickname(CERTCertificate *cert, nsIInterfaceRequestor* ctx,
    36                        nsCString &nickname,
    37                        const nsNSSShutDownPreventionLock &proofOfLock);
    39   static nsresult 
    40   ImportValidCACerts(int numCACerts, SECItem *CACerts, nsIInterfaceRequestor *ctx,
    41                      const nsNSSShutDownPreventionLock &proofOfLock);
    43 private:
    45   static nsresult
    46   ImportValidCACertsInList(CERTCertList *certList, nsIInterfaceRequestor *ctx,
    47                            const nsNSSShutDownPreventionLock &proofOfLock);
    49   static void DisplayCertificateAlert(nsIInterfaceRequestor *ctx, 
    50                                       const char *stringID, nsIX509Cert *certToShow,
    51                                       const nsNSSShutDownPreventionLock &proofOfLock);
    53   void getCertNames(CERTCertList *certList,
    54                     uint32_t      type, 
    55                     uint32_t     *_count,
    56                     char16_t  ***_certNameList,
    57                     const nsNSSShutDownPreventionLock &proofOfLock);
    59   CERTDERCerts *getCertsFromPackage(PLArenaPool *arena, uint8_t *data, 
    60                                     uint32_t length,
    61                                     const nsNSSShutDownPreventionLock &proofOfLock);
    62   nsresult handleCACertDownload(nsIArray *x509Certs, 
    63                                 nsIInterfaceRequestor *ctx,
    64                                 const nsNSSShutDownPreventionLock &proofOfLock);
    66   mozilla::Mutex mBadCertsLock;
    67   mozilla::RefPtr<nsRecentBadCerts> mPublicRecentBadCerts;
    68   mozilla::RefPtr<nsRecentBadCerts> mPrivateRecentBadCerts;
    70   // We don't own any NSS objects here, so no need to clean up
    71   virtual void virtualDestroyNSSReference() { };
    72 };
    74 #define NS_X509CERTDB_CID { /* fb0bbc5c-452e-4783-b32c-80124693d871 */ \
    75     0xfb0bbc5c,                                                        \
    76     0x452e,                                                            \
    77     0x4783,                                                            \
    78     {0xb3, 0x2c, 0x80, 0x12, 0x46, 0x93, 0xd8, 0x71}                   \
    79   }
    81 #endif

mercurial