| 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 25 matching lines...) Expand all Loading... |
| 36 #include "public/platform/WebRTCKeyParams.h" | 36 #include "public/platform/WebRTCKeyParams.h" |
| 37 #include "public/platform/WebString.h" | 37 #include "public/platform/WebString.h" |
| 38 | 38 |
| 39 #include <memory> | 39 #include <memory> |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 using WebRTCCertificateCallback = | 43 using WebRTCCertificateCallback = |
| 44 WebCallbacks<std::unique_ptr<WebRTCCertificate>, void>; | 44 WebCallbacks<std::unique_ptr<WebRTCCertificate>, void>; |
| 45 | 45 |
| 46 // Interface defining a class that can generate WebRTCCertificates asynchronousl
y. | 46 // Interface defining a class that can generate WebRTCCertificates |
| 47 // asynchronously. |
| 47 class WebRTCCertificateGenerator { | 48 class WebRTCCertificateGenerator { |
| 48 public: | 49 public: |
| 49 virtual ~WebRTCCertificateGenerator() {} | 50 virtual ~WebRTCCertificateGenerator() {} |
| 50 | 51 |
| 51 // Start generating a certificate asynchronously. |observer| is invoked on the | 52 // Start generating a certificate asynchronously. |observer| is invoked on the |
| 52 // same thread that called generateCertificate when the operation is completed
. | 53 // same thread that called generateCertificate when the operation is |
| 54 // completed. |
| 53 virtual void generateCertificate( | 55 virtual void generateCertificate( |
| 54 const WebRTCKeyParams&, | 56 const WebRTCKeyParams&, |
| 55 std::unique_ptr<WebRTCCertificateCallback> observer) = 0; | 57 std::unique_ptr<WebRTCCertificateCallback> observer) = 0; |
| 56 virtual void generateCertificateWithExpiration( | 58 virtual void generateCertificateWithExpiration( |
| 57 const WebRTCKeyParams&, | 59 const WebRTCKeyParams&, |
| 58 uint64_t expiresMs, | 60 uint64_t expiresMs, |
| 59 std::unique_ptr<WebRTCCertificateCallback> observer) = 0; | 61 std::unique_ptr<WebRTCCertificateCallback> observer) = 0; |
| 60 | 62 |
| 61 // Determines if the parameters are supported by |generateCertificate|. | 63 // Determines if the parameters are supported by |generateCertificate|. |
| 62 // For example, if the number of bits of some parameter is too small or too la
rge we | 64 // For example, if the number of bits of some parameter is too small or too |
| 63 // may want to reject it for security or performance reasons. | 65 // large we may want to reject it for security or performance reasons. |
| 64 virtual bool isSupportedKeyParams(const WebRTCKeyParams&) = 0; | 66 virtual bool isSupportedKeyParams(const WebRTCKeyParams&) = 0; |
| 65 | 67 |
| 66 // Creates a certificate from the PEM strings. See also |WebRTCCertificate::to
PEM|. | 68 // Creates a certificate from the PEM strings. See also |
| 69 // |WebRTCCertificate::toPEM|. |
| 67 virtual std::unique_ptr<WebRTCCertificate> fromPEM( | 70 virtual std::unique_ptr<WebRTCCertificate> fromPEM( |
| 68 blink::WebString pemPrivateKey, | 71 blink::WebString pemPrivateKey, |
| 69 blink::WebString pemCertificate) = 0; | 72 blink::WebString pemCertificate) = 0; |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 } // namespace blink | 75 } // namespace blink |
| 73 | 76 |
| 74 #endif // WebRTCCertificateGenerator_h | 77 #endif // WebRTCCertificateGenerator_h |
| OLD | NEW |