1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/ssl/src/nsNSSCertificateDB.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,81 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef __NSNSSCERTIFICATEDB_H__ 1.9 +#define __NSNSSCERTIFICATEDB_H__ 1.10 + 1.11 +#include "nsIX509CertDB.h" 1.12 +#include "nsIX509CertDB2.h" 1.13 +#include "nsNSSShutDown.h" 1.14 +#include "mozilla/RefPtr.h" 1.15 +#include "mozilla/Mutex.h" 1.16 +#include "certt.h" 1.17 + 1.18 +class nsCString; 1.19 +class nsIArray; 1.20 +class nsRecentBadCerts; 1.21 + 1.22 +class nsNSSCertificateDB : public nsIX509CertDB 1.23 + , public nsIX509CertDB2 1.24 + , public nsNSSShutDownObject 1.25 + 1.26 +{ 1.27 +public: 1.28 + NS_DECL_THREADSAFE_ISUPPORTS 1.29 + NS_DECL_NSIX509CERTDB 1.30 + NS_DECL_NSIX509CERTDB2 1.31 + 1.32 + nsNSSCertificateDB(); 1.33 + virtual ~nsNSSCertificateDB(); 1.34 + 1.35 + // Use this function to generate a default nickname for a user 1.36 + // certificate that is to be imported onto a token. 1.37 + static void 1.38 + get_default_nickname(CERTCertificate *cert, nsIInterfaceRequestor* ctx, 1.39 + nsCString &nickname, 1.40 + const nsNSSShutDownPreventionLock &proofOfLock); 1.41 + 1.42 + static nsresult 1.43 + ImportValidCACerts(int numCACerts, SECItem *CACerts, nsIInterfaceRequestor *ctx, 1.44 + const nsNSSShutDownPreventionLock &proofOfLock); 1.45 + 1.46 +private: 1.47 + 1.48 + static nsresult 1.49 + ImportValidCACertsInList(CERTCertList *certList, nsIInterfaceRequestor *ctx, 1.50 + const nsNSSShutDownPreventionLock &proofOfLock); 1.51 + 1.52 + static void DisplayCertificateAlert(nsIInterfaceRequestor *ctx, 1.53 + const char *stringID, nsIX509Cert *certToShow, 1.54 + const nsNSSShutDownPreventionLock &proofOfLock); 1.55 + 1.56 + void getCertNames(CERTCertList *certList, 1.57 + uint32_t type, 1.58 + uint32_t *_count, 1.59 + char16_t ***_certNameList, 1.60 + const nsNSSShutDownPreventionLock &proofOfLock); 1.61 + 1.62 + CERTDERCerts *getCertsFromPackage(PLArenaPool *arena, uint8_t *data, 1.63 + uint32_t length, 1.64 + const nsNSSShutDownPreventionLock &proofOfLock); 1.65 + nsresult handleCACertDownload(nsIArray *x509Certs, 1.66 + nsIInterfaceRequestor *ctx, 1.67 + const nsNSSShutDownPreventionLock &proofOfLock); 1.68 + 1.69 + mozilla::Mutex mBadCertsLock; 1.70 + mozilla::RefPtr<nsRecentBadCerts> mPublicRecentBadCerts; 1.71 + mozilla::RefPtr<nsRecentBadCerts> mPrivateRecentBadCerts; 1.72 + 1.73 + // We don't own any NSS objects here, so no need to clean up 1.74 + virtual void virtualDestroyNSSReference() { }; 1.75 +}; 1.76 + 1.77 +#define NS_X509CERTDB_CID { /* fb0bbc5c-452e-4783-b32c-80124693d871 */ \ 1.78 + 0xfb0bbc5c, \ 1.79 + 0x452e, \ 1.80 + 0x4783, \ 1.81 + {0xb3, 0x2c, 0x80, 0x12, 0x46, 0x93, 0xd8, 0x71} \ 1.82 + } 1.83 + 1.84 +#endif