2016-09-02 12:01:33 +02:00
|
|
|
// Copyright (c) 2016 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.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "include/cef_x509_certificate.h"
|
|
|
|
|
2017-07-27 01:19:27 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "net/ssl/client_cert_identity.h"
|
2016-09-02 12:01:33 +02:00
|
|
|
|
|
|
|
// CefX509Certificate implementation
|
|
|
|
class CefX509CertificateImpl : public CefX509Certificate {
|
|
|
|
public:
|
2016-10-27 19:57:12 +02:00
|
|
|
explicit CefX509CertificateImpl(scoped_refptr<net::X509Certificate> cert);
|
2016-09-02 12:01:33 +02:00
|
|
|
|
2017-07-27 01:19:27 +02:00
|
|
|
// Used with CefContentBrowserClient::SelectClientCertificate only.
|
|
|
|
explicit CefX509CertificateImpl(
|
|
|
|
std::unique_ptr<net::ClientCertIdentity> identity);
|
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
// CefX509Certificate methods.
|
|
|
|
CefRefPtr<CefX509CertPrincipal> GetSubject() override;
|
|
|
|
CefRefPtr<CefX509CertPrincipal> GetIssuer() override;
|
|
|
|
CefRefPtr<CefBinaryValue> GetSerialNumber() override;
|
|
|
|
CefTime GetValidStart() override;
|
|
|
|
CefTime GetValidExpiry() override;
|
|
|
|
CefRefPtr<CefBinaryValue> GetDEREncoded() override;
|
|
|
|
CefRefPtr<CefBinaryValue> GetPEMEncoded() override;
|
|
|
|
size_t GetIssuerChainSize() override;
|
|
|
|
void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) override;
|
|
|
|
void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) override;
|
|
|
|
|
2016-10-27 19:57:12 +02:00
|
|
|
scoped_refptr<net::X509Certificate> GetInternalCertObject() { return cert_; }
|
2017-07-27 01:19:27 +02:00
|
|
|
void AcquirePrivateKey(
|
2020-03-04 01:29:39 +01:00
|
|
|
base::OnceCallback<void(scoped_refptr<net::SSLPrivateKey>)>
|
2017-07-27 01:19:27 +02:00
|
|
|
private_key_callback);
|
2016-10-27 19:57:12 +02:00
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
private:
|
2016-10-27 19:57:12 +02:00
|
|
|
void GetEncodedIssuerChain(IssuerChainBinaryList& chain, bool der);
|
|
|
|
|
2017-07-27 01:19:27 +02:00
|
|
|
std::unique_ptr<net::ClientCertIdentity> identity_;
|
2016-10-27 19:57:12 +02:00
|
|
|
scoped_refptr<net::X509Certificate> cert_;
|
2016-09-02 12:01:33 +02:00
|
|
|
IssuerChainBinaryList pem_encoded_issuer_chain_;
|
2016-10-27 19:57:12 +02:00
|
|
|
IssuerChainBinaryList der_encoded_issuer_chain_;
|
2016-09-02 12:01:33 +02:00
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefX509CertificateImpl);
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefX509CertificateImpl);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_
|