OLD | NEW |
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 Loading... |
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( |
| 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 |
46 } // namespace rtc | 58 } // namespace rtc |
OLD | NEW |