Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: net/cert/internal/cert_source_static.h

Issue 2030693002: Add CertIssuerSource interface and CertIssuerSourceStatic implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert-parsing-base
Patch Set: . Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/cert/internal/cert_source_static.h
diff --git a/net/cert/internal/cert_source_static.h b/net/cert/internal/cert_source_static.h
new file mode 100644
index 0000000000000000000000000000000000000000..9d3fe56cf65abe5bcb7e2ced44d1987e056ec915
--- /dev/null
+++ b/net/cert/internal/cert_source_static.h
@@ -0,0 +1,45 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_CERT_INTERNAL_CERT_SOURCE_STATIC_H_
+#define NET_CERT_INTERNAL_CERT_SOURCE_STATIC_H_
+
+#include <unordered_map>
+
+#include "base/strings/string_piece.h"
+#include "net/cert/internal/cert_source.h"
+
+namespace net {
+
+// Synchronously returns issuers from a pre-supplied set.
+class NET_EXPORT CertSourceStatic : public CertSource {
+ public:
+ CertSourceStatic();
+ ~CertSourceStatic() override;
+
+ // Adds |cert| to the set of certificates that this CertSource will provide.
+ void AddCert(scoped_refptr<ParsedCertificate> cert);
+
+ // CertSource implementation:
+ void SyncGetIssuersOf(
+ const ParsedCertificate* cert,
+ std::vector<scoped_refptr<ParsedCertificate>>* issuers) override;
+ void AsyncGetIssuersOf(const ParsedCertificate* cert,
+ const IssuerCallback& issuers_callback,
+ std::unique_ptr<Request>* out_req) override;
+
+ private:
+ // The certificates that the CertSourceStatic can return, keyed on the
+ // normalized subject value.
+ std::unordered_multimap<base::StringPiece,
+ scoped_refptr<ParsedCertificate>,
+ base::StringPieceHash>
+ intermediates_;
+
+ DISALLOW_COPY_AND_ASSIGN(CertSourceStatic);
+};
+
+} // namespace net
+
+#endif // NET_CERT_INTERNAL_CERT_SOURCE_STATIC_H_

Powered by Google App Engine
This is Rietveld 408576698