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

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

Issue 2424093002: Return nullptr from RTCCertificate::FromPEM on failure. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | webrtc/base/rtccertificate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const SSLCertificate& ssl_certificate() const; 59 const SSLCertificate& ssl_certificate() const;
60 60
61 // TODO(hbos): If possible, remove once RTCCertificate and its 61 // TODO(hbos): If possible, remove once RTCCertificate and its
62 // ssl_certificate() is used in all relevant places. Should not pass around 62 // ssl_certificate() is used in all relevant places. Should not pass around
63 // raw SSLIdentity* for the sake of accessing SSLIdentity::certificate(). 63 // raw SSLIdentity* for the sake of accessing SSLIdentity::certificate().
64 // However, some places might need SSLIdentity* for its public/private key... 64 // However, some places might need SSLIdentity* for its public/private key...
65 SSLIdentity* identity() const { return identity_.get(); } 65 SSLIdentity* identity() const { return identity_.get(); }
66 66
67 // To/from PEM, a text representation of the RTCCertificate. 67 // To/from PEM, a text representation of the RTCCertificate.
68 RTCCertificatePEM ToPEM() const; 68 RTCCertificatePEM ToPEM() const;
69 // Can return nullptr if the certificate is invalid.
69 static scoped_refptr<RTCCertificate> FromPEM(const RTCCertificatePEM& pem); 70 static scoped_refptr<RTCCertificate> FromPEM(const RTCCertificatePEM& pem);
70 bool operator==(const RTCCertificate& certificate) const; 71 bool operator==(const RTCCertificate& certificate) const;
71 bool operator!=(const RTCCertificate& certificate) const; 72 bool operator!=(const RTCCertificate& certificate) const;
72 73
73 protected: 74 protected:
74 explicit RTCCertificate(SSLIdentity* identity); 75 explicit RTCCertificate(SSLIdentity* identity);
75 ~RTCCertificate() override; 76 ~RTCCertificate() override;
76 77
77 private: 78 private:
78 // The SSLIdentity is the owner of the SSLCertificate. To protect our 79 // The SSLIdentity is the owner of the SSLCertificate. To protect our
79 // ssl_certificate() we take ownership of |identity_|. 80 // ssl_certificate() we take ownership of |identity_|.
80 std::unique_ptr<SSLIdentity> identity_; 81 std::unique_ptr<SSLIdentity> identity_;
81 }; 82 };
82 83
83 } // namespace rtc 84 } // namespace rtc
84 85
85 #endif // WEBRTC_BASE_RTCCERTIFICATE_H_ 86 #endif // WEBRTC_BASE_RTCCERTIFICATE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/rtccertificate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698