Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | |
| 6 | |
| 5 #include "net/cert/ct_known_logs.h" | 7 #include "net/cert/ct_known_logs.h" |
| 6 | 8 |
| 7 #include "base/memory/scoped_ptr.h" | |
| 8 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 9 #include "net/cert/ct_log_verifier.h" | 10 #include "net/cert/ct_log_verifier.h" |
| 10 | 11 |
| 11 namespace net { | 12 namespace net { |
| 12 | 13 |
| 13 namespace ct { | 14 namespace ct { |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 // Oldest log - the "pilot" log. | 18 struct CTLogInfo { |
| 18 const char kGooglePilotLogKey[] = | 19 const char* log_key; |
|
agl
2014/06/13 00:32:05
The keys are expected to be the same length, right
Eran Messeri
2014/06/17 17:31:41
For now, for our logs, yes. May change if (hopeful
| |
| 19 "\x30\x59\x30\x13\x06\x07\x2a\x86\x48\xce\x3d\x02\x01\x06\x08\x2a\x86\x48" | 20 uint8 log_key_length; |
| 20 "\xce\x3d\x03\x01\x07\x03\x42\x00\x04\x7d\xa8\x4b\x12\x29\x80\xa3\x3d\xad" | 21 std::string log_name; |
|
agl
2014/06/13 00:32:05
This looks like a static initialiser, so should pr
Eran Messeri
2014/06/17 17:31:41
Done.
| |
| 21 "\xd3\x5a\x77\xb8\xcc\xe2\x88\xb3\xa5\xfd\xf1\xd3\x0c\xcd\x18\x0c\xe8\x41" | 22 }; |
| 22 "\x46\xe8\x81\x01\x1b\x15\xe1\x4b\xf1\x1b\x62\xdd\x36\x0a\x08\x18\xba\xed" | |
| 23 "\x0b\x35\x84\xd0\x9e\x40\x3c\x2d\x9e\x9b\x82\x65\xbd\x1f\x04\x10\x41\x4c" | |
| 24 "\xa0"; | |
| 25 | 23 |
| 26 const size_t kGooglePilotLogKeyLength = arraysize(kGooglePilotLogKey) - 1; | 24 #include "net/cert/ct_known_logs_static.h" |
| 27 | |
| 28 const char kGooglePilotLogName[] = "Google US1 CT"; | |
| 29 | |
| 30 // Newer log - the "aviator" log. | |
| 31 const char kGoogleAviatorLogKey[] = | |
| 32 "\x30\x59\x30\x13\x06\x07\x2a\x86\x48\xce\x3d\x02\x01\x06\x08\x2a\x86\x48" | |
| 33 "\xce\x3d\x03\x01\x07\x03\x42\x00\x04\xd7\xf4\xcc\x69\xb2\xe4\x0e\x90\xa3" | |
| 34 "\x8a\xea\x5a\x70\x09\x4f\xef\x13\x62\xd0\x8d\x49\x60\xff\x1b\x40\x50\x07" | |
| 35 "\x0c\x6d\x71\x86\xda\x25\x49\x8d\x65\xe1\x08\x0d\x47\x34\x6b\xbd\x27\xbc" | |
| 36 "\x96\x21\x3e\x34\xf5\x87\x76\x31\xb1\x7f\x1d\xc9\x85\x3b\x0d\xf7\x1f\x3f" | |
| 37 "\xe9"; | |
| 38 | |
| 39 const size_t kGoogleAviatorLogKeyLength = arraysize(kGoogleAviatorLogKey) - 1; | |
| 40 | |
| 41 const char kGoogleAviatorLogName[] = "Google US2 CT"; | |
| 42 | |
| 43 // Latest log, not turned up yet, nicknamed "rocketeer" | |
| 44 const char kGoogleRocketeerLogKey[] = | |
| 45 "\x30\x59\x30\x13\x06\x07\x2a\x86\x48\xce\x3d\x02\x01\x06\x08\x2a\x86\x48" | |
| 46 "\xce\x3d\x03\x01\x07\x03\x42\x00\x04\xf3\x58\x9d\x31\x6e\x2f\xc8\x98\x46" | |
| 47 "\x2b\x92\x08\x1f\x46\x98\x80\x55\xa9\x0d\x02\xe1\x39\xba\x9a\x90\xcf\x8b" | |
| 48 "\xe0\x8a\x7e\x06\x72\xd6\x53\x48\xb3\x4a\xc3\x4d\x2f\x52\xa6\x21\xfc\xcc" | |
| 49 "\x33\xcb\x92\x2b\x57\x95\x76\xf2\x07\xcd\x37\x56\x83\xbb\xfa\xea\xb6\xc4" | |
| 50 "\xd8"; | |
| 51 | |
| 52 const size_t kGoogleRocketeerLogKeyLength = | |
| 53 arraysize(kGoogleRocketeerLogKey) - 1; | |
| 54 | |
| 55 const char kGoogleRocketeerLogName[] = "Google EU CT"; | |
| 56 | 25 |
| 57 } // namespace | 26 } // namespace |
| 58 | 27 |
| 59 scoped_ptr<CTLogVerifier> CreateGooglePilotLogVerifier() { | 28 std::vector<linked_ptr<CTLogVerifier> > CreateLogVerifiersForKnownLogs() { |
| 60 base::StringPiece key(kGooglePilotLogKey, kGooglePilotLogKeyLength); | 29 std::vector<linked_ptr<CTLogVerifier> > verifiers; |
| 30 for (int i = 0; i < kNumKnownCTLogs; ++i) { | |
| 31 const CTLogInfo& log(kCTLogList[i]); | |
| 32 base::StringPiece key(log.log_key, log.log_key_length); | |
| 61 | 33 |
| 62 return CTLogVerifier::Create(key, kGooglePilotLogName); | 34 verifiers.push_back(linked_ptr<CTLogVerifier>( |
| 63 } | 35 CTLogVerifier::Create(key, log.log_name).release())); |
| 36 } | |
| 64 | 37 |
| 65 scoped_ptr<CTLogVerifier> CreateGoogleAviatorLogVerifier() { | 38 return verifiers; |
| 66 base::StringPiece key(kGoogleAviatorLogKey, kGoogleAviatorLogKeyLength); | |
| 67 | |
| 68 return CTLogVerifier::Create(key, kGoogleAviatorLogName); | |
| 69 } | |
| 70 | |
| 71 scoped_ptr<CTLogVerifier> CreateGoogleRocketeerLogVerifier() { | |
| 72 base::StringPiece key(kGoogleRocketeerLogKey, kGoogleRocketeerLogKeyLength); | |
| 73 | |
| 74 return CTLogVerifier::Create(key, kGoogleRocketeerLogName); | |
| 75 } | 39 } |
| 76 | 40 |
| 77 } // namespace ct | 41 } // namespace ct |
| 78 | 42 |
| 79 } // namespace net | 43 } // namespace net |
| 80 | 44 |
| OLD | NEW |