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

Unified Diff: net/tools/domain_security_preload_generator/spki_hash.cc

Issue 2632073002: Rename domain_security_preload_generator. (Closed)
Patch Set: rebase & comment rsleevi Created 3 years, 11 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/tools/domain_security_preload_generator/spki_hash.cc
diff --git a/net/tools/domain_security_preload_generator/spki_hash.cc b/net/tools/domain_security_preload_generator/spki_hash.cc
deleted file mode 100644
index d95de696c87ce9b6524e1eba340d2c5d3113bc64..0000000000000000000000000000000000000000
--- a/net/tools/domain_security_preload_generator/spki_hash.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-#include "net/tools/domain_security_preload_generator/spki_hash.h"
-
-#include <string>
-
-#include "base/base64.h"
-#include "base/logging.h"
-#include "base/strings/string_util.h"
-#include "third_party/boringssl/src/include/openssl/sha.h"
-
-namespace net {
-
-namespace transport_security_state {
-
-SPKIHash::SPKIHash() {}
-
-SPKIHash::~SPKIHash() {}
-
-bool SPKIHash::FromString(const std::string& hash_string) {
- std::string base64_string;
-
- if (!base::StartsWith(hash_string, "sha256/",
- base::CompareCase::INSENSITIVE_ASCII)) {
- return false;
- }
- base64_string = hash_string.substr(7);
-
- std::string decoded;
- if (!base::Base64Decode(base64_string, &decoded)) {
- return false;
- }
-
- if (decoded.size() != size()) {
- return false;
- }
-
- memcpy(data_, decoded.data(), decoded.size());
- return true;
-}
-
-void SPKIHash::CalculateFromBytes(const uint8_t* input, size_t input_length) {
- SHA256(input, input_length, data_);
-}
-
-} // namespace transport_security_state
-
-} // namespace net

Powered by Google App Engine
This is Rietveld 408576698