Update WebCrypto JWK mapping to use key_ops
https://bugs.webkit.org/show_bug.cgi?id=127609

Reviewed by Sam Weinig.

Source/WebCore:

Updated JWK support ot match current editor draft.

* bindings/js/JSCryptoKeySerializationJWK.cpp:
(WebCore::getJSArrayFromJSON): Fixed this previously untested function to actually work.
(WebCore::tryJWKKeyOpsValue):
(WebCore::JSCryptoKeySerializationJWK::reconcileUsages):
(WebCore::JSCryptoKeySerializationJWK::reconcileExtractable): Removed an old comment,
these things are now specced.
(WebCore::addToJSON): Made static functions file static, there is no reason for
them to be class members.
(WebCore::buildJSONForOctetSequence):
(WebCore::buildJSONForRSAComponents):
(WebCore::addBoolToJSON):
(WebCore::addJWKAlgorithmToJSON):
(WebCore::addUsagesToJSON):
(WebCore::JSCryptoKeySerializationJWK::serialize):
* bindings/js/JSCryptoKeySerializationJWK.h:

* crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
(WebCore::CryptoAlgorithmAES_KW::platformEncrypt):
(WebCore::CryptoAlgorithmAES_KW::platformDecrypt):
Check for length, so that we don't fail silently.

LayoutTests:

* crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt:
* crypto/subtle/aes-kw-wrap-unwrap-aes.html:
Removed a subtest for wrapping JWK. That doesn't really work per the spec, because
JWK is arbitatry length, and AES-KW requires 8*n bytes.

* crypto/subtle/aes-export-key-expected.txt:
* crypto/subtle/aes-export-key.html:
* crypto/subtle/hmac-export-key-expected.txt:
* crypto/subtle/hmac-export-key.html:
* crypto/subtle/jwk-export-use-values-expected.txt:
* crypto/subtle/jwk-export-use-values.html:
* crypto/subtle/jwk-import-use-values-expected.txt:
* crypto/subtle/jwk-import-use-values.html:
* crypto/subtle/rsa-export-key-expected.txt:
* crypto/subtle/rsa-export-key.html:
* crypto/subtle/rsa-export-private-key-expected.txt:
* crypto/subtle/rsa-export-private-key.html:
* crypto/subtle/rsa-oaep-key-manipulation-expected.txt:
* crypto/subtle/rsa-oaep-key-manipulation.html:
* crypto/subtle/rsa-postMessage-expected.txt:
* crypto/subtle/rsa-postMessage.html:
Updated for the fix.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163244 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed