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

Side by Side Diff: webrtc/base/rtccertificate.cc

Issue 1898383003: RTCCertificate serialization. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: PublicKeyToPEMString Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 bool RTCCertificate::HasExpired(uint64_t now) const { 38 bool RTCCertificate::HasExpired(uint64_t now) const {
39 return Expires() <= now; 39 return Expires() <= now;
40 } 40 }
41 41
42 const SSLCertificate& RTCCertificate::ssl_certificate() const { 42 const SSLCertificate& RTCCertificate::ssl_certificate() const {
43 return identity_->certificate(); 43 return identity_->certificate();
44 } 44 }
45 45
46 RTCCertificatePem RTCCertificate::ToPem() const {
47 return RTCCertificatePem(identity_->PrivateKeyToPEMString(),
48 ssl_certificate().ToPEMString());
49 }
50
51 scoped_refptr<RTCCertificate> RTCCertificate::FromPem(
torbjorng (webrtc) 2016/04/26 13:35:51 Please use PEM xor Pem as part of method names.
hbos 2016/04/27 07:52:09 Done.
52 const RTCCertificatePem& pem) {
53 scoped_ptr<SSLIdentity> identity(SSLIdentity::FromPEMStrings(
54 pem.private_key(), pem.certificate()));
55 return new RefCountedObject<RTCCertificate>(identity.release());
56 }
57
58 bool RTCCertificate::operator==(const RTCCertificate& certificate) const {
59 return *this->identity_ == *certificate.identity_;
60 }
61
62 bool RTCCertificate::operator!=(const RTCCertificate& certificate) const {
63 return !(*this == certificate);
64 }
65
46 } // namespace rtc 66 } // namespace rtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698