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