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

Unified Diff: webrtc/base/rtccertificate.cc

Issue 1898383003: RTCCertificate serialization. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed nisse's comments Created 4 years, 8 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: webrtc/base/rtccertificate.cc
diff --git a/webrtc/base/rtccertificate.cc b/webrtc/base/rtccertificate.cc
index 7b764bd72e66faa2a63afb49894f61414ca15d08..5f602ba5e5859c330f6279d824218e22978d760f 100644
--- a/webrtc/base/rtccertificate.cc
+++ b/webrtc/base/rtccertificate.cc
@@ -43,4 +43,24 @@ const SSLCertificate& RTCCertificate::ssl_certificate() const {
return identity_->certificate();
}
+RTCCertificatePem RTCCertificate::ToPem() const {
+ return RTCCertificatePem(identity_->PrivateKeyToPemString(),
+ ssl_certificate().ToPEMString());
+}
+
+scoped_refptr<RTCCertificate> RTCCertificate::FromPem(
+ const RTCCertificatePem& pem) {
+ scoped_ptr<SSLIdentity> identity(SSLIdentity::FromPEMStrings(
+ pem.private_key(), pem.certificate()));
+ return new RefCountedObject<RTCCertificate>(identity.release());
+}
+
+bool RTCCertificate::operator==(const RTCCertificate& certificate) const {
+ return *this->identity_ == *certificate.identity_;
+}
+
+bool RTCCertificate::operator!=(const RTCCertificate& certificate) const {
+ return !(*this == certificate);
+}
+
} // namespace rtc

Powered by Google App Engine
This is Rietveld 408576698