 Chromium Code Reviews
 Chromium Code Reviews Issue 1898383003:
  RTCCertificate serialization.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master
    
  
    Issue 1898383003:
  RTCCertificate serialization.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master| Index: webrtc/base/rtccertificate.h | 
| diff --git a/webrtc/base/rtccertificate.h b/webrtc/base/rtccertificate.h | 
| index 600739bc86a9211172337e3b88d189f95835b839..f6933e9480dcf8164eaef3ce6aa674e0957b832c 100644 | 
| --- a/webrtc/base/rtccertificate.h | 
| +++ b/webrtc/base/rtccertificate.h | 
| @@ -19,6 +19,26 @@ | 
| namespace rtc { | 
| +// This class contains PEM strings of an RTCCertificate's private key and | 
| +// certificate and acts as a text representation of RTCCertificate. Certificates | 
| +// can be serialized and deserialized to and from this format, which allows for | 
| +// cloning and storing of certificates to disk. | 
| 
hta-webrtc
2016/04/28 10:18:12
Do you want to say where the string format is defi
 
hbos
2016/04/28 10:44:37
Done.
 | 
| +class RTCCertificatePEM { | 
| + public: | 
| + RTCCertificatePEM( | 
| + const std::string& private_key, | 
| + const std::string& certificate) | 
| + : private_key_(private_key), | 
| + certificate_(certificate) {} | 
| + | 
| + const std::string& private_key() const { return private_key_; } | 
| + const std::string& certificate() const { return certificate_; } | 
| + | 
| + private: | 
| + std::string private_key_; | 
| + std::string certificate_; | 
| +}; | 
| + | 
| // A thin abstraction layer between "lower level crypto stuff" like | 
| // SSLCertificate and WebRTC usage. Takes ownership of some lower level objects, | 
| // reference counting protects these from premature destruction. | 
| @@ -40,6 +60,12 @@ class RTCCertificate : public RefCountInterface { | 
| // However, some places might need SSLIdentity* for its public/private key... | 
| SSLIdentity* identity() const { return identity_.get(); } | 
| + // To/from PEM, a text representation of the RTCCertificate. | 
| + RTCCertificatePEM ToPEM() const; | 
| + static scoped_refptr<RTCCertificate> FromPEM(const RTCCertificatePEM& pem); | 
| + bool operator==(const RTCCertificate& certificate) const; | 
| + bool operator!=(const RTCCertificate& certificate) const; | 
| + | 
| protected: | 
| explicit RTCCertificate(SSLIdentity* identity); | 
| ~RTCCertificate() override; |