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

Side by Side Diff: third_party/WebKit/public/platform/WebRTCCertificate.h

Issue 1949033002: Ability to persist RTCCertificate in IndexedDB (enables cloning). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WebRTCCertificate_h 5 #ifndef WebRTCCertificate_h
6 #define WebRTCCertificate_h 6 #define WebRTCCertificate_h
7 7
8 #include "public/platform/WebRTCKeyParams.h" 8 #include "public/platform/WebRTCKeyParams.h"
9 9
10 #include <memory> 10 #include <memory>
11 11
12 namespace blink { 12 namespace blink {
13 13
14 // Corresponds to |rtc::RTCCertificatePEM| in WebRTC.
15 // See |WebRTCCertificate::toPEM| and |WebRTCCertificateGenerator::fromPEM|.
16 class WebRTCCertificatePEM {
17 public:
18 WebRTCCertificatePEM(std::string privateKey, std::string certificate)
19 : m_privateKey(privateKey), m_certificate(certificate)
20 {
21 }
22
23 const std::string& privateKey() const
24 {
25 return m_privateKey;
26 }
27 const std::string& certificate() const
28 {
29 return m_certificate;
30 }
31
32 private:
33 std::string m_privateKey;
34 std::string m_certificate;
35 };
36
14 // WebRTCCertificate is an interface defining what Blink needs to know about cer tificates, 37 // WebRTCCertificate is an interface defining what Blink needs to know about cer tificates,
15 // hiding Chromium and WebRTC layer implementation details. It is possible to cr eate 38 // hiding Chromium and WebRTC layer implementation details. It is possible to cr eate
16 // shallow copies of the WebRTCCertificate. When all copies are destroyed, the 39 // shallow copies of the WebRTCCertificate. When all copies are destroyed, the
17 // implementation specific data must be freed. WebRTCCertificate objects thus ac t as 40 // implementation specific data must be freed. WebRTCCertificate objects thus ac t as
18 // references to the reference counted internal data. 41 // references to the reference counted internal data.
19 class WebRTCCertificate { 42 class WebRTCCertificate {
20 public: 43 public:
21 WebRTCCertificate() = default; 44 WebRTCCertificate() = default;
22 virtual ~WebRTCCertificate() = default; 45 virtual ~WebRTCCertificate() = default;
23 46
24 // Copies the WebRTCCertificate object without copying the underlying implem entation 47 // Copies the WebRTCCertificate object without copying the underlying implem entation
25 // specific (WebRTC layer) certificate. When all copies are destroyed the un derlying 48 // specific (WebRTC layer) certificate. When all copies are destroyed the un derlying
26 // data is freed. 49 // data is freed.
27 virtual std::unique_ptr<WebRTCCertificate> shallowCopy() const = 0; 50 virtual std::unique_ptr<WebRTCCertificate> shallowCopy() const = 0;
28 51
29 virtual const WebRTCKeyParams& keyParams() const = 0;
30
31 // Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z . 52 // Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z .
32 virtual uint64_t expires() const = 0; 53 virtual uint64_t expires() const = 0;
33 54 // Creates a PEM strings representation of the certificate. See also
55 // |WebRTCCertificateGenerator::fromPEM|.
56 virtual WebRTCCertificatePEM toPEM() const = 0;
34 // Checks if the two certificate objects represent the same certificate valu e, 57 // Checks if the two certificate objects represent the same certificate valu e,
35 // as should be the case for a clone and the original. 58 // as should be the case for a clone and the original.
36 virtual bool equals(const WebRTCCertificate& other) const = 0; 59 virtual bool equals(const WebRTCCertificate& other) const = 0;
37 60
38 private: 61 private:
39 WebRTCCertificate(const WebRTCCertificate&) = delete; 62 WebRTCCertificate(const WebRTCCertificate&) = delete;
40 WebRTCCertificate& operator=(const WebRTCCertificate&) = delete; 63 WebRTCCertificate& operator=(const WebRTCCertificate&) = delete;
41 }; 64 };
42 65
43 } // namespace blink 66 } // namespace blink
44 67
45 #endif // WebRTCCertificate_h 68 #endif // WebRTCCertificate_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698