2016-09-02 12:01:33 +02:00
|
|
|
// Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
|
2015-02-11 19:15:04 +01:00
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
#include "libcef/browser/x509_cert_principal_impl.h"
|
2015-02-11 19:15:04 +01:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
void TransferVector(const std::vector<std::string>& source,
|
|
|
|
std::vector<CefString>& target) {
|
|
|
|
if (!target.empty())
|
|
|
|
target.clear();
|
|
|
|
|
|
|
|
if (!source.empty()) {
|
|
|
|
std::vector<std::string>::const_iterator it = source.begin();
|
|
|
|
for (; it != source.end(); ++it)
|
|
|
|
target.push_back(*it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefX509CertPrincipalImpl::CefX509CertPrincipalImpl(
|
2015-02-11 19:15:04 +01:00
|
|
|
const net::CertPrincipal& value)
|
2017-05-17 11:29:28 +02:00
|
|
|
: value_(value) {}
|
2015-02-11 19:15:04 +01:00
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetDisplayName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.GetDisplayName();
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetCommonName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.common_name;
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetLocalityName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.locality_name;
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetStateOrProvinceName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.state_or_province_name;
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
CefString CefX509CertPrincipalImpl::GetCountryName() {
|
2015-02-11 19:15:04 +01:00
|
|
|
return value_.country_name;
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
void CefX509CertPrincipalImpl::GetStreetAddresses(
|
2015-02-11 19:15:04 +01:00
|
|
|
std::vector<CefString>& addresses) {
|
|
|
|
TransferVector(value_.street_addresses, addresses);
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
void CefX509CertPrincipalImpl::GetOrganizationNames(
|
2015-02-11 19:15:04 +01:00
|
|
|
std::vector<CefString>& names) {
|
|
|
|
TransferVector(value_.organization_names, names);
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
void CefX509CertPrincipalImpl::GetOrganizationUnitNames(
|
2015-02-11 19:15:04 +01:00
|
|
|
std::vector<CefString>& names) {
|
|
|
|
TransferVector(value_.organization_unit_names, names);
|
|
|
|
}
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
void CefX509CertPrincipalImpl::GetDomainComponents(
|
2015-02-11 19:15:04 +01:00
|
|
|
std::vector<CefString>& components) {
|
|
|
|
TransferVector(value_.domain_components, components);
|
|
|
|
}
|