| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebRTCCertificateGenerator_h | 31 #ifndef WebRTCCertificateGenerator_h |
| 32 #define WebRTCCertificateGenerator_h | 32 #define WebRTCCertificateGenerator_h |
| 33 | 33 |
| 34 #include "public/platform/WebCallbacks.h" | 34 #include "public/platform/WebCallbacks.h" |
| 35 #include "public/platform/WebRTCCertificate.h" | 35 #include "public/platform/WebRTCCertificate.h" |
| 36 #include "public/platform/WebRTCKeyParams.h" | 36 #include "public/platform/WebRTCKeyParams.h" |
| 37 #include "public/platform/WebString.h" |
| 37 | 38 |
| 38 #include <memory> | 39 #include <memory> |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 using WebRTCCertificateCallback = WebCallbacks<std::unique_ptr<WebRTCCertificate
>, void>; | 43 using WebRTCCertificateCallback = WebCallbacks<std::unique_ptr<WebRTCCertificate
>, void>; |
| 43 | 44 |
| 44 // Interface defining a class that can generate WebRTCCertificates asynchronousl
y. | 45 // Interface defining a class that can generate WebRTCCertificates asynchronousl
y. |
| 45 class WebRTCCertificateGenerator { | 46 class WebRTCCertificateGenerator { |
| 46 public: | 47 public: |
| 47 virtual ~WebRTCCertificateGenerator() {} | 48 virtual ~WebRTCCertificateGenerator() {} |
| 48 | 49 |
| 49 // Start generating a certificate asynchronously. |observer| is invoked on t
he | 50 // Start generating a certificate asynchronously. |observer| is invoked on t
he |
| 50 // same thread that called generateCertificate when the operation is complet
ed. | 51 // same thread that called generateCertificate when the operation is complet
ed. |
| 51 virtual void generateCertificate( | 52 virtual void generateCertificate( |
| 52 const WebRTCKeyParams&, | 53 const WebRTCKeyParams&, |
| 53 std::unique_ptr<WebRTCCertificateCallback> observer) = 0; | 54 std::unique_ptr<WebRTCCertificateCallback> observer) = 0; |
| 54 virtual void generateCertificateWithExpiration( | 55 virtual void generateCertificateWithExpiration( |
| 55 const WebRTCKeyParams&, | 56 const WebRTCKeyParams&, |
| 56 uint64_t expiresMs, | 57 uint64_t expiresMs, |
| 57 std::unique_ptr<WebRTCCertificateCallback> observer) = 0; | 58 std::unique_ptr<WebRTCCertificateCallback> observer) = 0; |
| 58 | 59 |
| 59 // Determines if the parameters are supported by |generateCertificate|. | 60 // Determines if the parameters are supported by |generateCertificate|. |
| 60 // For example, if the number of bits of some parameter is too small or too
large we | 61 // For example, if the number of bits of some parameter is too small or too
large we |
| 61 // may want to reject it for security or performance reasons. | 62 // may want to reject it for security or performance reasons. |
| 62 virtual bool isSupportedKeyParams(const WebRTCKeyParams&) = 0; | 63 virtual bool isSupportedKeyParams(const WebRTCKeyParams&) = 0; |
| 63 | 64 |
| 64 // Creates a certificate from the PEM strings. See also |WebRTCCertificate::
toPEM|. | 65 // Creates a certificate from the PEM strings. See also |WebRTCCertificate::
toPEM|. |
| 65 virtual std::unique_ptr<WebRTCCertificate> fromPEM( | 66 virtual std::unique_ptr<WebRTCCertificate> fromPEM( |
| 66 const std::string& pemPrivateKey, | 67 blink::WebString pemPrivateKey, |
| 67 const std::string& pemCertificate) = 0; | 68 blink::WebString pemCertificate) = 0; |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace blink | 71 } // namespace blink |
| 71 | 72 |
| 72 #endif // WebRTCCertificateGenerator_h | 73 #endif // WebRTCCertificateGenerator_h |
| OLD | NEW |