haikuwebkit/LayoutTests/crypto/subtle/hmac-import-key-sign-sha224...

11 lines
241 B
Plaintext
Raw Permalink Normal View History

Update SubtleCrypto::sign to match the latest spec https://bugs.webkit.org/show_bug.cgi?id=164740 <rdar://problem/29257864> Reviewed by Brent Fulgham. LayoutTests/imported/w3c: * WebCryptoAPI/idlharness-expected.txt: Source/WebCore: This patch does following few things: 1. It updates the SubtleCrypto::sign method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-sign. It also refers to the latest Editor's Draft to a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-sign. 2. It implements sign operations of the following algorithms: HMAC, and RSASSA-PKCS1-V1_5. 3. It also replaces promise.copyRef() with WTFMove(promise) for all the capture lists of exception callbacks in promise functions. Tests: crypto/subtle/hmac-import-key-sign-sha1.html crypto/subtle/hmac-import-key-sign-sha224.html crypto/subtle/hmac-import-key-sign-sha256.html crypto/subtle/hmac-import-key-sign-sha384.html crypto/subtle/hmac-import-key-sign-sha512.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html crypto/subtle/sign-malformed-parameters.html crypto/workers/subtle/hmac-import-key-sign.html crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::normalizeCryptoAlgorithmParameters): (WebCore::jsSubtleCryptoFunctionDecryptPromise): Fix a minor bug. (WebCore::jsSubtleCryptoFunctionEncryptPromise): (WebCore::jsSubtleCryptoFunctionDecryptPromise): (WebCore::jsSubtleCryptoFunctionSignPromise): (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): (WebCore::jsSubtleCryptoFunctionImportKeyPromise): (WebCore::jsSubtleCryptoFunctionExportKeyPromise): (WebCore::JSSubtleCrypto::sign): * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::sign): * crypto/CryptoAlgorithm.h: * crypto/SubtleCrypto.idl: * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::sign): * crypto/algorithms/CryptoAlgorithmHMAC.h: * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp: (WebCore::CryptoAlgorithmHMAC::platformSign): * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp: (WebCore::CryptoAlgorithmHMAC::platformSign): * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): * crypto/mac/CryptoAlgorithmHMACMac.cpp: (WebCore::commonCryptoHMACAlgorithm): (WebCore::calculateSignature): Remove a null guardance since the depending bug is resolved. (WebCore::CryptoAlgorithmHMAC::platformSign): (WebCore::CryptoAlgorithmHMAC::platformVerify): * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: (WebCore::signRSASSA_PKCS1_v1_5): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): LayoutTests: * crypto/subtle/hmac-import-key-sign-sha1-expected.txt: Added. * crypto/subtle/hmac-import-key-sign-sha1.html: Added. * crypto/subtle/hmac-import-key-sign-sha224-expected.txt: Added. * crypto/subtle/hmac-import-key-sign-sha224.html: Added. * crypto/subtle/hmac-import-key-sign-sha256-expected.txt: Added. * crypto/subtle/hmac-import-key-sign-sha256.html: Added. * crypto/subtle/hmac-import-key-sign-sha384-expected.txt: Added. * crypto/subtle/hmac-import-key-sign-sha384.html: Added. * crypto/subtle/hmac-import-key-sign-sha512-expected.txt: Added. * crypto/subtle/hmac-import-key-sign-sha512.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512-expected.txt: Added. * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html: Added. * crypto/subtle/sign-malformed-parameters-expected.txt: Added. * crypto/subtle/sign-malformed-parameters.html: Added. * crypto/workers/subtle/hmac-import-key-sign-expected.txt: Added. * crypto/workers/subtle/hmac-import-key-sign.html: Added. * crypto/workers/subtle/resources/hmac-import-key-sign.js: Added. * crypto/workers/subtle/resources/rsassa-pkcs1-v1_5-import-key-sign.js: Added. * crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign-expected.txt: Added. * crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html: Added. Canonical link: https://commits.webkit.org/182782@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-29 22:52:03 +00:00
Test signing with HMAC SHA-224 using an imported key
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS bytesToHexString(signature) is expectedSignature
PASS successfullyParsed is true
TEST COMPLETE