| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_NSS_H_ | 5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_NSS_H_ |
| 6 #define NET_CERT_INTERNAL_TRUST_STORE_NSS_H_ | 6 #define NET_CERT_INTERNAL_TRUST_STORE_NSS_H_ |
| 7 | 7 |
| 8 #include <certt.h> | 8 #include <certt.h> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 #include "net/cert/internal/trust_store.h" | 12 #include "net/cert/internal/trust_store.h" |
| 13 | 13 |
| 14 namespace base { | |
| 15 class TaskRunner; | |
| 16 } | |
| 17 | |
| 18 namespace net { | 14 namespace net { |
| 19 | 15 |
| 20 // TrustStoreNSS is an implementation of TrustStore which uses NSS to find trust | 16 // TrustStoreNSS is an implementation of TrustStore which uses NSS to find trust |
| 21 // anchors for path building. | 17 // anchors for path building. |
| 22 // TODO(mattm): also implement CertIssuerSource to return intermediates in NSS | 18 // TODO(mattm): also implement CertIssuerSource to return intermediates in NSS |
| 23 // DB? Or have a separate CertIssuerSourceNSS for that? (implementing both in | 19 // DB? Or have a separate CertIssuerSourceNSS for that? (implementing both in |
| 24 // the same class could be more efficient with some caching/etc. Need to be | 20 // the same class could be more efficient with some caching/etc. Need to be |
| 25 // careful about caching between different pathbuilder instances though.) | 21 // careful about caching between different pathbuilder instances though.) |
| 26 class NET_EXPORT TrustStoreNSS : public TrustStore { | 22 class NET_EXPORT TrustStoreNSS : public TrustStore { |
| 27 public: | 23 public: |
| 28 // Creates a TrustStoreNSS which will find anchors that are trusted for | 24 // Creates a TrustStoreNSS which will find anchors that are trusted for |
| 29 // |trust_type|. All NSS calls will be done on |nss_task_runner|. | 25 // |trust_type|. |
| 30 TrustStoreNSS(SECTrustType trust_type, | 26 explicit TrustStoreNSS(SECTrustType trust_type); |
| 31 scoped_refptr<base::TaskRunner> nss_task_runner); | |
| 32 ~TrustStoreNSS() override; | 27 ~TrustStoreNSS() override; |
| 33 | 28 |
| 34 // TrustStore implementation: | 29 // TrustStore implementation: |
| 35 void FindTrustAnchorsForCert( | 30 void FindTrustAnchorsForCert(const scoped_refptr<ParsedCertificate>& cert, |
| 36 const scoped_refptr<ParsedCertificate>& cert, | 31 TrustAnchors* matches) const override; |
| 37 const TrustAnchorsCallback& callback, | |
| 38 TrustAnchors* synchronous_matches, | |
| 39 std::unique_ptr<Request>* out_req) const override; | |
| 40 | 32 |
| 41 private: | 33 private: |
| 42 SECTrustType trust_type_; | 34 SECTrustType trust_type_; |
| 43 scoped_refptr<base::TaskRunner> nss_task_runner_; | |
| 44 | 35 |
| 45 DISALLOW_COPY_AND_ASSIGN(TrustStoreNSS); | 36 DISALLOW_COPY_AND_ASSIGN(TrustStoreNSS); |
| 46 }; | 37 }; |
| 47 | 38 |
| 48 } // namespace net | 39 } // namespace net |
| 49 | 40 |
| 50 #endif // NET_CERT_INTERNAL_TRUST_STORE_NSS_H_ | 41 #endif // NET_CERT_INTERNAL_TRUST_STORE_NSS_H_ |
| OLD | NEW |