| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 WebCryptoAlgorithmIdSha384, | 64 WebCryptoAlgorithmIdSha384, |
| 65 WebCryptoAlgorithmIdSha512, | 65 WebCryptoAlgorithmIdSha512, |
| 66 WebCryptoAlgorithmIdAesGcm, | 66 WebCryptoAlgorithmIdAesGcm, |
| 67 WebCryptoAlgorithmIdRsaOaep, | 67 WebCryptoAlgorithmIdRsaOaep, |
| 68 WebCryptoAlgorithmIdAesCtr, | 68 WebCryptoAlgorithmIdAesCtr, |
| 69 WebCryptoAlgorithmIdAesKw, | 69 WebCryptoAlgorithmIdAesKw, |
| 70 WebCryptoAlgorithmIdRsaPss, | 70 WebCryptoAlgorithmIdRsaPss, |
| 71 WebCryptoAlgorithmIdEcdsa, | 71 WebCryptoAlgorithmIdEcdsa, |
| 72 WebCryptoAlgorithmIdEcdh, | 72 WebCryptoAlgorithmIdEcdh, |
| 73 WebCryptoAlgorithmIdHkdf, | 73 WebCryptoAlgorithmIdHkdf, |
| 74 WebCryptoAlgorithmIdPbkdf2, |
| 74 #if INSIDE_BLINK | 75 #if INSIDE_BLINK |
| 75 WebCryptoAlgorithmIdLast = WebCryptoAlgorithmIdHkdf, | 76 WebCryptoAlgorithmIdLast = WebCryptoAlgorithmIdPbkdf2, |
| 76 #endif | 77 #endif |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 enum WebCryptoNamedCurve { | 80 enum WebCryptoNamedCurve { |
| 80 WebCryptoNamedCurveP256, | 81 WebCryptoNamedCurveP256, |
| 81 WebCryptoNamedCurveP384, | 82 WebCryptoNamedCurveP384, |
| 82 WebCryptoNamedCurveP521, | 83 WebCryptoNamedCurveP521, |
| 83 #if INSIDE_BLINK | 84 #if INSIDE_BLINK |
| 84 WebCryptoNamedCurveLast = WebCryptoNamedCurveP521, | 85 WebCryptoNamedCurveLast = WebCryptoNamedCurveP521, |
| 85 #endif | 86 #endif |
| (...skipping 10 matching lines...) Expand all Loading... |
| 96 WebCryptoAlgorithmParamsTypeAesGcmParams, | 97 WebCryptoAlgorithmParamsTypeAesGcmParams, |
| 97 WebCryptoAlgorithmParamsTypeRsaOaepParams, | 98 WebCryptoAlgorithmParamsTypeRsaOaepParams, |
| 98 WebCryptoAlgorithmParamsTypeAesCtrParams, | 99 WebCryptoAlgorithmParamsTypeAesCtrParams, |
| 99 WebCryptoAlgorithmParamsTypeRsaPssParams, | 100 WebCryptoAlgorithmParamsTypeRsaPssParams, |
| 100 WebCryptoAlgorithmParamsTypeEcdsaParams, | 101 WebCryptoAlgorithmParamsTypeEcdsaParams, |
| 101 WebCryptoAlgorithmParamsTypeEcKeyGenParams, | 102 WebCryptoAlgorithmParamsTypeEcKeyGenParams, |
| 102 WebCryptoAlgorithmParamsTypeEcKeyImportParams, | 103 WebCryptoAlgorithmParamsTypeEcKeyImportParams, |
| 103 WebCryptoAlgorithmParamsTypeEcdhKeyDeriveParams, | 104 WebCryptoAlgorithmParamsTypeEcdhKeyDeriveParams, |
| 104 WebCryptoAlgorithmParamsTypeAesDerivedKeyParams, | 105 WebCryptoAlgorithmParamsTypeAesDerivedKeyParams, |
| 105 WebCryptoAlgorithmParamsTypeHkdfParams, | 106 WebCryptoAlgorithmParamsTypeHkdfParams, |
| 107 WebCryptoAlgorithmParamsTypePbkdf2Params, |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 struct WebCryptoAlgorithmInfo { | 110 struct WebCryptoAlgorithmInfo { |
| 109 typedef char ParamsTypeOrUndefined; | 111 typedef char ParamsTypeOrUndefined; |
| 110 static const ParamsTypeOrUndefined Undefined = -1; | 112 static const ParamsTypeOrUndefined Undefined = -1; |
| 111 | 113 |
| 112 // The canonical (case-sensitive) name for the algorithm as a | 114 // The canonical (case-sensitive) name for the algorithm as a |
| 113 // null-terminated C-string literal. | 115 // null-terminated C-string literal. |
| 114 const char* name; | 116 const char* name; |
| 115 | 117 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 128 class WebCryptoAesCtrParams; | 130 class WebCryptoAesCtrParams; |
| 129 class WebCryptoRsaHashedKeyGenParams; | 131 class WebCryptoRsaHashedKeyGenParams; |
| 130 class WebCryptoRsaHashedImportParams; | 132 class WebCryptoRsaHashedImportParams; |
| 131 class WebCryptoRsaPssParams; | 133 class WebCryptoRsaPssParams; |
| 132 class WebCryptoEcdsaParams; | 134 class WebCryptoEcdsaParams; |
| 133 class WebCryptoEcKeyGenParams; | 135 class WebCryptoEcKeyGenParams; |
| 134 class WebCryptoEcKeyImportParams; | 136 class WebCryptoEcKeyImportParams; |
| 135 class WebCryptoEcdhKeyDeriveParams; | 137 class WebCryptoEcdhKeyDeriveParams; |
| 136 class WebCryptoAesDerivedKeyParams; | 138 class WebCryptoAesDerivedKeyParams; |
| 137 class WebCryptoHkdfParams; | 139 class WebCryptoHkdfParams; |
| 140 class WebCryptoPbkdf2Params; |
| 138 | 141 |
| 139 class WebCryptoAlgorithmParams; | 142 class WebCryptoAlgorithmParams; |
| 140 class WebCryptoAlgorithmPrivate; | 143 class WebCryptoAlgorithmPrivate; |
| 141 | 144 |
| 142 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. | 145 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. |
| 143 // * Immutable | 146 // * Immutable |
| 144 // * Threadsafe | 147 // * Threadsafe |
| 145 // * Copiable (cheaply) | 148 // * Copiable (cheaply) |
| 146 // | 149 // |
| 147 // If WebCryptoAlgorithm "isNull()" then it is invalid to call any of the other | 150 // If WebCryptoAlgorithm "isNull()" then it is invalid to call any of the other |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 BLINK_PLATFORM_EXPORT const WebCryptoAesCtrParams* aesCtrParams() const; | 190 BLINK_PLATFORM_EXPORT const WebCryptoAesCtrParams* aesCtrParams() const; |
| 188 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedImportParams* rsaHashedImportP
arams() const; | 191 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedImportParams* rsaHashedImportP
arams() const; |
| 189 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedKeyGenParams* rsaHashedKeyGenP
arams() const; | 192 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedKeyGenParams* rsaHashedKeyGenP
arams() const; |
| 190 BLINK_PLATFORM_EXPORT const WebCryptoRsaPssParams* rsaPssParams() const; | 193 BLINK_PLATFORM_EXPORT const WebCryptoRsaPssParams* rsaPssParams() const; |
| 191 BLINK_PLATFORM_EXPORT const WebCryptoEcdsaParams* ecdsaParams() const; | 194 BLINK_PLATFORM_EXPORT const WebCryptoEcdsaParams* ecdsaParams() const; |
| 192 BLINK_PLATFORM_EXPORT const WebCryptoEcKeyGenParams* ecKeyGenParams() const; | 195 BLINK_PLATFORM_EXPORT const WebCryptoEcKeyGenParams* ecKeyGenParams() const; |
| 193 BLINK_PLATFORM_EXPORT const WebCryptoEcKeyImportParams* ecKeyImportParams()
const; | 196 BLINK_PLATFORM_EXPORT const WebCryptoEcKeyImportParams* ecKeyImportParams()
const; |
| 194 BLINK_PLATFORM_EXPORT const WebCryptoEcdhKeyDeriveParams* ecdhKeyDeriveParam
s() const; | 197 BLINK_PLATFORM_EXPORT const WebCryptoEcdhKeyDeriveParams* ecdhKeyDeriveParam
s() const; |
| 195 BLINK_PLATFORM_EXPORT const WebCryptoAesDerivedKeyParams* aesDerivedKeyParam
s() const; | 198 BLINK_PLATFORM_EXPORT const WebCryptoAesDerivedKeyParams* aesDerivedKeyParam
s() const; |
| 196 BLINK_PLATFORM_EXPORT const WebCryptoHkdfParams* hkdfParams() const; | 199 BLINK_PLATFORM_EXPORT const WebCryptoHkdfParams* hkdfParams() const; |
| 200 BLINK_PLATFORM_EXPORT const WebCryptoPbkdf2Params* pbkdf2Params() const; |
| 197 | 201 |
| 198 // Returns true if the provided algorithm ID is for a hash (in other words,
SHA-*) | 202 // Returns true if the provided algorithm ID is for a hash (in other words,
SHA-*) |
| 199 BLINK_PLATFORM_EXPORT static bool isHash(WebCryptoAlgorithmId); | 203 BLINK_PLATFORM_EXPORT static bool isHash(WebCryptoAlgorithmId); |
| 200 // Returns true if the provided algorithm ID is for a key derivation functio
n | 204 // Returns true if the provided algorithm ID is for a key derivation functio
n |
| 201 BLINK_PLATFORM_EXPORT static bool isKdf(WebCryptoAlgorithmId); | 205 BLINK_PLATFORM_EXPORT static bool isKdf(WebCryptoAlgorithmId); |
| 202 | 206 |
| 203 private: | 207 private: |
| 204 BLINK_PLATFORM_EXPORT void assign(const WebCryptoAlgorithm& other); | 208 BLINK_PLATFORM_EXPORT void assign(const WebCryptoAlgorithm& other); |
| 205 BLINK_PLATFORM_EXPORT void reset(); | 209 BLINK_PLATFORM_EXPORT void reset(); |
| 206 | 210 |
| 207 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; | 211 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; |
| 208 }; | 212 }; |
| 209 | 213 |
| 210 } // namespace blink | 214 } // namespace blink |
| 211 | 215 |
| 212 #endif | 216 #endif |
| OLD | NEW |