Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/net/crl_set_fetcher.h" | 5 #include "chrome/browser/net/crl_set_fetcher.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 LOG(WARNING) << "Refusing to downgrade CRL set from #" | 115 LOG(WARNING) << "Refusing to downgrade CRL set from #" |
| 116 << old_crl_set->sequence() | 116 << old_crl_set->sequence() |
| 117 << "to #" | 117 << "to #" |
| 118 << crl_set->sequence(); | 118 << crl_set->sequence(); |
| 119 } else { | 119 } else { |
| 120 net::SSLConfigService::SetCRLSet(crl_set); | 120 net::SSLConfigService::SetCRLSet(crl_set); |
| 121 VLOG(1) << "Installed CRL set #" << crl_set->sequence(); | 121 VLOG(1) << "Installed CRL set #" << crl_set->sequence(); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 // TODO(agl): this is a key for testing only. Replace with a real key. | |
| 126 static const uint8 kPublicKeySHA256[32] = { | 125 static const uint8 kPublicKeySHA256[32] = { |
|
wtc
2011/10/21 23:17:31
Nit: document whose public key this is.
agl
2011/10/24 20:44:27
Done.
| |
| 127 0x0f, 0x0e, 0xa7, 0x94, 0x37, 0x6b, 0x60, 0x9a, | 126 0x75, 0xda, 0xf8, 0xcb, 0x77, 0x68, 0x40, 0x33, |
| 128 0x90, 0x09, 0x3e, 0xbb, 0xce, 0xe8, 0xd7, 0x4b, | 127 0x65, 0x4c, 0x97, 0xe5, 0xc5, 0x1b, 0xcd, 0x81, |
| 129 0xc2, 0x78, 0x17, 0x43, 0x63, 0xd5, 0xb4, 0x43, | 128 0x7b, 0x1e, 0xeb, 0x11, 0x2c, 0xe1, 0xa4, 0x33, |
| 130 0xc1, 0x49, 0xc6, 0x44, 0x40, 0x43, 0xae, 0x2a, | 129 0x8c, 0xf5, 0x72, 0x5e, 0xed, 0xb8, 0x43, 0x97, |
| 131 }; | 130 }; |
| 132 | 131 |
| 133 void CRLSetFetcher::RegisterComponent(uint32 sequence_of_loaded_crl) { | 132 void CRLSetFetcher::RegisterComponent(uint32 sequence_of_loaded_crl) { |
| 134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 133 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 135 | 134 |
| 136 CrxComponent component; | 135 CrxComponent component; |
| 137 component.pk_hash.assign(&kPublicKeySHA256[0], | 136 component.pk_hash.assign(&kPublicKeySHA256[0], |
|
wtc
2011/10/21 23:17:31
Nit: you can just say kPublicKeySHA256,
agl
2011/10/24 20:44:27
Done.
| |
| 138 &kPublicKeySHA256[0] + sizeof(kPublicKeySHA256)); | 137 &kPublicKeySHA256[0] + sizeof(kPublicKeySHA256)); |
| 139 component.installer = this; | 138 component.installer = this; |
| 140 component.name = "CRLSet"; | 139 component.name = "CRLSet"; |
| 141 component.version = Version(base::UintToString(sequence_of_loaded_crl)); | 140 component.version = Version(base::UintToString(sequence_of_loaded_crl)); |
| 142 if (!component.version.IsValid()) { | 141 if (!component.version.IsValid()) { |
| 143 NOTREACHED(); | 142 NOTREACHED(); |
| 144 component.version = Version("0"); | 143 component.version = Version("0"); |
| 145 } | 144 } |
| 146 | 145 |
| 147 if (cus_->RegisterComponent(component) != | 146 if (cus_->RegisterComponent(component) != |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 159 const FilePath& unpack_path) { | 158 const FilePath& unpack_path) { |
| 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 161 | 160 |
| 162 FilePath crl_set_file_path = unpack_path.Append(FILE_PATH_LITERAL("crl-set")); | 161 FilePath crl_set_file_path = unpack_path.Append(FILE_PATH_LITERAL("crl-set")); |
| 163 FilePath save_to; | 162 FilePath save_to; |
| 164 if (!GetCRLSetFilePath(&save_to)) | 163 if (!GetCRLSetFilePath(&save_to)) |
| 165 return true; | 164 return true; |
| 166 LoadFromDisk(crl_set_file_path, save_to, NULL); | 165 LoadFromDisk(crl_set_file_path, save_to, NULL); |
| 167 return true; | 166 return true; |
| 168 } | 167 } |
| OLD | NEW |