1. 13 Dec, 2013 1 commit
    • ap@apple.com's avatar
      WebCrypto Key.usages should be ordered alphabetically · 20890d48
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=125696
      
      Reviewed by Darin Adler.
      
      Source/WebCore: 
      
      * crypto/CryptoKey.cpp: (WebCore::CryptoKey::usages): Do it.
      
      LayoutTests: 
      
      * crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-192-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-generate-key-expected.txt:
      * crypto/subtle/aes-cbc-generate-key.html:
      * crypto/subtle/aes-cbc-invalid-length-expected.txt:
      * crypto/subtle/aes-cbc-invalid-length.html:
      * crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt:
      * crypto/subtle/aes-kw-wrap-unwrap-aes.html:
      * crypto/subtle/aes-postMessage-expected.txt:
      * crypto/subtle/aes-postMessage.html:
      * crypto/subtle/hmac-postMessage-expected.txt:
      * crypto/subtle/hmac-postMessage.html:
      * crypto/subtle/jwk-import-use-values-expected.txt:
      * crypto/subtle/jwk-import-use-values.html:
      * crypto/subtle/postMessage-worker-expected.txt:
      * crypto/subtle/postMessage-worker.html:
      * crypto/subtle/resources/postMessage-worker.js:
      (onmessage):
      * crypto/subtle/rsa-oaep-key-manipulation-expected.txt:
      * crypto/subtle/rsa-oaep-key-manipulation.html:
      * crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt:
      * crypto/subtle/rsa-oaep-wrap-unwrap-aes.html:
      * crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes-expected.txt:
      * crypto/subtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      20890d48
  2. 12 Dec, 2013 1 commit
    • ap@apple.com's avatar
      Make algorithm.name return registered name, not normalized one · 8199d8e9
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=125641
      
      Reviewed by Anders Carlsson.
      
      Source/WebCore: 
      
      Currently, WebCrypto editor's draft stipulates that algorithm name is lowercased
      as part of normalization.
      
      But it makes little sense to register algorithms as mixed (mostly upper) case, yet
      return the name lowercased. Other implementations don't bother respecting this,
      and signs are that the spec will change.
      
      I'd like to match other implementations here, because sticking to the spec only
      makes us fail 3rd party test suites for no good reason.
      
      Updated many existing tests.
      
      * crypto/CryptoAlgorithmRegistry.cpp:
      (WebCore::CryptoAlgorithmRegistry::getIdentifierForName):
      (WebCore::CryptoAlgorithmRegistry::registerAlgorithm):
      * crypto/CryptoAlgorithmRegistry.h:
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
      * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
      * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
      * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
      * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
      * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
      * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
      * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
      
      LayoutTests: 
      
      * crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-192-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-generate-key-expected.txt:
      * crypto/subtle/aes-cbc-generate-key.html:
      * crypto/subtle/aes-cbc-import-jwk-expected.txt:
      * crypto/subtle/aes-cbc-import-jwk.html:
      * crypto/subtle/aes-cbc-invalid-length-expected.txt:
      * crypto/subtle/aes-cbc-invalid-length.html:
      * crypto/subtle/aes-cbc-unwrap-failure-expected.txt:
      * crypto/subtle/aes-cbc-unwrap-failure.html:
      * crypto/subtle/aes-cbc-unwrap-rsa-expected.txt:
      * crypto/subtle/aes-cbc-unwrap-rsa.html:
      * crypto/subtle/aes-cbc-wrap-rsa-expected.txt:
      * crypto/subtle/aes-cbc-wrap-rsa-non-extractable-expected.txt:
      * crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html:
      * crypto/subtle/aes-cbc-wrap-rsa.html:
      * crypto/subtle/aes-kw-key-manipulation-expected.txt:
      * crypto/subtle/aes-kw-key-manipulation.html:
      * crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt:
      * crypto/subtle/aes-kw-wrap-unwrap-aes.html:
      * crypto/subtle/aes-postMessage-expected.txt:
      * crypto/subtle/aes-postMessage.html:
      * crypto/subtle/hmac-generate-key-expected.txt:
      * crypto/subtle/hmac-generate-key.html:
      * crypto/subtle/hmac-import-jwk-expected.txt:
      * crypto/subtle/hmac-import-jwk.html:
      * crypto/subtle/hmac-postMessage-expected.txt:
      * crypto/subtle/hmac-postMessage.html:
      * crypto/subtle/hmac-sign-verify-empty-key-expected.txt:
      * crypto/subtle/hmac-sign-verify-empty-key.html:
      * crypto/subtle/hmac-sign-verify-expected.txt:
      * crypto/subtle/hmac-sign-verify.html:
      * crypto/subtle/postMessage-worker-expected.txt:
      * crypto/subtle/postMessage-worker.html:
      * crypto/subtle/resources/postMessage-worker.js:
      * crypto/subtle/rsa-oaep-key-manipulation-expected.txt:
      * crypto/subtle/rsa-oaep-key-manipulation.html:
      * crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt:
      * crypto/subtle/rsa-oaep-wrap-unwrap-aes.html:
      * crypto/subtle/rsa-postMessage-expected.txt:
      * crypto/subtle/rsa-postMessage.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt:
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt:
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160491 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8199d8e9
  3. 04 Dec, 2013 1 commit
    • ap@apple.com's avatar
      Update WebCrypto JWK mapping to newer proposal · e6074e79
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124218
      
      Reviewed by Anders Carlsson.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/jwk-export-use-values.html
             crypto/subtle/jwk-import-use-values.html
      
      1. "extractable" renamed to "ext" in JWK.
      2. New values for "use" mapping, which can now be combined into comma separated lists,
      and cover all possible WebCrypto usages.
      
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::reconcileUsages):
      (WebCore::JSCryptoKeySerializationJWK::reconcileExtractable):
      (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON):
      (WebCore::processUseValue):
      (WebCore::JSCryptoKeySerializationJWK::addJWKUseToJSON):
      (WebCore::JSCryptoKeySerializationJWK::serialize):
      
      LayoutTests: 
      
      * crypto/subtle/jwk-export-use-values-expected.txt: Added.
      * crypto/subtle/jwk-export-use-values.html: Added.
      * crypto/subtle/jwk-import-use-values-expected.txt: Added.
      * crypto/subtle/jwk-import-use-values.html: Added.
      New tests for "use" mapping.
      
      * crypto/subtle/aes-cbc-import-jwk.html:
      * crypto/subtle/aes-cbc-unwrap-rsa.html:
      * crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html:
      * crypto/subtle/aes-cbc-wrap-rsa.html:
      * 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/hmac-import-jwk.html:
      * crypto/subtle/import-jwk-expected.txt:
      * crypto/subtle/import-jwk.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:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e6074e79
  4. 02 Dec, 2013 1 commit
    • ap@apple.com's avatar
      Add support for WebCrypto RSA-OAEP · a3d6e70d
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=125084
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/rsa-oaep-key-manipulation.html
             crypto/subtle/rsa-oaep-plaintext-length.html
             crypto/subtle/rsa-oaep-wrap-unwrap-aes.html
      
      * WebCore.xcodeproj/project.pbxproj: Added new files.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createRsaOaepParams):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
      Added RSA-OAEP parameters.
      
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm):
      (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid):
      (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON):
      Support RSA-OAEP in JWK. It is more limited than general WebCrypto, as JWK only
      allows SHA-1 as hash.
      
      * crypto/CommonCryptoUtilities.cpp: Added. (WebCore::getCommonCryptoDigestAlgorithm):
      * crypto/CommonCryptoUtilities.h: Added.
      Extracted some shared code and forward declarations for CommonCrypto.
      
      * crypto/CryptoAlgorithmParameters.h: (WebCore::CryptoAlgorithmParameters::Class):
      * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: Added.
      Added RsaOaepParams.
      
      * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: Added.
      * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: Added.
      * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: Added.
      
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::getCommonCryptoHMACAlgorithm):
      (WebCore::CryptoAlgorithmHMAC::platformSign):
      (WebCore::CryptoAlgorithmHMAC::platformVerify):
      * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
      * crypto/mac/CryptoKeyMac.cpp:
      * crypto/mac/CryptoKeyRSAMac.cpp:
      Use CommonCryptoUtilities.
      
      * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
      (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register RSA-OAEP.
      
      LayoutTests: 
      
      * crypto/subtle/rsa-oaep-key-manipulation-expected.txt: Added.
      * crypto/subtle/rsa-oaep-key-manipulation.html: Added.
      * crypto/subtle/rsa-oaep-plaintext-length-expected.txt: Added.
      * crypto/subtle/rsa-oaep-plaintext-length.html: Added.
      * crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt: Added.
      * crypto/subtle/rsa-oaep-wrap-unwrap-aes.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a3d6e70d