OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/format_macros.h" | 6 #include "base/format_macros.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 uint16 header_len; | 126 uint16 header_len; |
127 memcpy(&header_len, data->data(), 2); // assumes little-endian. | 127 memcpy(&header_len, data->data(), 2); // assumes little-endian. |
128 data->remove_prefix(2); | 128 data->remove_prefix(2); |
129 | 129 |
130 if (data->size() < header_len) | 130 if (data->size() < header_len) |
131 return NULL; | 131 return NULL; |
132 | 132 |
133 const base::StringPiece header_bytes(data->data(), header_len); | 133 const base::StringPiece header_bytes(data->data(), header_len); |
134 data->remove_prefix(header_len); | 134 data->remove_prefix(header_len); |
135 | 135 |
136 scoped_ptr<Value> header(base::JSONReader::Read( | 136 scoped_ptr<base::Value> header(base::JSONReader::Read( |
137 header_bytes, base::JSON_ALLOW_TRAILING_COMMAS)); | 137 header_bytes, base::JSON_ALLOW_TRAILING_COMMAS)); |
138 if (header.get() == NULL) | 138 if (header.get() == NULL) |
139 return NULL; | 139 return NULL; |
140 | 140 |
141 if (!header->IsType(Value::TYPE_DICTIONARY)) | 141 if (!header->IsType(base::Value::TYPE_DICTIONARY)) |
142 return NULL; | 142 return NULL; |
143 return reinterpret_cast<base::DictionaryValue*>(header.release()); | 143 return reinterpret_cast<base::DictionaryValue*>(header.release()); |
144 } | 144 } |
145 | 145 |
146 // kCurrentFileVersion is the version of the CRLSet file format that we | 146 // kCurrentFileVersion is the version of the CRLSet file format that we |
147 // currently implement. | 147 // currently implement. |
148 static const int kCurrentFileVersion = 0; | 148 static const int kCurrentFileVersion = 0; |
149 | 149 |
150 static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash, | 150 static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash, |
151 std::vector<std::string>* out_serials) { | 151 std::vector<std::string>* out_serials) { |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 return new CRLSet; | 584 return new CRLSet; |
585 } | 585 } |
586 | 586 |
587 CRLSet* CRLSet::ExpiredCRLSetForTesting() { | 587 CRLSet* CRLSet::ExpiredCRLSetForTesting() { |
588 CRLSet* crl_set = new CRLSet; | 588 CRLSet* crl_set = new CRLSet; |
589 crl_set->not_after_ = 1; | 589 crl_set->not_after_ = 1; |
590 return crl_set; | 590 return crl_set; |
591 } | 591 } |
592 | 592 |
593 } // namespace net | 593 } // namespace net |
OLD | NEW |