Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / security / manager / ssl / nsNSSCertificate.h
blobcec7331c6b4f867cd18d3b12890b6b630e3ee4b9
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 nsNSSCertificate_h
7 #define nsNSSCertificate_h
9 #include "ScopedNSSTypes.h"
10 #include "certt.h"
11 #include "mozilla/DataMutex.h"
12 #include "mozilla/Maybe.h"
13 #include "nsCOMPtr.h"
14 #include "nsIClassInfo.h"
15 #include "nsISerializable.h"
16 #include "nsIX509Cert.h"
17 #include "nsStringFwd.h"
19 class nsNSSCertificate final : public nsIX509Cert,
20 public nsISerializable,
21 public nsIClassInfo {
22 public:
23 NS_DECL_THREADSAFE_ISUPPORTS
24 NS_DECL_NSIX509CERT
25 NS_DECL_NSISERIALIZABLE
26 NS_DECL_NSICLASSINFO
28 nsNSSCertificate();
29 explicit nsNSSCertificate(CERTCertificate* cert);
30 explicit nsNSSCertificate(nsTArray<uint8_t>&& der);
32 private:
33 virtual ~nsNSSCertificate() = default;
34 nsresult GetCertificateHash(nsAString& aFingerprint, SECOidTag aHashAlg);
35 mozilla::UniqueCERTCertificate GetOrInstantiateCert();
37 nsTArray<uint8_t> mDER;
38 // There may be multiple threads running when mCert is actually instantiated,
39 // so it must be protected by a mutex.
40 mozilla::DataMutex<mozilla::Maybe<mozilla::UniqueCERTCertificate>> mCert;
43 #define NS_X509CERT_CID \
44 { /* 660a3226-915c-4ffb-bb20-8985a632df05 */ \
45 0x660a3226, 0x915c, 0x4ffb, { \
46 0xbb, 0x20, 0x89, 0x85, 0xa6, 0x32, 0xdf, 0x05 \
47 } \
50 #endif // nsNSSCertificate_h