| 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 26 matching lines...) Expand all Loading... |
| 37 #if INSIDE_BLINK | 37 #if INSIDE_BLINK |
| 38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 enum WebCryptoAlgorithmId { | 43 enum WebCryptoAlgorithmId { |
| 44 WebCryptoAlgorithmIdAesCbc, | 44 WebCryptoAlgorithmIdAesCbc, |
| 45 WebCryptoAlgorithmIdHmac, | 45 WebCryptoAlgorithmIdHmac, |
| 46 WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, | 46 WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
| 47 WebCryptoAlgorithmIdRsaEsPkcs1v1_5, | |
| 48 WebCryptoAlgorithmIdSha1, | 47 WebCryptoAlgorithmIdSha1, |
| 49 WebCryptoAlgorithmIdSha256, | 48 WebCryptoAlgorithmIdSha256, |
| 50 WebCryptoAlgorithmIdSha384, | 49 WebCryptoAlgorithmIdSha384, |
| 51 WebCryptoAlgorithmIdSha512, | 50 WebCryptoAlgorithmIdSha512, |
| 52 WebCryptoAlgorithmIdAesGcm, | 51 WebCryptoAlgorithmIdAesGcm, |
| 53 WebCryptoAlgorithmIdRsaOaep, | 52 WebCryptoAlgorithmIdRsaOaep, |
| 54 WebCryptoAlgorithmIdAesCtr, | 53 WebCryptoAlgorithmIdAesCtr, |
| 55 WebCryptoAlgorithmIdAesKw, | 54 WebCryptoAlgorithmIdAesKw, |
| 56 #if INSIDE_BLINK | 55 #if INSIDE_BLINK |
| 57 WebCryptoAlgorithmIdLast = WebCryptoAlgorithmIdAesKw, | 56 WebCryptoAlgorithmIdLast = WebCryptoAlgorithmIdAesKw, |
| 58 #endif | 57 #endif |
| 59 }; | 58 }; |
| 60 | 59 |
| 61 enum WebCryptoAlgorithmParamsType { | 60 enum WebCryptoAlgorithmParamsType { |
| 62 WebCryptoAlgorithmParamsTypeNone, | 61 WebCryptoAlgorithmParamsTypeNone, |
| 63 WebCryptoAlgorithmParamsTypeAesCbcParams, | 62 WebCryptoAlgorithmParamsTypeAesCbcParams, |
| 64 WebCryptoAlgorithmParamsTypeAesKeyGenParams, | 63 WebCryptoAlgorithmParamsTypeAesKeyGenParams, |
| 65 WebCryptoAlgorithmParamsTypeHmacImportParams, | 64 WebCryptoAlgorithmParamsTypeHmacImportParams, |
| 66 WebCryptoAlgorithmParamsTypeHmacKeyGenParams, | 65 WebCryptoAlgorithmParamsTypeHmacKeyGenParams, |
| 67 WebCryptoAlgorithmParamsTypeRsaKeyGenParams, | |
| 68 WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, | 66 WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, |
| 69 WebCryptoAlgorithmParamsTypeRsaHashedImportParams, | 67 WebCryptoAlgorithmParamsTypeRsaHashedImportParams, |
| 70 WebCryptoAlgorithmParamsTypeAesGcmParams, | 68 WebCryptoAlgorithmParamsTypeAesGcmParams, |
| 71 WebCryptoAlgorithmParamsTypeRsaOaepParams, | 69 WebCryptoAlgorithmParamsTypeRsaOaepParams, |
| 72 WebCryptoAlgorithmParamsTypeAesCtrParams, | 70 WebCryptoAlgorithmParamsTypeAesCtrParams, |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 class WebCryptoAesCbcParams; | 73 class WebCryptoAesCbcParams; |
| 76 class WebCryptoAesKeyGenParams; | 74 class WebCryptoAesKeyGenParams; |
| 77 class WebCryptoHmacImportParams; | 75 class WebCryptoHmacImportParams; |
| 78 class WebCryptoHmacKeyGenParams; | 76 class WebCryptoHmacKeyGenParams; |
| 79 class WebCryptoRsaKeyGenParams; | |
| 80 class WebCryptoAesGcmParams; | 77 class WebCryptoAesGcmParams; |
| 81 class WebCryptoRsaOaepParams; | 78 class WebCryptoRsaOaepParams; |
| 82 class WebCryptoAesCtrParams; | 79 class WebCryptoAesCtrParams; |
| 83 class WebCryptoRsaHashedKeyGenParams; | 80 class WebCryptoRsaHashedKeyGenParams; |
| 84 class WebCryptoRsaHashedImportParams; | 81 class WebCryptoRsaHashedImportParams; |
| 85 | 82 |
| 86 class WebCryptoAlgorithmParams; | 83 class WebCryptoAlgorithmParams; |
| 87 class WebCryptoAlgorithmPrivate; | 84 class WebCryptoAlgorithmPrivate; |
| 88 | 85 |
| 89 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. | 86 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 117 BLINK_PLATFORM_EXPORT WebCryptoAlgorithmId id() const; | 114 BLINK_PLATFORM_EXPORT WebCryptoAlgorithmId id() const; |
| 118 | 115 |
| 119 BLINK_PLATFORM_EXPORT WebCryptoAlgorithmParamsType paramsType() const; | 116 BLINK_PLATFORM_EXPORT WebCryptoAlgorithmParamsType paramsType() const; |
| 120 | 117 |
| 121 // Retrieves the type-specific parameters. The algorithm contains at most 1 | 118 // Retrieves the type-specific parameters. The algorithm contains at most 1 |
| 122 // type of parameters. Retrieving an invalid parameter will return 0. | 119 // type of parameters. Retrieving an invalid parameter will return 0. |
| 123 BLINK_PLATFORM_EXPORT const WebCryptoAesCbcParams* aesCbcParams() const; | 120 BLINK_PLATFORM_EXPORT const WebCryptoAesCbcParams* aesCbcParams() const; |
| 124 BLINK_PLATFORM_EXPORT const WebCryptoAesKeyGenParams* aesKeyGenParams() cons
t; | 121 BLINK_PLATFORM_EXPORT const WebCryptoAesKeyGenParams* aesKeyGenParams() cons
t; |
| 125 BLINK_PLATFORM_EXPORT const WebCryptoHmacImportParams* hmacImportParams() co
nst; | 122 BLINK_PLATFORM_EXPORT const WebCryptoHmacImportParams* hmacImportParams() co
nst; |
| 126 BLINK_PLATFORM_EXPORT const WebCryptoHmacKeyGenParams* hmacKeyGenParams() co
nst; | 123 BLINK_PLATFORM_EXPORT const WebCryptoHmacKeyGenParams* hmacKeyGenParams() co
nst; |
| 127 BLINK_PLATFORM_EXPORT const WebCryptoRsaKeyGenParams* rsaKeyGenParams() cons
t; | |
| 128 BLINK_PLATFORM_EXPORT const WebCryptoAesGcmParams* aesGcmParams() const; | 124 BLINK_PLATFORM_EXPORT const WebCryptoAesGcmParams* aesGcmParams() const; |
| 129 BLINK_PLATFORM_EXPORT const WebCryptoRsaOaepParams* rsaOaepParams() const; | 125 BLINK_PLATFORM_EXPORT const WebCryptoRsaOaepParams* rsaOaepParams() const; |
| 130 BLINK_PLATFORM_EXPORT const WebCryptoAesCtrParams* aesCtrParams() const; | 126 BLINK_PLATFORM_EXPORT const WebCryptoAesCtrParams* aesCtrParams() const; |
| 131 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedImportParams* rsaHashedImportP
arams() const; | 127 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedImportParams* rsaHashedImportP
arams() const; |
| 132 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedKeyGenParams* rsaHashedKeyGenP
arams() const; | 128 BLINK_PLATFORM_EXPORT const WebCryptoRsaHashedKeyGenParams* rsaHashedKeyGenP
arams() const; |
| 133 | 129 |
| 134 // Returns true if the provided algorithm ID is for a hash (in other words,
SHA-*) | 130 // Returns true if the provided algorithm ID is for a hash (in other words,
SHA-*) |
| 135 BLINK_PLATFORM_EXPORT static bool isHash(WebCryptoAlgorithmId); | 131 BLINK_PLATFORM_EXPORT static bool isHash(WebCryptoAlgorithmId); |
| 136 | 132 |
| 137 private: | 133 private: |
| 138 BLINK_PLATFORM_EXPORT void assign(const WebCryptoAlgorithm& other); | 134 BLINK_PLATFORM_EXPORT void assign(const WebCryptoAlgorithm& other); |
| 139 BLINK_PLATFORM_EXPORT void reset(); | 135 BLINK_PLATFORM_EXPORT void reset(); |
| 140 | 136 |
| 141 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; | 137 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; |
| 142 }; | 138 }; |
| 143 | 139 |
| 144 } // namespace blink | 140 } // namespace blink |
| 145 | 141 |
| 146 #endif | 142 #endif |
| OLD | NEW |