| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ |
| 6 #define CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ |
| 7 | 7 |
| 8 #include <vector> |
| 8 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 10 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 11 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" |
| 11 #include "third_party/WebKit/public/platform/WebCrypto.h" | 12 #include "third_party/WebKit/public/platform/WebCrypto.h" |
| 12 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" | 13 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 enum EncryptOrDecrypt { ENCRYPT, DECRYPT }; | 17 enum EncryptOrDecrypt { ENCRYPT, DECRYPT }; |
| 17 | 18 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 171 |
| 171 // Preconditions: | 172 // Preconditions: |
| 172 // * |key| is non-null. | 173 // * |key| is non-null. |
| 173 Status ExportKeyRaw(SymKey* key, blink::WebArrayBuffer* buffer); | 174 Status ExportKeyRaw(SymKey* key, blink::WebArrayBuffer* buffer); |
| 174 | 175 |
| 175 // Preconditions: | 176 // Preconditions: |
| 176 // * |key| is non-null. | 177 // * |key| is non-null. |
| 177 Status ExportKeySpki(PublicKey* key, blink::WebArrayBuffer* buffer); | 178 Status ExportKeySpki(PublicKey* key, blink::WebArrayBuffer* buffer); |
| 178 | 179 |
| 179 // Preconditions: | 180 // Preconditions: |
| 181 // * |key| is non-null. |
| 182 Status ExportRsaPublicKey(PublicKey* key, |
| 183 std::vector<uint8>* modulus, |
| 184 std::vector<uint8>* public_exponent); |
| 185 |
| 186 // Preconditions: |
| 180 // * |wrapping_key| is non-null | 187 // * |wrapping_key| is non-null |
| 181 // * |key| is non-null | 188 // * |key| is non-null |
| 182 Status WrapSymKeyAesKw(SymKey* wrapping_key, | 189 Status WrapSymKeyAesKw(SymKey* wrapping_key, |
| 183 SymKey* key, | 190 SymKey* key, |
| 184 blink::WebArrayBuffer* buffer); | 191 blink::WebArrayBuffer* buffer); |
| 185 | 192 |
| 186 // Unwraps (decrypts) |wrapped_key_data| using AES-KW and places the results in | 193 // Unwraps (decrypts) |wrapped_key_data| using AES-KW and places the results in |
| 187 // a WebCryptoKey. Raw key data remains inside NSS. This function should be used | 194 // a WebCryptoKey. Raw key data remains inside NSS. This function should be used |
| 188 // when the input |wrapped_key_data| is known to result in symmetric raw key | 195 // when the input |wrapped_key_data| is known to result in symmetric raw key |
| 189 // data after AES-KW decryption. | 196 // data after AES-KW decryption. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 blink::WebCryptoKeyUsageMask usage_mask, | 235 blink::WebCryptoKeyUsageMask usage_mask, |
| 229 blink::WebCryptoKey* key); | 236 blink::WebCryptoKey* key); |
| 230 | 237 |
| 231 } // namespace platform | 238 } // namespace platform |
| 232 | 239 |
| 233 } // namespace webcrypto | 240 } // namespace webcrypto |
| 234 | 241 |
| 235 } // namespace content | 242 } // namespace content |
| 236 | 243 |
| 237 #endif // CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ | 244 #endif // CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ |
| OLD | NEW |