OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/base/test_root_certs.h" | |
6 | |
7 #include "base/location.h" | |
8 #include "base/logging.h" | |
9 #include "net/android/network_library.h" | |
10 #include "net/base/x509_certificate.h" | |
11 | |
12 namespace net { | |
13 | |
14 bool TestRootCerts::Add(X509Certificate* certificate) { | |
15 std::string cert_bytes; | |
16 if (!X509Certificate::GetDEREncoded(certificate->os_cert_handle(), | |
17 &cert_bytes)) | |
18 return false; | |
19 android::AddTestRootCertificate( | |
20 reinterpret_cast<const uint8*>(cert_bytes.data()), cert_bytes.size()); | |
21 return true; | |
22 } | |
23 | |
24 void TestRootCerts::Clear() { | |
25 if (empty_) | |
26 return; | |
27 | |
28 android::ClearTestRootCertificates(); | |
29 empty_ = true; | |
30 } | |
31 | |
32 bool TestRootCerts::IsEmpty() const { | |
33 return empty_; | |
34 } | |
35 | |
36 TestRootCerts::~TestRootCerts() {} | |
37 | |
38 void TestRootCerts::Init() { | |
39 empty_ = true; | |
40 } | |
41 | |
42 } // namespace net | |
OLD | NEW |