OLD | NEW |
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 #include "public/platform/WebString.h" | 9 #include "public/platform/WebString.h" |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // Corresponds to |rtc::RTCCertificatePEM| in WebRTC. | 15 // Corresponds to |rtc::RTCCertificatePEM| in WebRTC. |
16 // See |WebRTCCertificate::toPEM| and |WebRTCCertificateGenerator::fromPEM|. | 16 // See |WebRTCCertificate::toPEM| and |WebRTCCertificateGenerator::fromPEM|. |
17 class WebRTCCertificatePEM { | 17 class WebRTCCertificatePEM { |
18 public: | 18 public: |
19 WebRTCCertificatePEM(WebString privateKey, WebString certificate) | 19 WebRTCCertificatePEM(WebString privateKey, WebString certificate) |
20 : m_privateKey(privateKey), m_certificate(certificate) {} | 20 : m_privateKey(privateKey), m_certificate(certificate) {} |
21 | 21 |
22 WebString privateKey() const { return m_privateKey; } | 22 WebString privateKey() const { return m_privateKey; } |
23 WebString certificate() const { return m_certificate; } | 23 WebString certificate() const { return m_certificate; } |
24 | 24 |
25 private: | 25 private: |
26 WebString m_privateKey; | 26 WebString m_privateKey; |
27 WebString m_certificate; | 27 WebString m_certificate; |
28 }; | 28 }; |
29 | 29 |
30 // WebRTCCertificate is an interface defining what Blink needs to know about cer
tificates, | 30 // WebRTCCertificate is an interface defining what Blink needs to know about |
31 // hiding Chromium and WebRTC layer implementation details. It is possible to cr
eate | 31 // certificates, hiding Chromium and WebRTC layer implementation details. It is |
32 // shallow copies of the WebRTCCertificate. When all copies are destroyed, the | 32 // possible to create shallow copies of the WebRTCCertificate. When all copies |
33 // implementation specific data must be freed. WebRTCCertificate objects thus ac
t as | 33 // are destroyed, the implementation specific data must be freed. |
34 // references to the reference counted internal data. | 34 // WebRTCCertificate objects thus act as references to the reference counted |
| 35 // internal data. |
35 class WebRTCCertificate { | 36 class WebRTCCertificate { |
36 public: | 37 public: |
37 WebRTCCertificate() = default; | 38 WebRTCCertificate() = default; |
38 virtual ~WebRTCCertificate() = default; | 39 virtual ~WebRTCCertificate() = default; |
39 | 40 |
40 // Copies the WebRTCCertificate object without copying the underlying implemen
tation | 41 // Copies the WebRTCCertificate object without copying the underlying |
41 // specific (WebRTC layer) certificate. When all copies are destroyed the unde
rlying | 42 // implementation specific (WebRTC layer) certificate. When all copies are |
42 // data is freed. | 43 // destroyed the underlying data is freed. |
43 virtual std::unique_ptr<WebRTCCertificate> shallowCopy() const = 0; | 44 virtual std::unique_ptr<WebRTCCertificate> shallowCopy() const = 0; |
44 | 45 |
45 // Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z. | 46 // Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z. |
46 virtual uint64_t expires() const = 0; | 47 virtual uint64_t expires() const = 0; |
47 // Creates a PEM strings representation of the certificate. See also | 48 // Creates a PEM strings representation of the certificate. See also |
48 // |WebRTCCertificateGenerator::fromPEM|. | 49 // |WebRTCCertificateGenerator::fromPEM|. |
49 virtual WebRTCCertificatePEM toPEM() const = 0; | 50 virtual WebRTCCertificatePEM toPEM() const = 0; |
50 // Checks if the two certificate objects represent the same certificate value, | 51 // Checks if the two certificate objects represent the same certificate value, |
51 // as should be the case for a clone and the original. | 52 // as should be the case for a clone and the original. |
52 virtual bool equals(const WebRTCCertificate& other) const = 0; | 53 virtual bool equals(const WebRTCCertificate& other) const = 0; |
53 | 54 |
54 private: | 55 private: |
55 WebRTCCertificate(const WebRTCCertificate&) = delete; | 56 WebRTCCertificate(const WebRTCCertificate&) = delete; |
56 WebRTCCertificate& operator=(const WebRTCCertificate&) = delete; | 57 WebRTCCertificate& operator=(const WebRTCCertificate&) = delete; |
57 }; | 58 }; |
58 | 59 |
59 } // namespace blink | 60 } // namespace blink |
60 | 61 |
61 #endif // WebRTCCertificate_h | 62 #endif // WebRTCCertificate_h |
OLD | NEW |