Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/security/manager/ssl/nsNSSCertificateDB.h
Line
Count
Source (jump to first uncovered line)
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/. */
4
5
#ifndef nsNSSCertificateDB_h
6
#define nsNSSCertificateDB_h
7
8
#include "ScopedNSSTypes.h"
9
#include "certt.h"
10
#include "mozilla/Mutex.h"
11
#include "mozilla/NotNull.h"
12
#include "mozilla/RefPtr.h"
13
#include "mozilla/UniquePtr.h"
14
#include "nsIX509CertDB.h"
15
#include "nsString.h"
16
17
class nsIArray;
18
19
class nsNSSCertificateDB final : public nsIX509CertDB
20
21
{
22
public:
23
  NS_DECL_THREADSAFE_ISUPPORTS
24
  NS_DECL_NSIX509CERTDB
25
26
  // This is a separate static method so nsNSSComponent can use it during NSS
27
  // initialization. Other code should probably not use it.
28
  static nsresult
29
  FindCertByDBKey(const nsACString& aDBKey, mozilla::UniqueCERTCertificate& cert);
30
31
protected:
32
0
  virtual ~nsNSSCertificateDB() {}
33
34
private:
35
  // Use this function to generate a default nickname for a user
36
  // certificate that is to be imported onto a token.
37
  static void
38
  get_default_nickname(CERTCertificate* cert, nsIInterfaceRequestor* ctx,
39
                       nsCString& nickname);
40
41
  static nsresult
42
  ImportCACerts(int numCACerts, SECItem* CACerts, nsIInterfaceRequestor* ctx);
43
44
  static void DisplayCertificateAlert(nsIInterfaceRequestor* ctx,
45
                                      const char* stringID,
46
                                      nsIX509Cert* certToShow);
47
48
  CERTDERCerts* getCertsFromPackage(const mozilla::UniquePLArenaPool& arena,
49
                                    uint8_t* data, uint32_t length);
50
  nsresult handleCACertDownload(mozilla::NotNull<nsIArray*> x509Certs,
51
                                nsIInterfaceRequestor* ctx);
52
};
53
54
#define NS_X509CERTDB_CID { /* fb0bbc5c-452e-4783-b32c-80124693d871 */ \
55
    0xfb0bbc5c,                                                        \
56
    0x452e,                                                            \
57
    0x4783,                                                            \
58
    {0xb3, 0x2c, 0x80, 0x12, 0x46, 0x93, 0xd8, 0x71}                   \
59
  }
60
61
SECStatus
62
ChangeCertTrustWithPossibleAuthentication(
63
  const mozilla::UniqueCERTCertificate& cert, CERTCertTrust& trust, void* ctx);
64
65
#endif // nsNSSCertificateDB_h