Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: talk/app/webrtc/test/fakedtlsidentityservice.h

Issue 1269843005: Added DtlsCertificate, a ref counted object owning an SSLIdentity (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: webrtcsession_unittest cleanup Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: talk/app/webrtc/test/fakedtlsidentityservice.h
diff --git a/talk/app/webrtc/test/fakedtlsidentityservice.h b/talk/app/webrtc/test/fakedtlsidentityservice.h
index 6c59d4115a88024a33be854df38949dcf89f66ca..d9320fc6696fcc0cae8462b3b3711a5cb5ccba1a 100644
--- a/talk/app/webrtc/test/fakedtlsidentityservice.h
+++ b/talk/app/webrtc/test/fakedtlsidentityservice.h
@@ -28,6 +28,8 @@
#ifndef TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_
#define TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_
+#include "talk/app/webrtc/dtlscertificate.h"
+#include "talk/app/webrtc/dtlsidentitystore.h"
#include "talk/app/webrtc/peerconnectioninterface.h"
static const char kRSA_PRIVATE_KEY_PEM[] =
@@ -95,6 +97,25 @@ class FakeIdentityService : public webrtc::DTLSIdentityServiceInterface,
return true;
}
+ static rtc::scoped_refptr<webrtc::DtlsCertificate> GenerateCertificate() {
+ std::string cert;
+ std::string key;
+ GenerateIdentity(webrtc::DtlsIdentityStore::kIdentityName, &cert, &key);
+
+ std::string pem_cert = rtc::SSLIdentity::DerToPem(
+ rtc::kPemTypeCertificate,
+ reinterpret_cast<const unsigned char*>(cert.data()),
+ cert.length());
+ std::string pem_key = rtc::SSLIdentity::DerToPem(
+ rtc::kPemTypeRsaPrivateKey,
+ reinterpret_cast<const unsigned char*>(key.data()),
+ key.length());
+ rtc::scoped_ptr<rtc::SSLIdentity> identity(
+ rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert));
+
+ return webrtc::DtlsCertificate::Create(identity.Pass());
+ }
+
private:
enum {
MSG_SUCCESS,
@@ -120,7 +141,7 @@ class FakeIdentityService : public webrtc::DTLSIdentityServiceInterface,
delete message_data;
}
- void GenerateIdentity(
+ static void GenerateIdentity(
Henrik Grunell WebRTC 2015/08/05 07:41:20 Make this an ordinary function in the implementati
hbos 2015/08/06 12:11:34 We talked about this and decided it didn't matter
Henrik Grunell WebRTC 2015/08/06 14:06:52 Acknowledged.
const std::string& common_name,
std::string* der_cert,
std::string* der_key) {

Powered by Google App Engine
This is Rietveld 408576698