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
|
|
|
|
|
2017-07-27 01:19:27 +02:00
|
|
|
#include <memory>
|
|
|
|
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/include/cef_x509_certificate.h"
|
2024-07-29 19:09:20 +02:00
|
|
|
#include "net/cert/x509_certificate.h"
|
2024-10-23 18:57:53 +02:00
|
|
|
#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
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefX509CertificateImpl(const CefX509CertificateImpl&) = delete;
|
|
|
|
CefX509CertificateImpl& operator=(const CefX509CertificateImpl&) = delete;
|
|
|
|
|
2024-10-23 18:57:53 +02:00
|
|
|
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;
|
2022-05-31 22:28:43 +02:00
|
|
|
CefBaseTime GetValidStart() override;
|
|
|
|
CefBaseTime GetValidExpiry() override;
|
2016-09-02 12:01:33 +02:00
|
|
|
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_; }
|
2024-10-23 18:57:53 +02:00
|
|
|
void AcquirePrivateKey(
|
|
|
|
base::OnceCallback<void(scoped_refptr<net::SSLPrivateKey>)>
|
|
|
|
private_key_callback);
|
|
|
|
|
|
|
|
[[nodiscard]] std::unique_ptr<net::ClientCertIdentity> DisconnectIdentity();
|
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);
|
|
|
|
|
2024-10-23 18:57:53 +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);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_
|