1. 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
  2. 21 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Implement WebCrypto wrapKey · abd0bbca
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124738
      
      Reviewed by Anders Carlsson.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html
             crypto/subtle/aes-cbc-wrap-rsa.html
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::exportKey): Factored out the actual operation that can be chained with
      encryption for wrapKey.
      (WebCore::JSSubtleCrypto::exportKey):
      (WebCore::JSSubtleCrypto::wrapKey):
      (WebCore::JSSubtleCrypto::unwrapKey): Fixed a memory leak in failure code path.
      
      * crypto/SubtleCrypto.idl: Added wrapKey.
      
      LayoutTests: 
      
      * crypto/subtle/aes-cbc-wrap-rsa-expected.txt: Added.
      * crypto/subtle/aes-cbc-wrap-rsa-non-extractable-expected.txt: Added.
      * crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html: Added.
      * crypto/subtle/aes-cbc-wrap-rsa.html: Added.
      
      * crypto/subtle/aes-export-key-expected.txt:
      * crypto/subtle/hmac-export-key-expected.txt:
      There is no longer a console message, the error is in an exception.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      abd0bbca
  3. 16 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Support exporting symmetric keys as JWK · ca827605
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124442
      
      Reviewed by Sam Weinig.
      
      Source/JavaScriptCore: 
      
      * runtime/JSONObject.h: Export JSONStringify.
      
      Source/WebCore: 
      
      Error handling is not consistent yet - some errors cause exceptions, and others
      result in rejected promises. This part of spec is incomplete, so I basically did
      what was most straightforward in each case.
      
      * bindings/js/JSCryptoKeySerializationJWK.h: 
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::reconcileUsages): Updated a comment with a better link.
      (WebCore::JSCryptoKeySerializationJWK::buildJSONForOctetSequence): A helper to building JWK.
      (WebCore::JSCryptoKeySerializationJWK::addToJSON): Ditto.
      (WebCore::JSCryptoKeySerializationJWK::addBoolToJSON): Ditto.
      (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON): Ditto. The code for
      mapping is my best guess, this all needs to be specified.
      (WebCore::JSCryptoKeySerializationJWK::addJWKUseToJSON): A helper to building JWK.
      (WebCore::JSCryptoKeySerializationJWK::serialize): Build a JSON string for the key.
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::JSSubtleCrypto::importKey): Updated a comment.
      (WebCore::JSSubtleCrypto::exportKey): Use CryptoKeySerialization (also for raw keys,
      for consistency).
      
      * crypto/CryptoKey.h:
      (WebCore::CryptoKey::algorithmIdentifier):
      (WebCore::CryptoKey::usagesBitmap):
      Exposed data needed for building JWK (it used to be only exposed in a form suitable
      for DOM accessors).
      
      * crypto/keys/CryptoKeyHMAC.h: Ditto, added an accessor for JWK.
      
      * crypto/keys/CryptoKeySerializationRaw.cpp: (WebCore::CryptoKeySerializationRaw::serialize):
      * crypto/keys/CryptoKeySerializationRaw.h:
      Moved from JSSubtleCryptoCustom.cpp for consistency.
      
      Source/WTF: 
      
      Base64URL encoding doesn't use '=' padding, and doesn't need any other options.
      Added this mode for encode, and removed policy arguments from exposed functions.
      
      * wtf/text/Base64.cpp:
      (WTF::base64EncodeInternal):
      (WTF::base64URLEncode):
      (WTF::base64URLDecode):
      * wtf/text/Base64.h:
      (WTF::base64URLEncode):
      
      LayoutTests: 
      
      * 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:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ca827605
  4. 15 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Update WebCrypto tests · df32d58c
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124388
      
      Reviewed by Anders Carlsson.
      
      Updated tests for newer common.js. Changed some tests from just dumping results
      to comparing them to known expected ones. Fixed a syntax error in
      aes-cbc-invalid-length.html, so it now actually runs.
      
      * crypto/subtle/resources/common.js: Update to a new version from Blink, because
      it's much nicer than the old one, and it's good to be compatible at test level.
      Moved crypto.subtle definition from webkitSubtle here to avoid repeating it in all
      tests. Added a quick and dirty Promise.all implementation.
      
      * 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.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-wrong-key-class.html:
      * crypto/subtle/aes-export-key-expected.txt:
      * crypto/subtle/aes-export-key.html:
      * crypto/subtle/argument-conversion-expected.txt:
      * crypto/subtle/argument-conversion.html:
      * crypto/subtle/hmac-export-key-expected.txt:
      * crypto/subtle/hmac-export-key.html:
      * crypto/subtle/hmac-generate-key.html:
      * crypto/subtle/hmac-import-jwk-expected.txt:
      * crypto/subtle/hmac-import-jwk.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/import-jwk-expected.txt:
      * crypto/subtle/import-jwk.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:
      * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt:
      * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html:
      * crypto/subtle/sha-1-expected.txt:
      * crypto/subtle/sha-1.html:
      * crypto/subtle/sha-224-expected.txt:
      * crypto/subtle/sha-224.html:
      * crypto/subtle/sha-256-expected.txt:
      * crypto/subtle/sha-256.html:
      * crypto/subtle/sha-384-expected.txt:
      * crypto/subtle/sha-384.html:
      * crypto/subtle/sha-512-expected.txt:
      * crypto/subtle/sha-512.html:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      df32d58c
  5. 14 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Implement raw format for WebCrypto key export · 32fdefdd
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124376
      
      Reviewed by Anders Carlsson.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/aes-export-key.html
             crypto/subtle/hmac-export-key.html
      
      A CryptoKey just exports its native CryptoKeyData, which will also work nicely for
      JWK format soon. For spki and pkcs8, we'll need to figure out the best way to
      utilize platform library support for ASN.1, but we are not there yet.
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::JSSubtleCrypto::exportKey):
      * crypto/CryptoKey.h:
      * crypto/SubtleCrypto.idl:
      * crypto/keys/CryptoKeyAES.cpp:
      (WebCore::CryptoKeyAES::exportData):
      * crypto/keys/CryptoKeyAES.h:
      * crypto/keys/CryptoKeyHMAC.cpp:
      (WebCore::CryptoKeyHMAC::exportData):
      * crypto/keys/CryptoKeyHMAC.h:
      
      * crypto/keys/CryptoKeyRSA.h:
      * crypto/mac/CryptoKeyRSAMac.cpp:
      (WebCore::CryptoKeyRSA::exportData):
      Added a dummy implementation for RSA.
      
      LayoutTests: 
      
      * crypto/subtle/aes-export-key-expected.txt: Added.
      * crypto/subtle/aes-export-key.html: Added.
      * crypto/subtle/hmac-export-key-expected.txt: Added.
      * crypto/subtle/hmac-export-key.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      32fdefdd
  6. 01 Sep, 2010 1 commit
    • zimmermann@webkit.org's avatar
      2010-08-30 Patrick Gansterer <paroga@paroga.com> · 1423ab53
      zimmermann@webkit.org authored
               Reviewed by Dirk Schulze.
      
               RenderImage::imageChanged invalidates wrong area
               https://bugs.webkit.org/show_bug.cgi?id=43779
      
               Remove RenderImage inheritance from RenderSVGImage, it now inherits from RenderSVGModelObject.
      
               * rendering/RenderSVGImage.cpp:
               (WebCore::RenderSVGImage::RenderSVGImage):
               (WebCore::RenderSVGImage::~RenderSVGImage):
               (WebCore::RenderSVGImage::layout):
               (WebCore::RenderSVGImage::paint):
               (WebCore::RenderSVGImage::imageChanged):
               * rendering/RenderSVGImage.h:
               (WebCore::RenderSVGImage::imageResource):
               * rendering/RenderSVGModelObject.h:
               * svg/SVGImageElement.cpp:
      
      2010-09-01  Nikolas Zimmermann  <nzimmermann@rim.com>
      
              Reviewed by Dirk Schulze.
      
              RenderImage::imageChanged invalidates wrong area
              https://bugs.webkit.org/show_bug.cgi?id=43779
      
              Rebaseline SVG image dumpAsText() tests.
              A newline is gone from each of the results, after switching from RenderImage to RenderSVGModelObject in RenderSVGImage.
      
              * svg/custom/loadevents-capturing-expected.txt:
              * svg/custom/loadevents-externalresourcesrequired-expected.txt:
              * svg/custom/loadevents-normal-expected.txt:
              * svg/dynamic-updates/SVGImageElement-dom-height-attr-expected.txt:
              * svg/dynamic-updates/SVGImageElement-dom-preserveAspectRatio-attr-expected.txt:
              * svg/dynamic-updates/SVGImageElement-dom-width-attr-expected.txt:
              * svg/dynamic-updates/SVGImageElement-dom-x-attr-expected.txt:
              * svg/dynamic-updates/SVGImageElement-dom-y-attr-expected.txt:
              * svg/dynamic-updates/SVGImageElement-svgdom-height-prop-expected.txt:
              * svg/dynamic-updates/SVGImageElement-svgdom-preserveAspectRatio-prop-expected.txt:
              * svg/dynamic-updates/SVGImageElement-svgdom-width-prop-expected.txt:
              * svg/dynamic-updates/SVGImageElement-svgdom-x-prop-expected.txt:
              * svg/dynamic-updates/SVGImageElement-svgdom-y-prop-expected.txt:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66599 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1423ab53
  7. 12 Aug, 2008 1 commit