haikuwebkit/LayoutTests/crypto/subtle/aes-ctr-import-raw-key-expe...

16 lines
393 B
Plaintext
Raw Permalink Normal View History

[WebCrypto] Add support for AES-CTR https://bugs.webkit.org/show_bug.cgi?id=169761 <rdar://problem/31331321> Reviewed by Brent Fulgham. LayoutTests/imported/w3c: * web-platform-tests/WebCryptoAPI/derive_bits_keys/pbkdf2.worker-expected.txt: * web-platform-tests/WebCryptoAPI/derive_bits_keys/test_pbkdf2-expected.txt: * web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_cbc.worker-expected.txt: * web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_ctr.worker-expected.txt: * web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_cbc-expected.txt: * web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_ctr-expected.txt: * web-platform-tests/WebCryptoAPI/generateKey/failures_AES-CTR.worker-expected.txt: * web-platform-tests/WebCryptoAPI/generateKey/successes_AES-CTR.worker-expected.txt: * web-platform-tests/WebCryptoAPI/generateKey/test_aes-ctr-expected.txt: * web-platform-tests/WebCryptoAPI/generateKey/test_failures_AES-CTR-expected.txt: * web-platform-tests/WebCryptoAPI/generateKey/test_successes_AES-CTR-expected.txt: * web-platform-tests/WebCryptoAPI/import_export/symmetric_importKey.worker-expected.txt: * web-platform-tests/WebCryptoAPI/import_export/test_symmetric_importKey-expected.txt: Source/WebCore: This patch adds support for AES-CTR. Operations of AES-CTR include: encrypt, decrypt, generateKey, importKey, exportKey, wrapKey, and unwrapKey. This implementation follows the latest WebCryptoAPI spec: https://www.w3.org/TR/WebCryptoAPI/#aes-ctr. Tests: crypto/subtle/aes-ctr-encrypt-malformed-parameters.html crypto/subtle/aes-ctr-encrypt-overflow.html crypto/subtle/aes-ctr-generate-export-key-jwk-length-128.html crypto/subtle/aes-ctr-generate-export-key-jwk-length-192.html crypto/subtle/aes-ctr-generate-export-key-jwk-length-256.html crypto/subtle/aes-ctr-generate-export-raw-key.html crypto/subtle/aes-ctr-generate-key-encrypt-decrypt.html crypto/subtle/aes-ctr-generate-key.html crypto/subtle/aes-ctr-import-jwk-key-length-128.html crypto/subtle/aes-ctr-import-jwk-key-length-192.html crypto/subtle/aes-ctr-import-jwk-key-length-256.html crypto/subtle/aes-ctr-import-key-decrypt.html crypto/subtle/aes-ctr-import-key-encrypt.html crypto/subtle/aes-ctr-import-key-unwrap-jwk-key.html crypto/subtle/aes-ctr-import-key-unwrap-raw-key.html crypto/subtle/aes-ctr-import-key-wrap-jwk-key.html crypto/subtle/aes-ctr-import-key-wrap-raw-key.html crypto/subtle/aes-ctr-import-raw-key.html crypto/workers/subtle/aes-ctr-import-key-decrypt.html crypto/workers/subtle/aes-ctr-import-key-encrypt.html crypto/workers/subtle/aes-ctr-import-key-unwrap-key.html crypto/workers/subtle/aes-ctr-import-key-wrap-key.html * CMakeLists.txt: * DerivedSources.make: * PlatformGTK.cmake: * PlatformMac.cmake: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): * crypto/CryptoAlgorithmParameters.h: * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp: Added. (WebCore::usagesAreInvalidForCryptoAlgorithmAES_CTR): (WebCore::parametersAreValid): (WebCore::CryptoAlgorithmAES_CTR::create): (WebCore::CryptoAlgorithmAES_CTR::identifier): (WebCore::CryptoAlgorithmAES_CTR::encrypt): (WebCore::CryptoAlgorithmAES_CTR::decrypt): (WebCore::CryptoAlgorithmAES_CTR::generateKey): (WebCore::CryptoAlgorithmAES_CTR::importKey): (WebCore::CryptoAlgorithmAES_CTR::exportKey): (WebCore::CryptoAlgorithmAES_CTR::getKeyLength): * crypto/algorithms/CryptoAlgorithmAES_CTR.h: Added. * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp: Added. (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt): (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp: Added. (WebCore::bigIntegerToSize): (WebCore::transformAES_CTR): (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt): (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt): * crypto/mac/CryptoAlgorithmRegistryMac.cpp: (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): * crypto/parameters/AesCtrParams.idl: Added. * crypto/parameters/CryptoAlgorithmAesCtrParams.h: Added. LayoutTests: * crypto/subtle/aes-ctr-encrypt-malformed-parameters-expected.txt: Added. * crypto/subtle/aes-ctr-encrypt-malformed-parameters.html: Added. * crypto/subtle/aes-ctr-generate-export-key-jwk-length-128-expected.txt: Added. * crypto/subtle/aes-ctr-generate-export-key-jwk-length-128.html: Added. * crypto/subtle/aes-ctr-generate-export-key-jwk-length-192-expected.txt: Added. * crypto/subtle/aes-ctr-generate-export-key-jwk-length-192.html: Added. * crypto/subtle/aes-ctr-generate-export-key-jwk-length-256-expected.txt: Added. * crypto/subtle/aes-ctr-generate-export-key-jwk-length-256.html: Added. * crypto/subtle/aes-ctr-generate-export-raw-key-expected.txt: Added. * crypto/subtle/aes-ctr-generate-export-raw-key.html: Added. * crypto/subtle/aes-ctr-generate-key-encrypt-decrypt-expected.txt: Added. * crypto/subtle/aes-ctr-generate-key-encrypt-decrypt.html: Added. * crypto/subtle/aes-ctr-generate-key-expected.txt: Added. * crypto/subtle/aes-ctr-generate-key.html: Added. * crypto/subtle/aes-ctr-import-jwk-key-length-128-expected.txt: Added. * crypto/subtle/aes-ctr-import-jwk-key-length-128.html: Added. * crypto/subtle/aes-ctr-import-jwk-key-length-192-expected.txt: Added. * crypto/subtle/aes-ctr-import-jwk-key-length-192.html: Added. * crypto/subtle/aes-ctr-import-jwk-key-length-256-expected.txt: Added. * crypto/subtle/aes-ctr-import-jwk-key-length-256.html: Added. * crypto/subtle/aes-ctr-import-key-decrypt-expected.txt: Added. * crypto/subtle/aes-ctr-import-key-decrypt.html: Added. * crypto/subtle/aes-ctr-import-key-encrypt-expected.txt: Added. * crypto/subtle/aes-ctr-import-key-encrypt.html: Added. * crypto/subtle/aes-ctr-import-key-unwrap-jwk-key-expected.txt: Added. * crypto/subtle/aes-ctr-import-key-unwrap-jwk-key.html: Added. * crypto/subtle/aes-ctr-import-key-unwrap-raw-key-expected.txt: Added. * crypto/subtle/aes-ctr-import-key-unwrap-raw-key.html: Added. * crypto/subtle/aes-ctr-import-key-wrap-jwk-key-expected.txt: Added. * crypto/subtle/aes-ctr-import-key-wrap-jwk-key.html: Added. * crypto/subtle/aes-ctr-import-key-wrap-raw-key-expected.txt: Added. * crypto/subtle/aes-ctr-import-key-wrap-raw-key.html: Added. * crypto/subtle/aes-ctr-import-raw-key-expected.txt: Added. * crypto/subtle/aes-ctr-import-raw-key.html: Added. * crypto/subtle/aes-generate-key-malformed-parameters-expected.txt: * crypto/subtle/aes-generate-key-malformed-parameters.html: * crypto/subtle/aes-import-key-malformed-parameters-expected.txt: * crypto/subtle/aes-import-key-malformed-parameters.html: * crypto/workers/subtle/aes-ctr-import-key-decrypt-expected.txt: Added. * crypto/workers/subtle/aes-ctr-import-key-decrypt.html: Added. * crypto/workers/subtle/aes-ctr-import-key-encrypt-expected.txt: Added. * crypto/workers/subtle/aes-ctr-import-key-encrypt.html: Added. * crypto/workers/subtle/aes-ctr-import-key-unwrap-key-expected.txt: Added. * crypto/workers/subtle/aes-ctr-import-key-unwrap-key.html: Added. * crypto/workers/subtle/aes-ctr-import-key-wrap-key-expected.txt: Added. * crypto/workers/subtle/aes-ctr-import-key-wrap-key.html: Added. * crypto/workers/subtle/resources/aes-ctr-import-key-decrypt.js: Added. * crypto/workers/subtle/resources/aes-ctr-import-key-encrypt.js: Added. * crypto/workers/subtle/resources/aes-ctr-import-key-unwrap-key.js: Added. * crypto/workers/subtle/resources/aes-ctr-import-key-wrap-key.js: Added. Canonical link: https://commits.webkit.org/187481@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215051 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-06 18:56:33 +00:00
Test importing a raw AES-CTR key with legnth 128
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Importing a key...
PASS key.type is 'secret'
PASS key.extractable is true
PASS key.algorithm.name is 'AES-CTR'
PASS key.algorithm.length is 128
PASS key.usages is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
PASS successfullyParsed is true
TEST COMPLETE