mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-12 09:37:37 +01:00
7c5cb76692
- cefclient: Improve error message text and use a data: URI instead of LoadString for loading error messages (issue #579). - Add functions in cef_url.h for base64 and URI encoding/decoding (issue #579). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@2028 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
71 lines
2.2 KiB
C++
71 lines
2.2 KiB
C++
// Copyright (c) 2015 The Chromium Embedded Framework 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 "libcef/browser/ssl_info_impl.h"
|
|
#include "libcef/browser/ssl_cert_principal_impl.h"
|
|
#include "libcef/common/time_util.h"
|
|
|
|
#include "net/cert/x509_certificate.h"
|
|
|
|
CefSSLInfoImpl::CefSSLInfoImpl(const net::SSLInfo& value) {
|
|
if (value.cert.get()) {
|
|
subject_ = new CefSSLCertPrincipalImpl(value.cert->subject());
|
|
issuer_ = new CefSSLCertPrincipalImpl(value.cert->issuer());
|
|
|
|
const std::string& serial_number = value.cert->serial_number();
|
|
serial_number_ = CefBinaryValue::Create(serial_number.c_str(),
|
|
serial_number.size());
|
|
|
|
const base::Time& valid_start = value.cert->valid_start();
|
|
if (!valid_start.is_null())
|
|
cef_time_from_basetime(valid_start, valid_start_);
|
|
|
|
const base::Time& valid_expiry = value.cert->valid_expiry();
|
|
if (!valid_expiry.is_null())
|
|
cef_time_from_basetime(valid_expiry, valid_expiry_);
|
|
|
|
net::X509Certificate::OSCertHandle os_handle = value.cert->os_cert_handle();
|
|
if (os_handle) {
|
|
std::string encoded;
|
|
if (value.cert->GetDEREncoded(os_handle, &encoded)) {
|
|
der_encoded_ = CefBinaryValue::Create(encoded.c_str(),
|
|
encoded.size());
|
|
}
|
|
encoded.clear();
|
|
if (value.cert->GetPEMEncoded(os_handle, &encoded)) {
|
|
pem_encoded_ = CefBinaryValue::Create(encoded.c_str(),
|
|
encoded.size());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoImpl::GetSubject() {
|
|
return subject_;
|
|
}
|
|
|
|
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoImpl::GetIssuer() {
|
|
return issuer_;
|
|
}
|
|
|
|
CefRefPtr<CefBinaryValue> CefSSLInfoImpl::GetSerialNumber() {
|
|
return serial_number_;
|
|
}
|
|
|
|
CefTime CefSSLInfoImpl::GetValidStart() {
|
|
return valid_start_;
|
|
}
|
|
|
|
CefTime CefSSLInfoImpl::GetValidExpiry() {
|
|
return valid_expiry_;
|
|
}
|
|
|
|
CefRefPtr<CefBinaryValue> CefSSLInfoImpl::GetDEREncoded() {
|
|
return der_encoded_;
|
|
}
|
|
|
|
CefRefPtr<CefBinaryValue> CefSSLInfoImpl::GetPEMEncoded() {
|
|
return pem_encoded_;
|
|
}
|