xref: /aosp_15_r20/external/cronet/net/cert/test_root_certs_android.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2011 The Chromium Authors
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/cert/test_root_certs.h"
6 
7 #include "base/location.h"
8 #include "net/android/network_library.h"
9 #include "net/cert/x509_certificate.h"
10 #include "third_party/boringssl/src/include/openssl/pool.h"
11 
12 namespace net {
13 
AddImpl(X509Certificate * certificate)14 bool TestRootCerts::AddImpl(X509Certificate* certificate) {
15   android::AddTestRootCertificate(
16       CRYPTO_BUFFER_data(certificate->cert_buffer()),
17       CRYPTO_BUFFER_len(certificate->cert_buffer()));
18   return true;
19 }
20 
ClearImpl()21 void TestRootCerts::ClearImpl() {
22   if (IsEmpty())
23     return;
24 
25   android::ClearTestRootCertificates();
26 }
27 
28 TestRootCerts::~TestRootCerts() = default;
29 
Init()30 void TestRootCerts::Init() {}
31 
32 }  // namespace net
33