haikuwebkit/LayoutTests/crypto/subtle/rsa-oaep-decrypt-malformed-...

11 lines
344 B
Plaintext
Raw Permalink Normal View History

Update SubtleCrypto::decrypt to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164739 <rdar://problem/29257848> Reviewed by Brent Fulgham. LayoutTests/imported/w3c: * WebCryptoAPI/encrypt_decrypt/test_aes_cbc-expected.txt: * WebCryptoAPI/idlharness-expected.txt: Source/WebCore: This patch does following few things: 1. It updates the SubtleCrypto::decrypt method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-decrypt. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-decrypt. 2. It implements decrypt operations of the following algorithms: AES-CBC, RSAES-PKCS1-V1_5, and RSA-OAEP. Tests: crypto/subtle/aes-cbc-decrypt-malformed-parameters.html crypto/subtle/aes-cbc-generate-key-encrypt-decrypt.html crypto/subtle/aes-cbc-import-key-decrypt.html crypto/subtle/decrypt-malformed-parameters.html crypto/subtle/rsa-oaep-decrypt-malformed-parameters.html crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-label.html crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt.html crypto/subtle/rsa-oaep-import-key-decrypt-label.html crypto/subtle/rsa-oaep-import-key-decrypt.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key-encrypt-decrypt.html crypto/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html crypto/workers/subtle/aes-cbc-import-key-decrypt.html crypto/workers/subtle/rsa-oaep-import-key-decrypt.html crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::toCryptoKey): (WebCore::toVector): (WebCore::jsSubtleCryptoFunctionEncryptPromise): (WebCore::jsSubtleCryptoFunctionDecryptPromise): (WebCore::jsSubtleCryptoFunctionExportKeyPromise): (WebCore::JSSubtleCrypto::decrypt): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::decrypt): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::decrypt): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::decrypt): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: (WebCore::decryptRSAES_PKCS1_v1_5): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: (WebCore::decryptRSA_OAEP): (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): LayoutTests: * crypto/subtle/aes-cbc-decrypt-malformed-parameters-expected.txt: Added. * crypto/subtle/aes-cbc-decrypt-malformed-parameters.html: Added. * crypto/subtle/aes-cbc-generate-key-encrypt-decrypt-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-encrypt-decrypt.html: Added. * crypto/subtle/aes-cbc-import-key-decrypt-expected.txt: Added. * crypto/subtle/aes-cbc-import-key-decrypt.html: Added. * crypto/subtle/decrypt-malformed-parameters-expected.txt: Added. * crypto/subtle/decrypt-malformed-parameters.html: Added. * crypto/subtle/rsa-oaep-decrypt-malformed-parameters-expected.txt: Added. * crypto/subtle/rsa-oaep-decrypt-malformed-parameters.html: Added. * crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-expected.txt: Added. * crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-label-expected.txt: Added. * crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-label.html: Added. * crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt.html: Added. * crypto/subtle/rsa-oaep-import-key-decrypt-expected.txt: Added. * crypto/subtle/rsa-oaep-import-key-decrypt-label-expected.txt: Added. * crypto/subtle/rsa-oaep-import-key-decrypt-label.html: Added. * crypto/subtle/rsa-oaep-import-key-decrypt.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-encrypt-decrypt-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-encrypt-decrypt.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-import-key-decrypt-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html: Added. * crypto/workers/subtle/aes-cbc-import-key-decrypt-expected.txt: Added. * crypto/workers/subtle/aes-cbc-import-key-decrypt.html: Added. * crypto/workers/subtle/resources/aes-cbc-import-key-decrypt.js: Added. * crypto/workers/subtle/resources/rsa-oaep-import-key-decrypt.js: Added. * crypto/workers/subtle/resources/rsaes-pkcs1-v1_5-import-key-decrypt.js: Added. * crypto/workers/subtle/rsa-oaep-import-key-decrypt-expected.txt: Added. * crypto/workers/subtle/rsa-oaep-import-key-decrypt.html: Added. * crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-decrypt-expected.txt: Added. * crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html: Added. Canonical link: https://commits.webkit.org/182627@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-19 04:38:59 +00:00
Test decrypting using RSA-OAEP with malformed parameters
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS crypto.subtle.decrypt(rsaOaepParams, key, cipherText) rejected promise with OperationError: The operation failed for an operation-specific reason.
Update SubtleCrypto::decrypt to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164739 <rdar://problem/29257848> Reviewed by Brent Fulgham. LayoutTests/imported/w3c: * WebCryptoAPI/encrypt_decrypt/test_aes_cbc-expected.txt: * WebCryptoAPI/idlharness-expected.txt: Source/WebCore: This patch does following few things: 1. It updates the SubtleCrypto::decrypt method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-decrypt. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-decrypt. 2. It implements decrypt operations of the following algorithms: AES-CBC, RSAES-PKCS1-V1_5, and RSA-OAEP. Tests: crypto/subtle/aes-cbc-decrypt-malformed-parameters.html crypto/subtle/aes-cbc-generate-key-encrypt-decrypt.html crypto/subtle/aes-cbc-import-key-decrypt.html crypto/subtle/decrypt-malformed-parameters.html crypto/subtle/rsa-oaep-decrypt-malformed-parameters.html crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-label.html crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt.html crypto/subtle/rsa-oaep-import-key-decrypt-label.html crypto/subtle/rsa-oaep-import-key-decrypt.html crypto/subtle/rsaes-pkcs1-v1_5-generate-key-encrypt-decrypt.html crypto/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html crypto/workers/subtle/aes-cbc-import-key-decrypt.html crypto/workers/subtle/rsa-oaep-import-key-decrypt.html crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::toCryptoKey): (WebCore::toVector): (WebCore::jsSubtleCryptoFunctionEncryptPromise): (WebCore::jsSubtleCryptoFunctionDecryptPromise): (WebCore::jsSubtleCryptoFunctionExportKeyPromise): (WebCore::JSSubtleCrypto::decrypt): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::decrypt): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::decrypt): * crypto/algorithms/CryptoAlgorithmAES_CBC.h: * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::decrypt): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp: (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp: (WebCore::decryptRSAES_PKCS1_v1_5): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: (WebCore::decryptRSA_OAEP): (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): LayoutTests: * crypto/subtle/aes-cbc-decrypt-malformed-parameters-expected.txt: Added. * crypto/subtle/aes-cbc-decrypt-malformed-parameters.html: Added. * crypto/subtle/aes-cbc-generate-key-encrypt-decrypt-expected.txt: Added. * crypto/subtle/aes-cbc-generate-key-encrypt-decrypt.html: Added. * crypto/subtle/aes-cbc-import-key-decrypt-expected.txt: Added. * crypto/subtle/aes-cbc-import-key-decrypt.html: Added. * crypto/subtle/decrypt-malformed-parameters-expected.txt: Added. * crypto/subtle/decrypt-malformed-parameters.html: Added. * crypto/subtle/rsa-oaep-decrypt-malformed-parameters-expected.txt: Added. * crypto/subtle/rsa-oaep-decrypt-malformed-parameters.html: Added. * crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-expected.txt: Added. * crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-label-expected.txt: Added. * crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-label.html: Added. * crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt.html: Added. * crypto/subtle/rsa-oaep-import-key-decrypt-expected.txt: Added. * crypto/subtle/rsa-oaep-import-key-decrypt-label-expected.txt: Added. * crypto/subtle/rsa-oaep-import-key-decrypt-label.html: Added. * crypto/subtle/rsa-oaep-import-key-decrypt.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-encrypt-decrypt-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-generate-key-encrypt-decrypt.html: Added. * crypto/subtle/rsaes-pkcs1-v1_5-import-key-decrypt-expected.txt: Added. * crypto/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html: Added. * crypto/workers/subtle/aes-cbc-import-key-decrypt-expected.txt: Added. * crypto/workers/subtle/aes-cbc-import-key-decrypt.html: Added. * crypto/workers/subtle/resources/aes-cbc-import-key-decrypt.js: Added. * crypto/workers/subtle/resources/rsa-oaep-import-key-decrypt.js: Added. * crypto/workers/subtle/resources/rsaes-pkcs1-v1_5-import-key-decrypt.js: Added. * crypto/workers/subtle/rsa-oaep-import-key-decrypt-expected.txt: Added. * crypto/workers/subtle/rsa-oaep-import-key-decrypt.html: Added. * crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-decrypt-expected.txt: Added. * crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html: Added. Canonical link: https://commits.webkit.org/182627@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-19 04:38:59 +00:00
PASS successfullyParsed is true
TEST COMPLETE