security/manager/ssl/src/nsNSSCertificateDB.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

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

mercurial