Move rtc_certificate and rtc_certificate_generator to webrtc namespace
Bug: webrtc:42232595
Change-Id: I52997896efd5435a1457f47990660a4792de1bd2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/380901
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44115}
diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h
index 2633683..65e9b18 100644
--- a/api/peer_connection_interface.h
+++ b/api/peer_connection_interface.h
@@ -433,7 +433,7 @@
IceTransportsType type = kAll;
BundlePolicy bundle_policy = kBundlePolicyBalanced;
RtcpMuxPolicy rtcp_mux_policy = kRtcpMuxPolicyRequire;
- std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates;
+ std::vector<rtc::scoped_refptr<RTCCertificate>> certificates;
int ice_candidate_pool_size = 0;
//////////////////////////////////////////////////////////////////////////
@@ -1402,7 +1402,7 @@
std::unique_ptr<webrtc::AsyncDnsResolverFactoryInterface>
async_dns_resolver_factory;
std::unique_ptr<webrtc::IceTransportFactory> ice_transport_factory;
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator;
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator;
std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier;
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory;
diff --git a/api/test/pclf/media_quality_test_params.h b/api/test/pclf/media_quality_test_params.h
index 429b33f..9a53913 100644
--- a/api/test/pclf/media_quality_test_params.h
+++ b/api/test/pclf/media_quality_test_params.h
@@ -85,7 +85,7 @@
struct PeerConnectionComponents {
std::unique_ptr<webrtc::AsyncDnsResolverFactoryInterface>
async_dns_resolver_factory;
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator;
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator;
std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier;
std::unique_ptr<IceTransportFactory> ice_transport_factory;
};
diff --git a/api/test/pclf/peer_configurer.cc b/api/test/pclf/peer_configurer.cc
index 38b4994..a08e007 100644
--- a/api/test/pclf/peer_configurer.cc
+++ b/api/test/pclf/peer_configurer.cc
@@ -109,7 +109,7 @@
return this;
}
PeerConfigurer* PeerConfigurer::SetRTCCertificateGenerator(
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator) {
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator) {
components_->pc_dependencies->cert_generator = std::move(cert_generator);
return this;
}
diff --git a/api/test/pclf/peer_configurer.h b/api/test/pclf/peer_configurer.h
index 38ce8c3..0448054 100644
--- a/api/test/pclf/peer_configurer.h
+++ b/api/test/pclf/peer_configurer.h
@@ -93,7 +93,7 @@
std::unique_ptr<webrtc::AsyncDnsResolverFactoryInterface>
async_dns_resolver_factory);
PeerConfigurer* SetRTCCertificateGenerator(
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator);
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator);
PeerConfigurer* SetSSLCertificateVerifier(
std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier);
PeerConfigurer* SetIceTransportFactory(
diff --git a/p2p/base/transport_description_factory.h b/p2p/base/transport_description_factory.h
index bd0cb90..5d97ca6 100644
--- a/p2p/base/transport_description_factory.h
+++ b/p2p/base/transport_description_factory.h
@@ -44,12 +44,12 @@
~TransportDescriptionFactory();
// The certificate to use when setting up DTLS.
- const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() const {
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& certificate() const {
return certificate_;
}
// Specifies the certificate to use
- void set_certificate(rtc::scoped_refptr<rtc::RTCCertificate> certificate) {
+ void set_certificate(rtc::scoped_refptr<webrtc::RTCCertificate> certificate) {
certificate_ = std::move(certificate);
}
@@ -85,7 +85,7 @@
bool SetSecurityInfo(TransportDescription* description,
ConnectionRole role) const;
bool insecure_ = false;
- rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate_;
const webrtc::FieldTrialsView& field_trials_;
};
diff --git a/p2p/base/transport_description_factory_unittest.cc b/p2p/base/transport_description_factory_unittest.cc
index 0d38ac6..ad994eb 100644
--- a/p2p/base/transport_description_factory_unittest.cc
+++ b/p2p/base/transport_description_factory_unittest.cc
@@ -41,9 +41,9 @@
: ice_credentials_({}),
f1_(field_trials_),
f2_(field_trials_),
- cert1_(rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
+ cert1_(webrtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
new rtc::FakeSSLIdentity("User1")))),
- cert2_(rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
+ cert2_(webrtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
new rtc::FakeSSLIdentity("User2")))) {
// By default, certificates are supplied.
f1_.set_certificate(cert1_);
@@ -179,8 +179,8 @@
TransportDescriptionFactory f1_;
TransportDescriptionFactory f2_;
- rtc::scoped_refptr<rtc::RTCCertificate> cert1_;
- rtc::scoped_refptr<rtc::RTCCertificate> cert2_;
+ rtc::scoped_refptr<webrtc::RTCCertificate> cert1_;
+ rtc::scoped_refptr<webrtc::RTCCertificate> cert2_;
};
TEST_F(TransportDescriptionFactoryTest, TestOfferDtls) {
diff --git a/p2p/dtls/dtls_ice_integrationtest.cc b/p2p/dtls/dtls_ice_integrationtest.cc
index 658ab18..0e7018a 100644
--- a/p2p/dtls/dtls_ice_integrationtest.cc
+++ b/p2p/dtls/dtls_ice_integrationtest.cc
@@ -49,7 +49,7 @@
void SetRemoteFingerprintFromCert(
cricket::DtlsTransport& transport,
- const rtc::scoped_refptr<rtc::RTCCertificate>& cert) {
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& cert) {
std::unique_ptr<rtc::SSLFingerprint> fingerprint =
rtc::SSLFingerprint::CreateFromCertificate(*cert);
@@ -135,8 +135,8 @@
void SetupEndpoint(
Endpoint& ep,
bool client,
- const rtc::scoped_refptr<rtc::RTCCertificate> client_certificate,
- const rtc::scoped_refptr<rtc::RTCCertificate> server_certificate) {
+ const rtc::scoped_refptr<webrtc::RTCCertificate> client_certificate,
+ const rtc::scoped_refptr<webrtc::RTCCertificate> server_certificate) {
thread(ep)->BlockingCall([&]() {
if (network_emulation_manager_ == nullptr) {
ep.allocator = std::make_unique<BasicPortAllocator>(
@@ -197,9 +197,9 @@
}
void Prepare() {
- auto client_certificate = rtc::RTCCertificate::Create(
+ auto client_certificate = webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("test", rtc::KT_DEFAULT));
- auto server_certificate = rtc::RTCCertificate::Create(
+ auto server_certificate = webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("test", rtc::KT_DEFAULT));
if (network_emulation_manager_ == nullptr) {
diff --git a/p2p/dtls/dtls_transport.cc b/p2p/dtls/dtls_transport.cc
index 6c86e3f..ef6fce0 100644
--- a/p2p/dtls/dtls_transport.cc
+++ b/p2p/dtls/dtls_transport.cc
@@ -202,7 +202,7 @@
}
bool DtlsTransport::SetLocalCertificate(
- const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) {
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& certificate) {
if (dtls_active_) {
if (certificate == local_certificate_) {
// This may happen during renegotiation.
@@ -226,7 +226,7 @@
return true;
}
-rtc::scoped_refptr<rtc::RTCCertificate> DtlsTransport::GetLocalCertificate()
+rtc::scoped_refptr<webrtc::RTCCertificate> DtlsTransport::GetLocalCertificate()
const {
return local_certificate_;
}
diff --git a/p2p/dtls/dtls_transport.h b/p2p/dtls/dtls_transport.h
index f7a0313..f24d90c 100644
--- a/p2p/dtls/dtls_transport.h
+++ b/p2p/dtls/dtls_transport.h
@@ -149,8 +149,9 @@
// "active" or not (acting as a passthrough if not active), just require this
// certificate on construction or "Start".
bool SetLocalCertificate(
- const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override;
- rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override;
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& certificate) override;
+ rtc::scoped_refptr<webrtc::RTCCertificate> GetLocalCertificate()
+ const override;
// SetRemoteFingerprint must be called after SetLocalCertificate, and any
// other methods like SetDtlsRole. It's what triggers the actual DTLS setup.
@@ -269,7 +270,7 @@
downward_; // Wrapper for ice_transport_, owned by dtls_.
const std::vector<int> srtp_ciphers_; // SRTP ciphers to use with DTLS.
bool dtls_active_ = false;
- rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_;
+ rtc::scoped_refptr<webrtc::RTCCertificate> local_certificate_;
std::optional<webrtc::SSLRole> dtls_role_;
const webrtc::SSLProtocolVersion ssl_max_version_;
rtc::Buffer remote_fingerprint_value_;
diff --git a/p2p/dtls/dtls_transport_internal.h b/p2p/dtls/dtls_transport_internal.h
index 134687d..0c74600 100644
--- a/p2p/dtls/dtls_transport_internal.h
+++ b/p2p/dtls/dtls_transport_internal.h
@@ -80,11 +80,11 @@
virtual uint16_t GetSslPeerSignatureAlgorithm() const = 0;
// Gets the local RTCCertificate used for DTLS.
- virtual rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate()
+ virtual rtc::scoped_refptr<webrtc::RTCCertificate> GetLocalCertificate()
const = 0;
virtual bool SetLocalCertificate(
- const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) = 0;
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& certificate) = 0;
// Gets a copy of the remote side's SSL certificate chain.
virtual std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain() const = 0;
diff --git a/p2p/dtls/dtls_transport_unittest.cc b/p2p/dtls/dtls_transport_unittest.cc
index 201b7ec..8d111b9 100644
--- a/p2p/dtls/dtls_transport_unittest.cc
+++ b/p2p/dtls/dtls_transport_unittest.cc
@@ -78,7 +78,7 @@
// validation.
void SetRemoteFingerprintFromCert(
DtlsTransport* transport,
- const rtc::scoped_refptr<rtc::RTCCertificate>& cert,
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& cert,
bool modify_digest = false) {
std::unique_ptr<rtc::SSLFingerprint> fingerprint =
rtc::SSLFingerprint::CreateFromCertificate(*cert);
@@ -100,10 +100,10 @@
public:
explicit DtlsTestClient(absl::string_view name) : name_(name) {}
void CreateCertificate(rtc::KeyType key_type) {
- certificate_ =
- rtc::RTCCertificate::Create(rtc::SSLIdentity::Create(name_, key_type));
+ certificate_ = webrtc::RTCCertificate::Create(
+ rtc::SSLIdentity::Create(name_, key_type));
}
- const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() {
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& certificate() {
return certificate_;
}
void SetupMaxProtocolVersion(webrtc::SSLProtocolVersion version) {
@@ -360,7 +360,7 @@
private:
std::string name_;
- rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate_;
std::unique_ptr<FakeIceTransport> fake_ice_transport_;
std::unique_ptr<DtlsTransport> dtls_transport_;
size_t packet_size_ = 0u;
diff --git a/p2p/dtls/fake_dtls_transport.h b/p2p/dtls/fake_dtls_transport.h
index 46a4784..70b95d0 100644
--- a/p2p/dtls/fake_dtls_transport.h
+++ b/p2p/dtls/fake_dtls_transport.h
@@ -193,7 +193,7 @@
return true;
}
bool SetLocalCertificate(
- const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override {
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& certificate) override {
do_dtls_ = true;
local_cert_ = certificate;
return true;
@@ -233,7 +233,8 @@
return "FakeTlsCipherSuite";
}
uint16_t GetSslPeerSignatureAlgorithm() const override { return 0; }
- rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override {
+ rtc::scoped_refptr<webrtc::RTCCertificate> GetLocalCertificate()
+ const override {
return local_cert_;
}
std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain() const override {
@@ -318,7 +319,7 @@
std::string transport_name_;
int component_;
FakeDtlsTransport* dest_ = nullptr;
- rtc::scoped_refptr<rtc::RTCCertificate> local_cert_;
+ rtc::scoped_refptr<webrtc::RTCCertificate> local_cert_;
rtc::FakeSSLCertificate* remote_cert_ = nullptr;
bool do_dtls_ = false;
webrtc::SSLProtocolVersion ssl_max_version_ = webrtc::SSL_PROTOCOL_DTLS_12;
diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc
index a523e93..0399aa3 100644
--- a/pc/channel_unittest.cc
+++ b/pc/channel_unittest.cc
@@ -237,7 +237,7 @@
network_thread_));
}
if (flags1 & DTLS) {
- auto cert1 = rtc::RTCCertificate::Create(
+ auto cert1 = webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("session1", rtc::KT_DEFAULT));
fake_rtp_dtls_transport1_->SetLocalCertificate(cert1);
if (fake_rtcp_dtls_transport1_) {
@@ -263,7 +263,7 @@
network_thread_));
}
if (flags2 & DTLS) {
- auto cert2 = rtc::RTCCertificate::Create(
+ auto cert2 = webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("session2", rtc::KT_DEFAULT));
fake_rtp_dtls_transport2_->SetLocalCertificate(cert2);
if (fake_rtcp_dtls_transport2_) {
diff --git a/pc/dtls_srtp_transport_integrationtest.cc b/pc/dtls_srtp_transport_integrationtest.cc
index f032ad4..16108c8 100644
--- a/pc/dtls_srtp_transport_integrationtest.cc
+++ b/pc/dtls_srtp_transport_integrationtest.cc
@@ -78,8 +78,8 @@
srtp_transport_.UnregisterRtpDemuxerSink(&srtp_transport_observer_);
}
- rtc::scoped_refptr<rtc::RTCCertificate> MakeCertificate() {
- return rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> MakeCertificate() {
+ return webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("test", rtc::KT_DEFAULT));
}
std::unique_ptr<cricket::FakeIceTransport> MakeIceTransport(
@@ -100,7 +100,7 @@
}
void SetRemoteFingerprintFromCert(
cricket::DtlsTransport* transport,
- const rtc::scoped_refptr<rtc::RTCCertificate>& cert) {
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& cert) {
std::unique_ptr<rtc::SSLFingerprint> fingerprint =
rtc::SSLFingerprint::CreateFromCertificate(*cert);
@@ -227,8 +227,8 @@
std::unique_ptr<cricket::DtlsTransport> client_dtls_transport_;
std::unique_ptr<cricket::DtlsTransport> server_dtls_transport_;
- rtc::scoped_refptr<rtc::RTCCertificate> client_certificate_;
- rtc::scoped_refptr<rtc::RTCCertificate> server_certificate_;
+ rtc::scoped_refptr<webrtc::RTCCertificate> client_certificate_;
+ rtc::scoped_refptr<webrtc::RTCCertificate> server_certificate_;
webrtc::DtlsSrtpTransport dtls_srtp_transport_;
webrtc::SrtpTransport srtp_transport_;
diff --git a/pc/dtls_srtp_transport_unittest.cc b/pc/dtls_srtp_transport_unittest.cc
index f5477e6..679ddfe 100644
--- a/pc/dtls_srtp_transport_unittest.cc
+++ b/pc/dtls_srtp_transport_unittest.cc
@@ -109,10 +109,10 @@
void CompleteDtlsHandshake(FakeDtlsTransport* fake_dtls1,
FakeDtlsTransport* fake_dtls2) {
- auto cert1 = rtc::RTCCertificate::Create(
+ auto cert1 = webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("session1", rtc::KT_DEFAULT));
fake_dtls1->SetLocalCertificate(cert1);
- auto cert2 = rtc::RTCCertificate::Create(
+ auto cert2 = webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("session1", rtc::KT_DEFAULT));
fake_dtls2->SetLocalCertificate(cert2);
fake_dtls1->SetDestination(fake_dtls2);
diff --git a/pc/dtls_transport_unittest.cc b/pc/dtls_transport_unittest.cc
index 8a97011..0eb5a20 100644
--- a/pc/dtls_transport_unittest.cc
+++ b/pc/dtls_transport_unittest.cc
@@ -80,10 +80,10 @@
auto fake_dtls1 = static_cast<FakeDtlsTransport*>(transport_->internal());
auto fake_dtls2 = std::make_unique<FakeDtlsTransport>(
"audio", cricket::ICE_CANDIDATE_COMPONENT_RTP);
- auto cert1 = rtc::RTCCertificate::Create(
+ auto cert1 = RTCCertificate::Create(
rtc::SSLIdentity::Create("session1", rtc::KT_DEFAULT));
fake_dtls1->SetLocalCertificate(cert1);
- auto cert2 = rtc::RTCCertificate::Create(
+ auto cert2 = RTCCertificate::Create(
rtc::SSLIdentity::Create("session1", rtc::KT_DEFAULT));
fake_dtls2->SetLocalCertificate(cert2);
fake_dtls1->SetDestination(fake_dtls2.get());
diff --git a/pc/jsep_transport.cc b/pc/jsep_transport.cc
index f80f099..a3f329c 100644
--- a/pc/jsep_transport.cc
+++ b/pc/jsep_transport.cc
@@ -68,7 +68,7 @@
JsepTransport::JsepTransport(
const std::string& mid,
- const rtc::scoped_refptr<rtc::RTCCertificate>& local_certificate,
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& local_certificate,
rtc::scoped_refptr<webrtc::IceTransportInterface> ice_transport,
rtc::scoped_refptr<webrtc::IceTransportInterface> rtcp_ice_transport,
std::unique_ptr<webrtc::RtpTransport> unencrypted_rtp_transport,
@@ -335,7 +335,7 @@
}
webrtc::RTCError JsepTransport::VerifyCertificateFingerprint(
- const rtc::RTCCertificate* certificate,
+ const webrtc::RTCCertificate* certificate,
const rtc::SSLFingerprint* fingerprint) const {
TRACE_EVENT0("webrtc", "JsepTransport::VerifyCertificateFingerprint");
RTC_DCHECK_RUN_ON(network_thread_);
diff --git a/pc/jsep_transport.h b/pc/jsep_transport.h
index a7d64ff..a52c4b1 100644
--- a/pc/jsep_transport.h
+++ b/pc/jsep_transport.h
@@ -83,7 +83,7 @@
// description may be set before a local certificate is generated.
JsepTransport(
const std::string& mid,
- const rtc::scoped_refptr<rtc::RTCCertificate>& local_certificate,
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& local_certificate,
rtc::scoped_refptr<webrtc::IceTransportInterface> ice_transport,
rtc::scoped_refptr<webrtc::IceTransportInterface> rtcp_ice_transport,
std::unique_ptr<webrtc::RtpTransport> unencrypted_rtp_transport,
@@ -106,13 +106,13 @@
// Must be called before applying local session description.
// Needed in order to verify the local fingerprint.
void SetLocalCertificate(
- const rtc::scoped_refptr<rtc::RTCCertificate>& local_certificate) {
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& local_certificate) {
RTC_DCHECK_RUN_ON(network_thread_);
local_certificate_ = local_certificate;
}
// Return the local certificate provided by SetLocalCertificate.
- rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const {
+ rtc::scoped_refptr<webrtc::RTCCertificate> GetLocalCertificate() const {
RTC_DCHECK_RUN_ON(network_thread_);
return local_certificate_;
}
@@ -224,7 +224,7 @@
// Returns an error if the certificate's identity does not match the
// fingerprint, or either is NULL.
webrtc::RTCError VerifyCertificateFingerprint(
- const rtc::RTCCertificate* certificate,
+ const webrtc::RTCCertificate* certificate,
const rtc::SSLFingerprint* fingerprint) const;
void SetActiveResetSrtpParams(bool active_reset_srtp_params);
@@ -291,7 +291,7 @@
const std::string mid_;
// needs-ice-restart bit as described in JSEP.
bool needs_ice_restart_ RTC_GUARDED_BY(network_thread_) = false;
- rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_
+ rtc::scoped_refptr<webrtc::RTCCertificate> local_certificate_
RTC_GUARDED_BY(network_thread_);
std::unique_ptr<JsepTransportDescription> local_description_
RTC_GUARDED_BY(network_thread_);
diff --git a/pc/jsep_transport_controller.cc b/pc/jsep_transport_controller.cc
index fb8d9a1..39e8784 100644
--- a/pc/jsep_transport_controller.cc
+++ b/pc/jsep_transport_controller.cc
@@ -309,7 +309,7 @@
}
bool JsepTransportController::SetLocalCertificate(
- const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) {
+ const rtc::scoped_refptr<RTCCertificate>& certificate) {
if (!network_thread_->IsCurrent()) {
return network_thread_->BlockingCall(
[&] { return SetLocalCertificate(certificate); });
@@ -336,8 +336,7 @@
return true;
}
-rtc::scoped_refptr<rtc::RTCCertificate>
-JsepTransportController::GetLocalCertificate(
+rtc::scoped_refptr<RTCCertificate> JsepTransportController::GetLocalCertificate(
const std::string& transport_name) const {
RTC_DCHECK_RUN_ON(network_thread_);
diff --git a/pc/jsep_transport_controller.h b/pc/jsep_transport_controller.h
index 723d1a7..9713c8d 100644
--- a/pc/jsep_transport_controller.h
+++ b/pc/jsep_transport_controller.h
@@ -227,8 +227,8 @@
// Specifies the identity to use in this session.
// Can only be called once.
bool SetLocalCertificate(
- const rtc::scoped_refptr<rtc::RTCCertificate>& certificate);
- rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate(
+ const rtc::scoped_refptr<RTCCertificate>& certificate);
+ rtc::scoped_refptr<RTCCertificate> GetLocalCertificate(
const std::string& mid) const;
// Caller owns returned certificate chain. This method mainly exists for
// stats reporting.
@@ -517,7 +517,7 @@
cricket::IceConfig ice_config_;
cricket::IceRole ice_role_ = cricket::ICEROLE_CONTROLLING;
- rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
+ rtc::scoped_refptr<RTCCertificate> certificate_;
BundleManager bundles_;
// Reference to the SdpOfferAnswerHandler's payload type picker.
diff --git a/pc/jsep_transport_controller_unittest.cc b/pc/jsep_transport_controller_unittest.cc
index 24fcf4a..045c6e8 100644
--- a/pc/jsep_transport_controller_unittest.cc
+++ b/pc/jsep_transport_controller_unittest.cc
@@ -206,7 +206,7 @@
const std::string& pwd,
cricket::IceMode ice_mode,
cricket::ConnectionRole conn_role,
- rtc::scoped_refptr<rtc::RTCCertificate> cert) {
+ rtc::scoped_refptr<RTCCertificate> cert) {
std::unique_ptr<cricket::AudioContentDescription> audio(
new cricket::AudioContentDescription());
// Set RTCP-mux to be true because the default policy is "mux required".
@@ -222,7 +222,7 @@
const std::string& pwd,
cricket::IceMode ice_mode,
cricket::ConnectionRole conn_role,
- rtc::scoped_refptr<rtc::RTCCertificate> cert) {
+ rtc::scoped_refptr<RTCCertificate> cert) {
std::unique_ptr<cricket::VideoContentDescription> video(
new cricket::VideoContentDescription());
// Set RTCP-mux to be true because the default policy is "mux required".
@@ -239,7 +239,7 @@
const std::string& pwd,
cricket::IceMode ice_mode,
cricket::ConnectionRole conn_role,
- rtc::scoped_refptr<rtc::RTCCertificate> cert) {
+ rtc::scoped_refptr<RTCCertificate> cert) {
RTC_CHECK(protocol_type == cricket::MediaProtocolType::kSctp);
std::unique_ptr<cricket::SctpDataContentDescription> data(
new cricket::SctpDataContentDescription());
@@ -255,7 +255,7 @@
const std::string& pwd,
cricket::IceMode ice_mode,
cricket::ConnectionRole conn_role,
- rtc::scoped_refptr<rtc::RTCCertificate> cert) {
+ rtc::scoped_refptr<RTCCertificate> cert) {
std::unique_ptr<rtc::SSLFingerprint> fingerprint;
if (cert) {
fingerprint = rtc::SSLFingerprint::CreateFromCertificate(*cert);
@@ -597,10 +597,9 @@
TEST_F(JsepTransportControllerTest, SetAndGetLocalCertificate) {
CreateJsepTransportController(JsepTransportController::Config());
- rtc::scoped_refptr<rtc::RTCCertificate> certificate1 =
- rtc::RTCCertificate::Create(
- rtc::SSLIdentity::Create("session1", rtc::KT_DEFAULT));
- rtc::scoped_refptr<rtc::RTCCertificate> returned_certificate;
+ rtc::scoped_refptr<RTCCertificate> certificate1 = RTCCertificate::Create(
+ rtc::SSLIdentity::Create("session1", rtc::KT_DEFAULT));
+ rtc::scoped_refptr<RTCCertificate> returned_certificate;
auto description = std::make_unique<cricket::SessionDescription>();
AddAudioSection(description.get(), kAudioMid1, kIceUfrag1, kIcePwd1,
@@ -623,9 +622,8 @@
EXPECT_EQ(nullptr, transport_controller_->GetLocalCertificate(kVideoMid1));
// Shouldn't be able to change the identity once set.
- rtc::scoped_refptr<rtc::RTCCertificate> certificate2 =
- rtc::RTCCertificate::Create(
- rtc::SSLIdentity::Create("session2", rtc::KT_DEFAULT));
+ rtc::scoped_refptr<RTCCertificate> certificate2 = RTCCertificate::Create(
+ rtc::SSLIdentity::Create("session2", rtc::KT_DEFAULT));
EXPECT_FALSE(transport_controller_->SetLocalCertificate(certificate2));
}
@@ -654,9 +652,9 @@
TEST_F(JsepTransportControllerTest, GetDtlsRole) {
CreateJsepTransportController(JsepTransportController::Config());
- auto offer_certificate = rtc::RTCCertificate::Create(
+ auto offer_certificate = RTCCertificate::Create(
rtc::SSLIdentity::Create("offer", rtc::KT_DEFAULT));
- auto answer_certificate = rtc::RTCCertificate::Create(
+ auto answer_certificate = RTCCertificate::Create(
rtc::SSLIdentity::Create("answer", rtc::KT_DEFAULT));
transport_controller_->SetLocalCertificate(offer_certificate);
diff --git a/pc/jsep_transport_unittest.cc b/pc/jsep_transport_unittest.cc
index 1a930b6..18966b6 100644
--- a/pc/jsep_transport_unittest.cc
+++ b/pc/jsep_transport_unittest.cc
@@ -164,7 +164,7 @@
bool rtcp_mux_enabled,
const char* ufrag,
const char* pwd,
- const rtc::scoped_refptr<rtc::RTCCertificate>& cert,
+ const rtc::scoped_refptr<webrtc::RTCCertificate>& cert,
ConnectionRole role = CONNECTIONROLE_NONE) {
JsepTransportDescription jsep_description;
jsep_description.rtcp_mux_enabled = rtcp_mux_enabled;
@@ -258,11 +258,11 @@
jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled);
// Create certificates.
- rtc::scoped_refptr<rtc::RTCCertificate> local_cert =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> local_cert =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("local", rtc::KT_DEFAULT));
- rtc::scoped_refptr<rtc::RTCCertificate> remote_cert =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> remote_cert =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("remote", rtc::KT_DEFAULT));
jsep_transport_->SetLocalCertificate(local_cert);
@@ -310,11 +310,11 @@
jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled);
// Create certificates.
- rtc::scoped_refptr<rtc::RTCCertificate> local_cert =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> local_cert =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("local", rtc::KT_DEFAULT));
- rtc::scoped_refptr<rtc::RTCCertificate> remote_cert =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> remote_cert =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("remote", rtc::KT_DEFAULT));
jsep_transport_->SetLocalCertificate(local_cert);
@@ -427,8 +427,8 @@
rtc::KeyType key_types[] = {rtc::KT_RSA, rtc::KT_ECDSA};
for (auto& key_type : key_types) {
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing", key_type));
ASSERT_NE(nullptr, certificate);
@@ -467,8 +467,8 @@
bool rtcp_mux_enabled = GetParam();
// Just use the same certificate for both sides; doesn't really matter in a
// non end-to-end test.
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing", rtc::KT_ECDSA));
JsepTransportDescription local_description = MakeJsepTransportDescription(
@@ -574,8 +574,8 @@
bool rtcp_mux_enabled = GetParam();
// Just use the same certificate for both sides; doesn't really matter in a
// non end-to-end test.
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing", rtc::KT_ECDSA));
JsepTransportDescription local_description = MakeJsepTransportDescription(
@@ -702,8 +702,8 @@
TEST_F(JsepTransport2Test, ValidDtlsReofferFromAnswerer) {
// Just use the same certificate for both sides; doesn't really matter in a
// non end-to-end test.
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing", rtc::KT_ECDSA));
bool rtcp_mux_enabled = true;
jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled);
@@ -749,8 +749,8 @@
TEST_F(JsepTransport2Test, InvalidDtlsReofferFromAnswerer) {
// Just use the same certificate for both sides; doesn't really matter in a
// non end-to-end test.
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing", rtc::KT_ECDSA));
bool rtcp_mux_enabled = true;
jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled);
@@ -795,8 +795,8 @@
// This is allowed by dtls-sdp, though we'll never generate such an offer,
// since JSEP requires generating "actpass".
TEST_F(JsepTransport2Test, RemoteOfferWithCurrentNegotiatedDtlsRole) {
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing", rtc::KT_ECDSA));
bool rtcp_mux_enabled = true;
jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled);
@@ -840,8 +840,8 @@
// Test that a remote offer with the inverse of the current negotiated DTLS
// role is rejected.
TEST_F(JsepTransport2Test, RemoteOfferThatChangesNegotiatedDtlsRole) {
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing", rtc::KT_ECDSA));
bool rtcp_mux_enabled = true;
jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled);
@@ -884,11 +884,11 @@
// Test that a remote offer which changes both fingerprint and role is accepted.
TEST_F(JsepTransport2Test, RemoteOfferThatChangesFingerprintAndDtlsRole) {
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing1", rtc::KT_ECDSA));
- rtc::scoped_refptr<rtc::RTCCertificate> certificate2 =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate2 =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing2", rtc::KT_ECDSA));
bool rtcp_mux_enabled = true;
jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled);
@@ -940,8 +940,8 @@
// Testing that a legacy client that doesn't use the setup attribute will be
// interpreted as having an active role.
TEST_F(JsepTransport2Test, DtlsSetupWithLegacyAsAnswerer) {
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::Create(
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("testing", rtc::KT_ECDSA));
bool rtcp_mux_enabled = true;
jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled);
@@ -1072,10 +1072,10 @@
OnReadPacket2(transport, packet);
});
- auto cert1 = rtc::RTCCertificate::Create(
+ auto cert1 = webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("session1", rtc::KT_DEFAULT));
jsep_transport1_->rtp_dtls_transport()->SetLocalCertificate(cert1);
- auto cert2 = rtc::RTCCertificate::Create(
+ auto cert2 = webrtc::RTCCertificate::Create(
rtc::SSLIdentity::Create("session1", rtc::KT_DEFAULT));
jsep_transport2_->rtp_dtls_transport()->SetLocalCertificate(cert2);
}
diff --git a/pc/legacy_stats_collector.cc b/pc/legacy_stats_collector.cc
index d0eb5df..43a0821 100644
--- a/pc/legacy_stats_collector.cc
+++ b/pc/legacy_stats_collector.cc
@@ -939,7 +939,7 @@
// same local and remote certificates.
//
StatsReport::Id local_cert_report_id, remote_cert_report_id;
- rtc::scoped_refptr<rtc::RTCCertificate> certificate;
+ rtc::scoped_refptr<RTCCertificate> certificate;
if (pc_->GetLocalCertificate(transport.name, &certificate)) {
transport.local_cert_stats =
certificate->GetSSLCertificateChain().GetStats();
diff --git a/pc/legacy_stats_collector_unittest.cc b/pc/legacy_stats_collector_unittest.cc
index ee402e3..bd427dc 100644
--- a/pc/legacy_stats_collector_unittest.cc
+++ b/pc/legacy_stats_collector_unittest.cc
@@ -673,8 +673,8 @@
pc->SetTransportStats(kTransportName, channel_stats);
// Fake certificate to report.
- rtc::scoped_refptr<rtc::RTCCertificate> local_certificate(
- rtc::RTCCertificate::Create(local_identity.Clone()));
+ rtc::scoped_refptr<RTCCertificate> local_certificate(
+ RTCCertificate::Create(local_identity.Clone()));
pc->SetLocalCertificate(kTransportName, local_certificate);
pc->SetRemoteCertChain(kTransportName,
remote_identity.cert_chain().Clone());
diff --git a/pc/media_session_unittest.cc b/pc/media_session_unittest.cc
index fa5b94b..be8df4a 100644
--- a/pc/media_session_unittest.cc
+++ b/pc/media_session_unittest.cc
@@ -542,9 +542,9 @@
MAKE_VECTOR(kAudioCodecs2), MAKE_VECTOR(kAudioCodecs2));
codec_lookup_helper_2_.CodecVendor("")->set_video_codecs(
MAKE_VECTOR(kVideoCodecs2), MAKE_VECTOR(kVideoCodecs2));
- tdf1_.set_certificate(rtc::RTCCertificate::Create(
+ tdf1_.set_certificate(webrtc::RTCCertificate::Create(
std::unique_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("id1"))));
- tdf2_.set_certificate(rtc::RTCCertificate::Create(
+ tdf2_.set_certificate(webrtc::RTCCertificate::Create(
std::unique_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("id2"))));
}
@@ -4679,9 +4679,9 @@
MAKE_VECTOR(kAudioCodecs2), MAKE_VECTOR(kAudioCodecs2));
codec_lookup_helper_2_.CodecVendor("")->set_video_codecs(
MAKE_VECTOR(kVideoCodecs2), MAKE_VECTOR(kVideoCodecs2));
- tdf1_.set_certificate(rtc::RTCCertificate::Create(
+ tdf1_.set_certificate(webrtc::RTCCertificate::Create(
std::unique_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("id1"))));
- tdf2_.set_certificate(rtc::RTCCertificate::Create(
+ tdf2_.set_certificate(webrtc::RTCCertificate::Create(
std::unique_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("id2"))));
}
@@ -4746,7 +4746,7 @@
void TestAudioCodecsOffer(RtpTransceiverDirection direction) {
webrtc::test::ScopedKeyValueConfig field_trials;
TransportDescriptionFactory tdf(field_trials);
- tdf.set_certificate(rtc::RTCCertificate::Create(
+ tdf.set_certificate(webrtc::RTCCertificate::Create(
std::unique_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("id"))));
rtc::UniqueRandomIdGenerator ssrc_generator;
@@ -4852,10 +4852,10 @@
webrtc::test::ScopedKeyValueConfig field_trials;
TransportDescriptionFactory offer_tdf(field_trials);
TransportDescriptionFactory answer_tdf(field_trials);
- offer_tdf.set_certificate(rtc::RTCCertificate::Create(
+ offer_tdf.set_certificate(webrtc::RTCCertificate::Create(
std::unique_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("offer_id"))));
answer_tdf.set_certificate(
- rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
+ webrtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
new rtc::FakeSSLIdentity("answer_id"))));
rtc::UniqueRandomIdGenerator ssrc_generator1, ssrc_generator2;
CodecLookupHelperForTesting offer_codec_lookup_helper(field_trials);
@@ -5021,10 +5021,10 @@
codec_lookup_helper_offerer_(field_trials_),
codec_lookup_helper_answerer_(field_trials_) {
tdf_offerer_.set_certificate(
- rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
+ webrtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
new rtc::FakeSSLIdentity("offer_id"))));
tdf_answerer_.set_certificate(
- rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
+ webrtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
new rtc::FakeSSLIdentity("answer_id"))));
}
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index beac30a..90648e2 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -401,7 +401,7 @@
IceTransportsType type;
BundlePolicy bundle_policy;
RtcpMuxPolicy rtcp_mux_policy;
- std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates;
+ std::vector<rtc::scoped_refptr<RTCCertificate>> certificates;
int ice_candidate_pool_size;
bool disable_ipv6_on_wifi;
int max_ipv6_networks;
@@ -2342,7 +2342,7 @@
bool PeerConnection::GetLocalCertificate(
const std::string& transport_name,
- rtc::scoped_refptr<rtc::RTCCertificate>* certificate) {
+ rtc::scoped_refptr<RTCCertificate>* certificate) {
RTC_DCHECK_RUN_ON(network_thread());
if (!network_thread_safety_->alive() || !certificate) {
return false;
diff --git a/pc/peer_connection.h b/pc/peer_connection.h
index 152e9c0..0667f77 100644
--- a/pc/peer_connection.h
+++ b/pc/peer_connection.h
@@ -305,7 +305,7 @@
bool GetLocalCertificate(
const std::string& transport_name,
- rtc::scoped_refptr<rtc::RTCCertificate>* certificate) override;
+ rtc::scoped_refptr<RTCCertificate>* certificate) override;
std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain(
const std::string& transport_name) override;
bool IceRestartPending(const std::string& content_name) const override;
diff --git a/pc/peer_connection_crypto_unittest.cc b/pc/peer_connection_crypto_unittest.cc
index 830c582..4eda3f5 100644
--- a/pc/peer_connection_crypto_unittest.cc
+++ b/pc/peer_connection_crypto_unittest.cc
@@ -106,7 +106,7 @@
WrapperPtr CreatePeerConnection(
const RTCConfiguration& config,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_gen) {
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_gen) {
auto fake_port_allocator = std::make_unique<cricket::FakePortAllocator>(
rtc::Thread::Current(),
std::make_unique<rtc::BasicPacketSocketFactory>(vss_.get()),
@@ -487,8 +487,8 @@
// error.
// This is a regression test for crbug.com/800775
TEST_P(PeerConnectionCryptoTest, SessionErrorIfFingerprintInvalid) {
- auto callee_certificate = rtc::RTCCertificate::FromPEM(kRsaPems[0]);
- auto other_certificate = rtc::RTCCertificate::FromPEM(kRsaPems[1]);
+ auto callee_certificate = RTCCertificate::FromPEM(kRsaPems[0]);
+ auto other_certificate = RTCCertificate::FromPEM(kRsaPems[1]);
auto caller = CreatePeerConnectionWithAudioVideo();
RTCConfiguration callee_config;
diff --git a/pc/peer_connection_factory.cc b/pc/peer_connection_factory.cc
index bc07ab3..849323c 100644
--- a/pc/peer_connection_factory.cc
+++ b/pc/peer_connection_factory.cc
@@ -278,9 +278,8 @@
// Set internal defaults if optional dependencies are not set.
if (!dependencies.cert_generator) {
- dependencies.cert_generator =
- std::make_unique<rtc::RTCCertificateGenerator>(signaling_thread(),
- network_thread());
+ dependencies.cert_generator = std::make_unique<RTCCertificateGenerator>(
+ signaling_thread(), network_thread());
}
if (!dependencies.async_dns_resolver_factory) {
diff --git a/pc/peer_connection_interface_unittest.cc b/pc/peer_connection_interface_unittest.cc
index 1f1a8fc..7fa6cb4 100644
--- a/pc/peer_connection_interface_unittest.cc
+++ b/pc/peer_connection_interface_unittest.cc
@@ -721,7 +721,7 @@
// Create certificate generator unless DTLS constraint is explicitly set to
// false.
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator;
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator;
// These won't be used if encryption is turned off, but that's harmless.
fake_certificate_generator_ = new FakeRTCCertificateGenerator();
diff --git a/pc/peer_connection_internal.h b/pc/peer_connection_internal.h
index 0b772d1..95c4268 100644
--- a/pc/peer_connection_internal.h
+++ b/pc/peer_connection_internal.h
@@ -189,7 +189,7 @@
virtual bool GetLocalCertificate(
const std::string& transport_name,
- rtc::scoped_refptr<rtc::RTCCertificate>* certificate) = 0;
+ rtc::scoped_refptr<RTCCertificate>* certificate) = 0;
virtual std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain(
const std::string& transport_name) = 0;
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index a59654f..dc196ff 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -2045,7 +2045,7 @@
const std::string& transport_name = entry.first;
CertificateStatsPair certificate_stats_pair;
- rtc::scoped_refptr<rtc::RTCCertificate> local_certificate;
+ rtc::scoped_refptr<RTCCertificate> local_certificate;
if (pc_->GetLocalCertificate(transport_name, &local_certificate)) {
certificate_stats_pair.local =
local_certificate->GetSSLCertificateChain().GetStats();
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index b212efe..c0d20e3 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -115,7 +115,7 @@
constexpr uint64_t kRemoteOutboundStatsReportsCount = 9u;
struct CertificateInfo {
- rtc::scoped_refptr<rtc::RTCCertificate> certificate;
+ rtc::scoped_refptr<RTCCertificate> certificate;
std::vector<std::string> ders;
std::vector<std::string> pems;
std::vector<std::string> fingerprints;
@@ -148,7 +148,7 @@
der.length()));
}
info->certificate =
- rtc::RTCCertificate::Create(std::unique_ptr<rtc::FakeSSLIdentity>(
+ RTCCertificate::Create(std::unique_ptr<rtc::FakeSSLIdentity>(
new rtc::FakeSSLIdentity(info->pems)));
// Strip header/footer and newline characters of PEM strings.
for (size_t i = 0; i < info->pems.size(); ++i) {
diff --git a/pc/sdp_offer_answer.cc b/pc/sdp_offer_answer.cc
index 6b43be0..cb896c9 100644
--- a/pc/sdp_offer_answer.cc
+++ b/pc/sdp_offer_answer.cc
@@ -1425,7 +1425,7 @@
std::unique_ptr<SdpOfferAnswerHandler> SdpOfferAnswerHandler::Create(
PeerConnectionSdpMethods* pc,
const PeerConnectionInterface::RTCConfiguration& configuration,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator,
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory,
ConnectionContext* context,
@@ -1439,7 +1439,7 @@
void SdpOfferAnswerHandler::Initialize(
const PeerConnectionInterface::RTCConfiguration& configuration,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator,
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory,
ConnectionContext* context,
@@ -1460,7 +1460,7 @@
configuration.audio_jitter_buffer_min_delay_ms;
// Obtain a certificate from RTCConfiguration if any were provided (optional).
- rtc::scoped_refptr<rtc::RTCCertificate> certificate;
+ rtc::scoped_refptr<RTCCertificate> certificate;
if (!configuration.certificates.empty()) {
// TODO(hbos,torbjorng): Decide on certificate-selection strategy instead of
// just picking the first one. The decision should be made based on the DTLS
diff --git a/pc/sdp_offer_answer.h b/pc/sdp_offer_answer.h
index 28bcb83..fb78974 100644
--- a/pc/sdp_offer_answer.h
+++ b/pc/sdp_offer_answer.h
@@ -82,7 +82,7 @@
static std::unique_ptr<SdpOfferAnswerHandler> Create(
PeerConnectionSdpMethods* pc,
const PeerConnectionInterface::RTCConfiguration& configuration,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator,
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory,
ConnectionContext* context,
@@ -216,7 +216,7 @@
// once. Modifies dependencies.
void Initialize(
const PeerConnectionInterface::RTCConfiguration& configuration,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator,
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory,
ConnectionContext* context,
diff --git a/pc/test/fake_peer_connection_base.h b/pc/test/fake_peer_connection_base.h
index 9e2538d..2022b04 100644
--- a/pc/test/fake_peer_connection_base.h
+++ b/pc/test/fake_peer_connection_base.h
@@ -322,7 +322,7 @@
bool GetLocalCertificate(
const std::string& transport_name,
- rtc::scoped_refptr<rtc::RTCCertificate>* certificate) override {
+ rtc::scoped_refptr<RTCCertificate>* certificate) override {
return false;
}
diff --git a/pc/test/fake_peer_connection_for_stats.h b/pc/test/fake_peer_connection_for_stats.h
index dc277b5..d8a7333 100644
--- a/pc/test/fake_peer_connection_for_stats.h
+++ b/pc/test/fake_peer_connection_for_stats.h
@@ -423,9 +423,8 @@
audio_device_stats_ = audio_device_stats;
}
- void SetLocalCertificate(
- const std::string& transport_name,
- rtc::scoped_refptr<rtc::RTCCertificate> certificate) {
+ void SetLocalCertificate(const std::string& transport_name,
+ rtc::scoped_refptr<RTCCertificate> certificate) {
local_certificates_by_transport_[transport_name] = certificate;
}
@@ -511,7 +510,7 @@
bool GetLocalCertificate(
const std::string& transport_name,
- rtc::scoped_refptr<rtc::RTCCertificate>* certificate) override {
+ rtc::scoped_refptr<RTCCertificate>* certificate) override {
auto it = local_certificates_by_transport_.find(transport_name);
if (it != local_certificates_by_transport_.end()) {
*certificate = it->second;
@@ -592,7 +591,7 @@
std::optional<AudioDeviceModule::Stats> audio_device_stats_;
- std::map<std::string, rtc::scoped_refptr<rtc::RTCCertificate>>
+ std::map<std::string, rtc::scoped_refptr<RTCCertificate>>
local_certificates_by_transport_;
std::map<std::string, std::unique_ptr<rtc::SSLCertChain>>
remote_cert_chains_by_transport_;
diff --git a/pc/test/fake_rtc_certificate_generator.h b/pc/test/fake_rtc_certificate_generator.h
index 7efa2ce..1df658e 100644
--- a/pc/test/fake_rtc_certificate_generator.h
+++ b/pc/test/fake_rtc_certificate_generator.h
@@ -25,8 +25,8 @@
#include "rtc_base/ssl_identity.h"
// RSA with mod size 1024, pub exp 0x10001.
-static const rtc::RTCCertificatePEM kRsaPems[] = {
- rtc::RTCCertificatePEM(
+static const webrtc::RTCCertificatePEM kRsaPems[] = {
+ webrtc::RTCCertificatePEM(
"-----BEGIN RSA PRI" // Linebreak to avoid detection of private
"VATE KEY-----\n" // keys by linters.
"MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMYRkbhmI7kVA/rM\n"
@@ -55,7 +55,7 @@
"LJE/mGw3MyFHEqi81jh95J+ypl6xKW6Rm8jKLR87gUvCaVYn/Z4/P3AqcQTB7wOv\n"
"UD0A8qfhfDM+LK6rPAnCsVN0NRDY3jvd6rzix9M=\n"
"-----END CERTIFICATE-----\n"),
- rtc::RTCCertificatePEM(
+ webrtc::RTCCertificatePEM(
"-----BEGIN RSA PRI" // Linebreak to avoid detection of private
"VATE KEY-----\n" // keys by linters.
"MIICXQIBAAKBgQDeYqlyJ1wuiMsi905e3X81/WA/G3ym50PIDZBVtSwZi7JVQPgj\n"
@@ -93,8 +93,8 @@
// `SSLIdentity::Create` and invoking `identity->PrivateKeyToPEMString()`,
// `identity->PublicKeyToPEMString()` and
// `identity->certificate().ToPEMString()`.
-static const rtc::RTCCertificatePEM kEcdsaPems[] = {
- rtc::RTCCertificatePEM(
+static const webrtc::RTCCertificatePEM kEcdsaPems[] = {
+ webrtc::RTCCertificatePEM(
"-----BEGIN PRI" // Linebreak to avoid detection of private
"VATE KEY-----\n" // keys by linters.
"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg+qaRsR5uHtqG689M\n"
@@ -109,7 +109,7 @@
"vK0wCgYIKoZIzj0EAwIDSQAwRgIhAIIc3+CqfkZ9lLwTj1PvUtt3KhnqF2kD0War\n"
"cCoTBbCxAiEAyp9Cn4vo2ZBhRIVDKyoxmwak8Z0PAVhJAQaWCgoY2D4=\n"
"-----END CERTIFICATE-----\n"),
- rtc::RTCCertificatePEM(
+ webrtc::RTCCertificatePEM(
"-----BEGIN PRI" // Linebreak to avoid detection of private
"VATE KEY-----\n" // keys by linters.
"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQghL/G4JRYnuDNbQuh\n"
@@ -126,7 +126,7 @@
"-----END CERTIFICATE-----\n")};
class FakeRTCCertificateGenerator
- : public rtc::RTCCertificateGeneratorInterface {
+ : public webrtc::RTCCertificateGeneratorInterface {
public:
FakeRTCCertificateGenerator() : should_fail_(false), should_wait_(false) {}
@@ -164,12 +164,12 @@
});
}
- static rtc::scoped_refptr<rtc::RTCCertificate> GenerateCertificate() {
+ static rtc::scoped_refptr<webrtc::RTCCertificate> GenerateCertificate() {
switch (rtc::KT_DEFAULT) {
case rtc::KT_RSA:
- return rtc::RTCCertificate::FromPEM(kRsaPems[0]);
+ return webrtc::RTCCertificate::FromPEM(kRsaPems[0]);
case rtc::KT_ECDSA:
- return rtc::RTCCertificate::FromPEM(kEcdsaPems[0]);
+ return webrtc::RTCCertificate::FromPEM(kEcdsaPems[0]);
default:
RTC_DCHECK_NOTREACHED();
return nullptr;
@@ -177,7 +177,7 @@
}
private:
- const rtc::RTCCertificatePEM& get_pem(const rtc::KeyType& key_type) const {
+ const webrtc::RTCCertificatePEM& get_pem(const rtc::KeyType& key_type) const {
switch (key_type) {
case rtc::KT_RSA:
return kRsaPems[key_index_];
@@ -211,8 +211,8 @@
++generated_failures_;
std::move(callback)(nullptr);
} else {
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::FromPEM(get_pem(key_type));
+ rtc::scoped_refptr<webrtc::RTCCertificate> certificate =
+ webrtc::RTCCertificate::FromPEM(get_pem(key_type));
RTC_DCHECK(certificate);
++generated_certificates_;
std::move(callback)(std::move(certificate));
diff --git a/pc/test/peer_connection_test_wrapper.cc b/pc/test/peer_connection_test_wrapper.cc
index 1a481b0..64a038d 100644
--- a/pc/test/peer_connection_test_wrapper.cc
+++ b/pc/test/peer_connection_test_wrapper.cc
@@ -200,7 +200,7 @@
return false;
}
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator(
+ std::unique_ptr<webrtc::RTCCertificateGeneratorInterface> cert_generator(
new FakeRTCCertificateGenerator());
webrtc::PeerConnectionDependencies deps(this);
deps.allocator = std::move(port_allocator);
diff --git a/pc/webrtc_session_description_factory.cc b/pc/webrtc_session_description_factory.cc
index 75f48b27..5914a75 100644
--- a/pc/webrtc_session_description_factory.cc
+++ b/pc/webrtc_session_description_factory.cc
@@ -115,9 +115,9 @@
const SdpStateProvider* sdp_info,
const std::string& session_id,
bool dtls_enabled,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
- rtc::scoped_refptr<rtc::RTCCertificate> certificate,
- std::function<void(const rtc::scoped_refptr<rtc::RTCCertificate>&)>
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator,
+ rtc::scoped_refptr<RTCCertificate> certificate,
+ std::function<void(const rtc::scoped_refptr<webrtc::RTCCertificate>&)>
on_certificate_ready,
cricket::CodecLookupHelper* codec_lookup_helper,
const FieldTrialsView& field_trials)
@@ -443,7 +443,7 @@
}
void WebRtcSessionDescriptionFactory::SetCertificate(
- rtc::scoped_refptr<rtc::RTCCertificate> certificate) {
+ rtc::scoped_refptr<RTCCertificate> certificate) {
RTC_DCHECK(certificate);
RTC_LOG(LS_VERBOSE) << "Setting new certificate.";
diff --git a/pc/webrtc_session_description_factory.h b/pc/webrtc_session_description_factory.h
index 935a008..a9bd828 100644
--- a/pc/webrtc_session_description_factory.h
+++ b/pc/webrtc_session_description_factory.h
@@ -51,9 +51,9 @@
const SdpStateProvider* sdp_info,
const std::string& session_id,
bool dtls_enabled,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
- rtc::scoped_refptr<rtc::RTCCertificate> certificate,
- std::function<void(const rtc::scoped_refptr<rtc::RTCCertificate>&)>
+ std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator,
+ rtc::scoped_refptr<RTCCertificate> certificate,
+ std::function<void(const rtc::scoped_refptr<webrtc::RTCCertificate>&)>
on_certificate_ready,
cricket::CodecLookupHelper* codec_lookup_helper,
const FieldTrialsView& field_trials);
@@ -131,7 +131,7 @@
void Post(absl::AnyInvocable<void() &&> callback);
void OnCertificateRequestFailed();
- void SetCertificate(rtc::scoped_refptr<rtc::RTCCertificate> certificate);
+ void SetCertificate(rtc::scoped_refptr<RTCCertificate> certificate);
std::queue<CreateSessionDescriptionRequest>
create_session_description_requests_;
@@ -139,13 +139,13 @@
cricket::TransportDescriptionFactory transport_desc_factory_;
cricket::MediaSessionDescriptionFactory session_desc_factory_;
uint64_t session_version_;
- const std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator_;
+ const std::unique_ptr<RTCCertificateGeneratorInterface> cert_generator_;
const SdpStateProvider* sdp_info_;
const std::string session_id_;
CertificateRequestState certificate_request_state_;
std::queue<absl::AnyInvocable<void() &&>> callbacks_;
- std::function<void(const rtc::scoped_refptr<rtc::RTCCertificate>&)>
+ std::function<void(const rtc::scoped_refptr<webrtc::RTCCertificate>&)>
on_certificate_ready_;
WeakPtrFactory<WebRtcSessionDescriptionFactory> weak_factory_{this};
diff --git a/rtc_base/rtc_certificate.cc b/rtc_base/rtc_certificate.cc
index 93e5f15..278bee6 100644
--- a/rtc_base/rtc_certificate.cc
+++ b/rtc_base/rtc_certificate.cc
@@ -17,16 +17,16 @@
#include "rtc_base/ssl_identity.h"
#include "rtc_base/time_utils.h"
-namespace rtc {
+namespace webrtc {
scoped_refptr<RTCCertificate> RTCCertificate::Create(
- std::unique_ptr<SSLIdentity> identity) {
+ std::unique_ptr<rtc::SSLIdentity> identity) {
// Explicit new to access protected constructor.
- return rtc::scoped_refptr<RTCCertificate>(
- new RTCCertificate(identity.release()));
+ return scoped_refptr<RTCCertificate>(new RTCCertificate(identity.release()));
}
-RTCCertificate::RTCCertificate(SSLIdentity* identity) : identity_(identity) {
+RTCCertificate::RTCCertificate(rtc::SSLIdentity* identity)
+ : identity_(identity) {
RTC_DCHECK(identity_);
}
@@ -35,7 +35,7 @@
uint64_t RTCCertificate::Expires() const {
int64_t expires = GetSSLCertificate().CertificateExpirationTime();
if (expires != -1)
- return static_cast<uint64_t>(expires) * kNumMillisecsPerSec;
+ return static_cast<uint64_t>(expires) * rtc::kNumMillisecsPerSec;
// If the expiration time could not be retrieved return an expired timestamp.
return 0; // = 1970-01-01
}
@@ -44,11 +44,11 @@
return Expires() <= now;
}
-const SSLCertificate& RTCCertificate::GetSSLCertificate() const {
+const rtc::SSLCertificate& RTCCertificate::GetSSLCertificate() const {
return identity_->certificate();
}
-const SSLCertChain& RTCCertificate::GetSSLCertificateChain() const {
+const rtc::SSLCertChain& RTCCertificate::GetSSLCertificateChain() const {
return identity_->cert_chain();
}
@@ -59,8 +59,9 @@
scoped_refptr<RTCCertificate> RTCCertificate::FromPEM(
const RTCCertificatePEM& pem) {
- std::unique_ptr<SSLIdentity> identity(
- SSLIdentity::CreateFromPEMStrings(pem.private_key(), pem.certificate()));
+ std::unique_ptr<rtc::SSLIdentity> identity(
+ rtc::SSLIdentity::CreateFromPEMStrings(pem.private_key(),
+ pem.certificate()));
if (!identity)
return nullptr;
return RTCCertificate::Create(std::move(identity));
@@ -74,4 +75,4 @@
return !(*this == certificate);
}
-} // namespace rtc
+} // namespace webrtc
diff --git a/rtc_base/rtc_certificate.h b/rtc_base/rtc_certificate.h
index 67c5c29..1b76dbc 100644
--- a/rtc_base/rtc_certificate.h
+++ b/rtc_base/rtc_certificate.h
@@ -21,12 +21,13 @@
#include "api/ref_counted_base.h"
#include "api/scoped_refptr.h"
#include "rtc_base/system/rtc_export.h"
-
namespace rtc {
-
class SSLCertChain;
class SSLCertificate;
class SSLIdentity;
+} // namespace rtc
+
+namespace webrtc {
// This class contains PEM strings of an RTCCertificate's private key and
// certificate and acts as a text representation of RTCCertificate. Certificates
@@ -52,11 +53,11 @@
// SSLCertificate and WebRTC usage. Takes ownership of some lower level objects,
// reference counting protects these from premature destruction.
class RTC_EXPORT RTCCertificate final
- : public RefCountedNonVirtual<RTCCertificate> {
+ : public rtc::RefCountedNonVirtual<RTCCertificate> {
public:
// Takes ownership of `identity`.
static scoped_refptr<RTCCertificate> Create(
- std::unique_ptr<SSLIdentity> identity);
+ std::unique_ptr<rtc::SSLIdentity> identity);
// Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z.
uint64_t Expires() const;
@@ -64,14 +65,14 @@
// relative to epoch, 1970-01-01T00:00:00Z.
bool HasExpired(uint64_t now) const;
- const SSLCertificate& GetSSLCertificate() const;
- const SSLCertChain& GetSSLCertificateChain() const;
+ const rtc::SSLCertificate& GetSSLCertificate() const;
+ const rtc::SSLCertChain& GetSSLCertificateChain() const;
// TODO(hbos): If possible, remove once RTCCertificate and its
// GetSSLCertificate() is used in all relevant places. Should not pass around
// raw SSLIdentity* for the sake of accessing SSLIdentity::certificate().
// However, some places might need SSLIdentity* for its public/private key...
- SSLIdentity* identity() const { return identity_.get(); }
+ rtc::SSLIdentity* identity() const { return identity_.get(); }
// To/from PEM, a text representation of the RTCCertificate.
RTCCertificatePEM ToPEM() const;
@@ -81,7 +82,7 @@
bool operator!=(const RTCCertificate& certificate) const;
protected:
- explicit RTCCertificate(SSLIdentity* identity);
+ explicit RTCCertificate(rtc::SSLIdentity* identity);
friend class RefCountedNonVirtual<RTCCertificate>;
~RTCCertificate();
@@ -89,9 +90,16 @@
private:
// The SSLIdentity is the owner of the SSLCertificate. To protect our
// GetSSLCertificate() we take ownership of `identity_`.
- const std::unique_ptr<SSLIdentity> identity_;
+ const std::unique_ptr<rtc::SSLIdentity> identity_;
};
+} // namespace webrtc
+
+// Re-export symbols from the webrtc namespace for backwards compatibility.
+// TODO(bugs.webrtc.org/4222596): Remove once all references are updated.
+namespace rtc {
+using ::webrtc::RTCCertificate;
+using ::webrtc::RTCCertificatePEM;
} // namespace rtc
#endif // RTC_BASE_RTC_CERTIFICATE_H_
diff --git a/rtc_base/rtc_certificate_generator.cc b/rtc_base/rtc_certificate_generator.cc
index a0c6f5b..ff846e4 100644
--- a/rtc_base/rtc_certificate_generator.cc
+++ b/rtc_base/rtc_certificate_generator.cc
@@ -19,7 +19,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/ssl_identity.h"
-namespace rtc {
+namespace webrtc {
namespace {
@@ -31,15 +31,15 @@
// static
scoped_refptr<RTCCertificate> RTCCertificateGenerator::GenerateCertificate(
- const KeyParams& key_params,
+ const rtc::KeyParams& key_params,
const std::optional<uint64_t>& expires_ms) {
if (!key_params.IsValid()) {
return nullptr;
}
- std::unique_ptr<SSLIdentity> identity;
+ std::unique_ptr<rtc::SSLIdentity> identity;
if (!expires_ms) {
- identity = SSLIdentity::Create(kIdentityName, key_params);
+ identity = rtc::SSLIdentity::Create(kIdentityName, key_params);
} else {
uint64_t expires_s = *expires_ms / 1000;
// Limit the expiration time to something reasonable (a year). This was
@@ -51,7 +51,8 @@
// `SSLIdentity::Create` should stop relying on `time_t`.
// See bugs.webrtc.org/5720.
time_t cert_lifetime_s = static_cast<time_t>(expires_s);
- identity = SSLIdentity::Create(kIdentityName, key_params, cert_lifetime_s);
+ identity =
+ rtc::SSLIdentity::Create(kIdentityName, key_params, cert_lifetime_s);
}
if (!identity) {
return nullptr;
@@ -59,15 +60,15 @@
return RTCCertificate::Create(std::move(identity));
}
-RTCCertificateGenerator::RTCCertificateGenerator(Thread* signaling_thread,
- Thread* worker_thread)
+RTCCertificateGenerator::RTCCertificateGenerator(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread)
: signaling_thread_(signaling_thread), worker_thread_(worker_thread) {
RTC_DCHECK(signaling_thread_);
RTC_DCHECK(worker_thread_);
}
void RTCCertificateGenerator::GenerateCertificateAsync(
- const KeyParams& key_params,
+ const rtc::KeyParams& key_params,
const std::optional<uint64_t>& expires_ms,
RTCCertificateGenerator::Callback callback) {
RTC_DCHECK(signaling_thread_->IsCurrent());
@@ -85,4 +86,4 @@
});
}
-} // namespace rtc
+} // namespace webrtc
diff --git a/rtc_base/rtc_certificate_generator.h b/rtc_base/rtc_certificate_generator.h
index 34c05b8..c41f3dc6 100644
--- a/rtc_base/rtc_certificate_generator.h
+++ b/rtc_base/rtc_certificate_generator.h
@@ -22,7 +22,7 @@
#include "rtc_base/system/rtc_export.h"
#include "rtc_base/thread.h"
-namespace rtc {
+namespace webrtc {
// Generates `RTCCertificate`s.
// See `RTCCertificateGenerator` for the WebRTC repo's implementation.
@@ -30,7 +30,8 @@
public:
// Functor that will be called when certificate is generated asynchroniosly.
// Called with nullptr as the parameter on failure.
- using Callback = absl::AnyInvocable<void(scoped_refptr<RTCCertificate>) &&>;
+ using Callback =
+ absl::AnyInvocable<void(scoped_refptr<webrtc::RTCCertificate>) &&>;
virtual ~RTCCertificateGeneratorInterface() = default;
@@ -40,7 +41,7 @@
// long we want the certificate to be valid, but the implementation may choose
// its own restrictions on the expiration time.
virtual void GenerateCertificateAsync(
- const KeyParams& key_params,
+ const rtc::KeyParams& key_params,
const std::optional<uint64_t>& expires_ms,
Callback callback) = 0;
};
@@ -58,10 +59,11 @@
// larger value than that is clamped down to a year. If `expires_ms` is not
// specified, a default expiration time is used.
static scoped_refptr<RTCCertificate> GenerateCertificate(
- const KeyParams& key_params,
+ const rtc::KeyParams& key_params,
const std::optional<uint64_t>& expires_ms);
- RTCCertificateGenerator(Thread* signaling_thread, Thread* worker_thread);
+ RTCCertificateGenerator(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread);
~RTCCertificateGenerator() override {}
// `RTCCertificateGeneratorInterface` overrides.
@@ -69,15 +71,22 @@
// that many milliseconds from now. `expires_ms` is limited to a year, a
// larger value than that is clamped down to a year. If `expires_ms` is not
// specified, a default expiration time is used.
- void GenerateCertificateAsync(const KeyParams& key_params,
+ void GenerateCertificateAsync(const rtc::KeyParams& key_params,
const std::optional<uint64_t>& expires_ms,
Callback callback) override;
private:
- Thread* const signaling_thread_;
- Thread* const worker_thread_;
+ rtc::Thread* const signaling_thread_;
+ rtc::Thread* const worker_thread_;
};
+} // namespace webrtc
+
+// Re-export symbols from the webrtc namespace for backwards compatibility.
+// TODO(bugs.webrtc.org/4222596): Remove once all references are updated.
+namespace rtc {
+using ::webrtc::RTCCertificateGenerator;
+using ::webrtc::RTCCertificateGeneratorInterface;
} // namespace rtc
#endif // RTC_BASE_RTC_CERTIFICATE_GENERATOR_H_
diff --git a/rtc_base/rtc_certificate_generator_unittest.cc b/rtc_base/rtc_certificate_generator_unittest.cc
index c36d6d5..860fb69 100644
--- a/rtc_base/rtc_certificate_generator_unittest.cc
+++ b/rtc_base/rtc_certificate_generator_unittest.cc
@@ -26,13 +26,13 @@
#include "test/gtest.h"
#include "test/wait_until.h"
-namespace rtc {
+namespace webrtc {
class RTCCertificateGeneratorFixture {
public:
RTCCertificateGeneratorFixture()
- : signaling_thread_(Thread::Current()),
- worker_thread_(Thread::Create()),
+ : signaling_thread_(rtc::Thread::Current()),
+ worker_thread_(rtc::Thread::Create()),
generate_async_completed_(false) {
RTC_CHECK(signaling_thread_);
RTC_CHECK(worker_thread_->Start());
@@ -62,8 +62,8 @@
}
protected:
- Thread* const signaling_thread_;
- std::unique_ptr<Thread> worker_thread_;
+ rtc::Thread* const signaling_thread_;
+ std::unique_ptr<rtc::Thread> worker_thread_;
std::unique_ptr<RTCCertificateGenerator> generator_;
scoped_refptr<RTCCertificate> certificate_;
bool generate_async_completed_;
@@ -72,27 +72,26 @@
class RTCCertificateGeneratorTest : public ::testing::Test {
public:
protected:
- static constexpr webrtc::TimeDelta kGenerationTimeoutMs =
- webrtc::TimeDelta::Millis(10000);
+ static constexpr TimeDelta kGenerationTimeoutMs = TimeDelta::Millis(10000);
rtc::AutoThread main_thread_;
RTCCertificateGeneratorFixture fixture_;
};
TEST_F(RTCCertificateGeneratorTest, GenerateECDSA) {
- EXPECT_TRUE(RTCCertificateGenerator::GenerateCertificate(KeyParams::ECDSA(),
- std::nullopt));
+ EXPECT_TRUE(RTCCertificateGenerator::GenerateCertificate(
+ rtc::KeyParams::ECDSA(), std::nullopt));
}
TEST_F(RTCCertificateGeneratorTest, GenerateRSA) {
- EXPECT_TRUE(RTCCertificateGenerator::GenerateCertificate(KeyParams::RSA(),
- std::nullopt));
+ EXPECT_TRUE(RTCCertificateGenerator::GenerateCertificate(
+ rtc::KeyParams::RSA(), std::nullopt));
}
TEST_F(RTCCertificateGeneratorTest, GenerateAsyncECDSA) {
EXPECT_FALSE(fixture_.certificate());
fixture_.generator()->GenerateCertificateAsync(
- KeyParams::ECDSA(), std::nullopt, fixture_.OnGenerated());
+ rtc::KeyParams::ECDSA(), std::nullopt, fixture_.OnGenerated());
// Until generation has completed, the certificate is null. Since this is an
// async call, generation must not have completed until we process messages
// posted to this thread (which is done by `EXPECT_TRUE_WAIT`).
@@ -114,13 +113,13 @@
// Generate a certificate that expires immediately.
scoped_refptr<RTCCertificate> cert_a =
- RTCCertificateGenerator::GenerateCertificate(KeyParams::ECDSA(), 0);
+ RTCCertificateGenerator::GenerateCertificate(rtc::KeyParams::ECDSA(), 0);
EXPECT_TRUE(cert_a);
// Generate a certificate that expires in one minute.
const uint64_t kExpiresMs = 60000;
scoped_refptr<RTCCertificate> cert_b =
- RTCCertificateGenerator::GenerateCertificate(KeyParams::ECDSA(),
+ RTCCertificateGenerator::GenerateCertificate(rtc::KeyParams::ECDSA(),
kExpiresMs);
EXPECT_TRUE(cert_b);
@@ -133,7 +132,7 @@
}
TEST_F(RTCCertificateGeneratorTest, GenerateWithInvalidParamsShouldFail) {
- KeyParams invalid_params = KeyParams::RSA(0, 0);
+ rtc::KeyParams invalid_params = rtc::KeyParams::RSA(0, 0);
EXPECT_FALSE(invalid_params.IsValid());
EXPECT_FALSE(RTCCertificateGenerator::GenerateCertificate(invalid_params,
@@ -148,4 +147,4 @@
EXPECT_FALSE(fixture_.certificate());
}
-} // namespace rtc
+} // namespace webrtc
diff --git a/rtc_base/rtc_certificate_unittest.cc b/rtc_base/rtc_certificate_unittest.cc
index 6c13801..9ebcbf6 100644
--- a/rtc_base/rtc_certificate_unittest.cc
+++ b/rtc_base/rtc_certificate_unittest.cc
@@ -21,7 +21,7 @@
#include "rtc_base/time_utils.h"
#include "test/gtest.h"
-namespace rtc {
+namespace webrtc {
namespace {
@@ -32,8 +32,8 @@
class RTCCertificateTest : public ::testing::Test {
protected:
scoped_refptr<RTCCertificate> GenerateECDSA() {
- std::unique_ptr<SSLIdentity> identity(
- SSLIdentity::Create(kTestCertCommonName, KeyParams::ECDSA()));
+ std::unique_ptr<rtc::SSLIdentity> identity(
+ rtc::SSLIdentity::Create(kTestCertCommonName, rtc::KeyParams::ECDSA()));
RTC_CHECK(identity);
return RTCCertificate::Create(std::move(identity));
}
@@ -47,19 +47,21 @@
// As a result, ExpiresSeconds and HasExpiredSeconds are used instead of
// RTCCertificate::Expires and ::HasExpired for ms -> s conversion.
- uint64_t NowSeconds() const { return TimeNanos() / kNumNanosecsPerSec; }
+ uint64_t NowSeconds() const {
+ return rtc::TimeNanos() / rtc::kNumNanosecsPerSec;
+ }
uint64_t ExpiresSeconds(const scoped_refptr<RTCCertificate>& cert) const {
uint64_t exp_ms = cert->Expires();
- uint64_t exp_s = exp_ms / kNumMillisecsPerSec;
+ uint64_t exp_s = exp_ms / rtc::kNumMillisecsPerSec;
// Make sure this did not result in loss of precision.
- RTC_CHECK_EQ(exp_s * kNumMillisecsPerSec, exp_ms);
+ RTC_CHECK_EQ(exp_s * rtc::kNumMillisecsPerSec, exp_ms);
return exp_s;
}
bool HasExpiredSeconds(const scoped_refptr<RTCCertificate>& cert,
uint64_t now_s) const {
- return cert->HasExpired(now_s * kNumMillisecsPerSec);
+ return cert->HasExpired(now_s * rtc::kNumMillisecsPerSec);
}
// An RTC_CHECK ensures that `expires_s` this is in valid range of time_t as
@@ -70,15 +72,16 @@
uint64_t expires_s) const {
RTC_CHECK(webrtc::IsValueInRangeForNumericType<time_t>(expires_s));
- SSLIdentityParams params;
+ rtc::SSLIdentityParams params;
params.common_name = kTestCertCommonName;
params.not_before = 0;
params.not_after = static_cast<time_t>(expires_s);
// Certificate type does not matter for our purposes, using ECDSA because it
// is fast to generate.
- params.key_params = KeyParams::ECDSA();
+ params.key_params = rtc::KeyParams::ECDSA();
- std::unique_ptr<SSLIdentity> identity(SSLIdentity::CreateForTest(params));
+ std::unique_ptr<rtc::SSLIdentity> identity(
+ rtc::SSLIdentity::CreateForTest(params));
return RTCCertificate::Create(std::move(identity));
}
};
@@ -137,4 +140,4 @@
EXPECT_FALSE(certificate);
}
-} // namespace rtc
+} // namespace webrtc
diff --git a/rtc_base/ssl_fingerprint.cc b/rtc_base/ssl_fingerprint.cc
index a43bb15..e4f1cc7 100644
--- a/rtc_base/ssl_fingerprint.cc
+++ b/rtc_base/ssl_fingerprint.cc
@@ -80,7 +80,7 @@
}
std::unique_ptr<SSLFingerprint> SSLFingerprint::CreateFromCertificate(
- const RTCCertificate& cert) {
+ const webrtc::RTCCertificate& cert) {
std::string digest_alg;
if (!cert.GetSSLCertificate().GetSignatureDigestAlgorithm(&digest_alg)) {
RTC_LOG(LS_ERROR)
diff --git a/rtc_base/ssl_fingerprint.h b/rtc_base/ssl_fingerprint.h
index cfa26dd..6b26249 100644
--- a/rtc_base/ssl_fingerprint.h
+++ b/rtc_base/ssl_fingerprint.h
@@ -18,11 +18,11 @@
#include "absl/strings/string_view.h"
#include "rtc_base/copy_on_write_buffer.h"
+#include "rtc_base/rtc_certificate.h"
#include "rtc_base/system/rtc_export.h"
namespace rtc {
-class RTCCertificate;
class SSLCertificate;
class SSLIdentity;
@@ -50,7 +50,7 @@
// Creates a fingerprint from a certificate, using the same digest algorithm
// as the certificate's signature.
static std::unique_ptr<SSLFingerprint> CreateFromCertificate(
- const RTCCertificate& cert);
+ const webrtc::RTCCertificate& cert);
SSLFingerprint(absl::string_view algorithm,
ArrayView<const uint8_t> digest_view);
diff --git a/rtc_base/ssl_identity.h b/rtc_base/ssl_identity.h
index 5b90dcf..46b36de 100644
--- a/rtc_base/ssl_identity.h
+++ b/rtc_base/ssl_identity.h
@@ -58,11 +58,11 @@
explicit KeyParams(KeyType key_type = KT_DEFAULT);
// Generate a a KeyParams for RSA with explicit parameters.
- static KeyParams RSA(int mod_size = kRsaDefaultModSize,
- int pub_exp = kRsaDefaultExponent);
+ static KeyParams RSA(int mod_size = rtc::kRsaDefaultModSize,
+ int pub_exp = rtc::kRsaDefaultExponent);
// Generate a a KeyParams for ECDSA specifying the curve.
- static KeyParams ECDSA(ECCurve curve = EC_NIST_P256);
+ static KeyParams ECDSA(ECCurve curve = rtc::EC_NIST_P256);
// Check validity of a KeyParams object. Since the factory functions have
// no way of returning errors, this function can be called after creation
diff --git a/sdk/android/src/jni/pc/peer_connection.cc b/sdk/android/src/jni/pc/peer_connection.cc
index bb3eabe..a476b93 100644
--- a/sdk/android/src/jni/pc/peer_connection.cc
+++ b/sdk/android/src/jni/pc/peer_connection.cc
@@ -181,9 +181,8 @@
rtc_config->rtcp_mux_policy =
JavaToNativeRtcpMuxPolicy(jni, j_rtcp_mux_policy);
if (!j_rtc_certificate.is_null()) {
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificate::FromPEM(
- JavaToNativeRTCCertificatePEM(jni, j_rtc_certificate));
+ rtc::scoped_refptr<RTCCertificate> certificate = RTCCertificate::FromPEM(
+ JavaToNativeRTCCertificatePEM(jni, j_rtc_certificate));
RTC_CHECK(certificate != nullptr) << "supplied certificate is malformed.";
rtc_config->certificates.push_back(certificate);
}
@@ -560,8 +559,7 @@
const jni_zero::JavaParamRef<jobject>& j_pc) {
const PeerConnectionInterface::RTCConfiguration rtc_config =
ExtractNativePC(jni, j_pc)->GetConfiguration();
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc_config.certificates[0];
+ rtc::scoped_refptr<RTCCertificate> certificate = rtc_config.certificates[0];
return NativeToJavaRTCCertificatePEM(jni, certificate->ToPEM());
}
diff --git a/sdk/android/src/jni/pc/peer_connection_factory.cc b/sdk/android/src/jni/pc/peer_connection_factory.cc
index 305fad4..d6219c2 100644
--- a/sdk/android/src/jni/pc/peer_connection_factory.cc
+++ b/sdk/android/src/jni/pc/peer_connection_factory.cc
@@ -452,9 +452,9 @@
// Generate non-default certificate.
rtc::KeyType key_type = GetRtcConfigKeyType(jni, j_rtc_config);
if (key_type != rtc::KT_DEFAULT) {
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificateGenerator::GenerateCertificate(
- rtc::KeyParams(key_type), std::nullopt);
+ rtc::scoped_refptr<RTCCertificate> certificate =
+ RTCCertificateGenerator::GenerateCertificate(rtc::KeyParams(key_type),
+ std::nullopt);
if (!certificate) {
RTC_LOG(LS_ERROR) << "Failed to generate certificate. KeyType: "
<< key_type;
diff --git a/sdk/android/src/jni/pc/rtc_certificate.cc b/sdk/android/src/jni/pc/rtc_certificate.cc
index 484b8d5..b32baaf 100644
--- a/sdk/android/src/jni/pc/rtc_certificate.cc
+++ b/sdk/android/src/jni/pc/rtc_certificate.cc
@@ -22,20 +22,20 @@
namespace webrtc {
namespace jni {
-rtc::RTCCertificatePEM JavaToNativeRTCCertificatePEM(
+RTCCertificatePEM JavaToNativeRTCCertificatePEM(
JNIEnv* jni,
const jni_zero::JavaRef<jobject>& j_rtc_certificate) {
jni_zero::ScopedJavaLocalRef<jstring> privatekey_field =
Java_RtcCertificatePem_getPrivateKey(jni, j_rtc_certificate);
jni_zero::ScopedJavaLocalRef<jstring> certificate_field =
Java_RtcCertificatePem_getCertificate(jni, j_rtc_certificate);
- return rtc::RTCCertificatePEM(JavaToNativeString(jni, privatekey_field),
- JavaToNativeString(jni, certificate_field));
+ return RTCCertificatePEM(JavaToNativeString(jni, privatekey_field),
+ JavaToNativeString(jni, certificate_field));
}
ScopedJavaLocalRef<jobject> NativeToJavaRTCCertificatePEM(
JNIEnv* jni,
- const rtc::RTCCertificatePEM& certificate) {
+ const RTCCertificatePEM& certificate) {
return Java_RtcCertificatePem_Constructor(
jni, NativeToJavaString(jni, certificate.private_key()),
NativeToJavaString(jni, certificate.certificate()));
@@ -48,10 +48,10 @@
jlong j_expires) {
rtc::KeyType key_type = JavaToNativeKeyType(jni, j_key_type);
uint64_t expires = (uint64_t)j_expires;
- rtc::scoped_refptr<rtc::RTCCertificate> certificate =
- rtc::RTCCertificateGenerator::GenerateCertificate(
- rtc::KeyParams(key_type), expires);
- rtc::RTCCertificatePEM pem = certificate->ToPEM();
+ rtc::scoped_refptr<RTCCertificate> certificate =
+ RTCCertificateGenerator::GenerateCertificate(rtc::KeyParams(key_type),
+ expires);
+ RTCCertificatePEM pem = certificate->ToPEM();
return Java_RtcCertificatePem_Constructor(
jni, NativeToJavaString(jni, pem.private_key()),
NativeToJavaString(jni, pem.certificate()));
diff --git a/sdk/android/src/jni/pc/rtc_certificate.h b/sdk/android/src/jni/pc/rtc_certificate.h
index 91a413c..eab27f1 100644
--- a/sdk/android/src/jni/pc/rtc_certificate.h
+++ b/sdk/android/src/jni/pc/rtc_certificate.h
@@ -19,13 +19,13 @@
namespace webrtc {
namespace jni {
-rtc::RTCCertificatePEM JavaToNativeRTCCertificatePEM(
+RTCCertificatePEM JavaToNativeRTCCertificatePEM(
JNIEnv* jni,
const JavaRef<jobject>& j_rtc_certificate);
ScopedJavaLocalRef<jobject> NativeToJavaRTCCertificatePEM(
JNIEnv* env,
- const rtc::RTCCertificatePEM& certificate);
+ const RTCCertificatePEM& certificate);
} // namespace jni
} // namespace webrtc
diff --git a/test/peer_scenario/scenario_connection.cc b/test/peer_scenario/scenario_connection.cc
index 3084994..40ee4c5 100644
--- a/test/peer_scenario/scenario_connection.cc
+++ b/test/peer_scenario/scenario_connection.cc
@@ -92,7 +92,7 @@
EmulatedNetworkManagerInterface* const manager_;
rtc::Thread* const signaling_thread_;
rtc::Thread* const network_thread_;
- rtc::scoped_refptr<rtc::RTCCertificate> const certificate_
+ rtc::scoped_refptr<RTCCertificate> const certificate_
RTC_GUARDED_BY(network_thread_);
cricket::TransportDescription const transport_description_
RTC_GUARDED_BY(signaling_thread_);
@@ -126,7 +126,7 @@
manager_(net->CreateEmulatedNetworkManagerInterface({endpoint_})),
signaling_thread_(rtc::Thread::Current()),
network_thread_(manager_->network_thread()),
- certificate_(rtc::RTCCertificate::Create(
+ certificate_(RTCCertificate::Create(
rtc::SSLIdentity::Create("", ::rtc::KT_DEFAULT))),
transport_description_(
/*transport_options*/ {},