| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 class WebCryptoAesGcmParams; | 78 class WebCryptoAesGcmParams; |
| 79 class WebCryptoRsaOaepParams; | 79 class WebCryptoRsaOaepParams; |
| 80 | 80 |
| 81 class WebCryptoAlgorithmParams; | 81 class WebCryptoAlgorithmParams; |
| 82 class WebCryptoAlgorithmPrivate; | 82 class WebCryptoAlgorithmPrivate; |
| 83 | 83 |
| 84 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. | 84 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. |
| 85 // * Immutable | 85 // * Immutable |
| 86 // * Threadsafe | 86 // * Threadsafe |
| 87 // * Copiable (cheaply) | 87 // * Copiable (cheaply) |
| 88 // |
| 89 // If WebCryptoAlgorithm "isNull()" then it is invalid to call any of the other |
| 90 // methods on it (other than destruction, assignment, or isNull()). |
| 88 class WebCryptoAlgorithm { | 91 class WebCryptoAlgorithm { |
| 89 public: | 92 public: |
| 90 #if BLINK_IMPLEMENTATION | 93 #if BLINK_IMPLEMENTATION |
| 91 WebCryptoAlgorithm() { } | 94 WebCryptoAlgorithm() { } |
| 92 WebCryptoAlgorithm(WebCryptoAlgorithmId, PassOwnPtr<WebCryptoAlgorithmParams
>); | 95 WebCryptoAlgorithm(WebCryptoAlgorithmId, PassOwnPtr<WebCryptoAlgorithmParams
>); |
| 93 #endif | 96 #endif |
| 94 | 97 |
| 98 BLINK_EXPORT static WebCryptoAlgorithm createNull(); |
| 95 BLINK_EXPORT static WebCryptoAlgorithm adoptParamsAndCreate(WebCryptoAlgorit
hmId, WebCryptoAlgorithmParams*); | 99 BLINK_EXPORT static WebCryptoAlgorithm adoptParamsAndCreate(WebCryptoAlgorit
hmId, WebCryptoAlgorithmParams*); |
| 96 | 100 |
| 97 ~WebCryptoAlgorithm() { reset(); } | 101 ~WebCryptoAlgorithm() { reset(); } |
| 98 | 102 |
| 99 WebCryptoAlgorithm(const WebCryptoAlgorithm& other) { assign(other); } | 103 WebCryptoAlgorithm(const WebCryptoAlgorithm& other) { assign(other); } |
| 100 WebCryptoAlgorithm& operator=(const WebCryptoAlgorithm& other) | 104 WebCryptoAlgorithm& operator=(const WebCryptoAlgorithm& other) |
| 101 { | 105 { |
| 102 assign(other); | 106 assign(other); |
| 103 return *this; | 107 return *this; |
| 104 } | 108 } |
| 105 | 109 |
| 110 BLINK_EXPORT bool isNull() const; |
| 111 |
| 106 BLINK_EXPORT WebCryptoAlgorithmId id() const; | 112 BLINK_EXPORT WebCryptoAlgorithmId id() const; |
| 107 | 113 |
| 108 BLINK_EXPORT WebCryptoAlgorithmParamsType paramsType() const; | 114 BLINK_EXPORT WebCryptoAlgorithmParamsType paramsType() const; |
| 109 | 115 |
| 110 // Retrieves the type-specific parameters. The algorithm contains at most 1 | 116 // Retrieves the type-specific parameters. The algorithm contains at most 1 |
| 111 // type of parameters. Retrieving an invalid parameter will return 0. | 117 // type of parameters. Retrieving an invalid parameter will return 0. |
| 112 BLINK_EXPORT const WebCryptoAesCbcParams* aesCbcParams() const; | 118 BLINK_EXPORT const WebCryptoAesCbcParams* aesCbcParams() const; |
| 113 BLINK_EXPORT const WebCryptoAesKeyGenParams* aesKeyGenParams() const; | 119 BLINK_EXPORT const WebCryptoAesKeyGenParams* aesKeyGenParams() const; |
| 114 BLINK_EXPORT const WebCryptoHmacParams* hmacParams() const; | 120 BLINK_EXPORT const WebCryptoHmacParams* hmacParams() const; |
| 115 BLINK_EXPORT const WebCryptoHmacKeyParams* hmacKeyParams() const; | 121 BLINK_EXPORT const WebCryptoHmacKeyParams* hmacKeyParams() const; |
| 116 BLINK_EXPORT const WebCryptoRsaSsaParams* rsaSsaParams() const; | 122 BLINK_EXPORT const WebCryptoRsaSsaParams* rsaSsaParams() const; |
| 117 BLINK_EXPORT const WebCryptoRsaKeyGenParams* rsaKeyGenParams() const; | 123 BLINK_EXPORT const WebCryptoRsaKeyGenParams* rsaKeyGenParams() const; |
| 118 BLINK_EXPORT const WebCryptoAesGcmParams* aesGcmParams() const; | 124 BLINK_EXPORT const WebCryptoAesGcmParams* aesGcmParams() const; |
| 119 BLINK_EXPORT const WebCryptoRsaOaepParams* rsaOaepParams() const; | 125 BLINK_EXPORT const WebCryptoRsaOaepParams* rsaOaepParams() const; |
| 120 | 126 |
| 121 private: | 127 private: |
| 122 BLINK_EXPORT void assign(const WebCryptoAlgorithm& other); | 128 BLINK_EXPORT void assign(const WebCryptoAlgorithm& other); |
| 123 BLINK_EXPORT void reset(); | 129 BLINK_EXPORT void reset(); |
| 124 | 130 |
| 125 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; | 131 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; |
| 126 }; | 132 }; |
| 127 | 133 |
| 128 } // namespace WebKit | 134 } // namespace WebKit |
| 129 | 135 |
| 130 #endif | 136 #endif |
| OLD | NEW |