summaryrefslogtreecommitdiff
path: root/chromium/net/cert/test_root_certs_android.cc
blob: c1812db05b02bf80fff3a92908f5ed64f9506294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/cert/test_root_certs.h"

#include "base/location.h"
#include "net/android/network_library.h"
#include "net/cert/x509_certificate.h"
#include "third_party/boringssl/src/include/openssl/pool.h"

namespace net {

bool TestRootCerts::Add(X509Certificate* certificate) {
  android::AddTestRootCertificate(
      CRYPTO_BUFFER_data(certificate->cert_buffer()),
      CRYPTO_BUFFER_len(certificate->cert_buffer()));
  empty_ = false;
  return true;
}

void TestRootCerts::Clear() {
  if (empty_)
    return;

  android::ClearTestRootCertificates();
  empty_ = true;
}

bool TestRootCerts::IsEmpty() const {
  return empty_;
}

TestRootCerts::~TestRootCerts() {}

void TestRootCerts::Init() {
  empty_ = true;
}

}  // namespace net