Changeset 159392 in webkit


Ignore:
Timestamp:
Nov 17, 2013 5:17:09 PM (10 years ago)
Author:
ap@apple.com
Message:

JWK crypto key export result is a DOM string instead of an array buffer
https://bugs.webkit.org/show_bug.cgi?id=124473

Reviewed by Sam Weinig.

Source/WebCore:

  • bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::exportKey):

Fix it.

LayoutTests:

  • crypto/subtle/aes-export-key.html:
  • crypto/subtle/hmac-export-key.html:
  • crypto/subtle/resources/common.js: (bytesToASCIIString): Added a function that

converts an ArrayBuffer to a string, assuming it's all ASCII.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159389 r159392  
     12013-11-17  Alexey Proskuryakov  <ap@apple.com>
     2
     3        JWK crypto key export result is a DOM string instead of an array buffer
     4        https://bugs.webkit.org/show_bug.cgi?id=124473
     5
     6        Reviewed by Sam Weinig.
     7
     8        * crypto/subtle/aes-export-key.html:
     9        * crypto/subtle/hmac-export-key.html:
     10
     11        * crypto/subtle/resources/common.js: (bytesToASCIIString): Added a function that
     12        converts an ArrayBuffer to a string, assuming it's all ASCII.
     13
    1142013-11-17  Antti Koivisto  <antti@apple.com>
    215
  • trunk/LayoutTests/crypto/subtle/aes-export-key.html

    r159377 r159392  
    4949    return crypto.subtle.exportKey("jwk", key);
    5050}).then(function(result) {
    51     exportedJWK = JSON.parse(result);
     51    exportedJWK = JSON.parse(bytesToASCIIString(result));
    5252    shouldBe("exportedJWK.kty", "'oct'");
    5353    shouldBe("exportedJWK.k", "'jnOw99oOZFLIEPMrgJB55WL46tJSLGt7'");
  • trunk/LayoutTests/crypto/subtle/hmac-export-key.html

    r159377 r159392  
    4343    return crypto.subtle.exportKey("jwk", key);
    4444}).then(function(result) {
    45     exportedJWK = JSON.parse(result);
     45    exportedJWK = JSON.parse(bytesToASCIIString(result));
    4646    shouldBe("exportedJWK.kty", "'oct'");
    4747    shouldBe("exportedJWK.k", "'ahjkn-_387fgnsibf23qsvahjkn-_387fgnsibf23qs'");
  • trunk/LayoutTests/crypto/subtle/resources/common.js

    r159327 r159392  
    5353
    5454    return hexBytes.join("");
     55}
     56
     57function bytesToASCIIString(bytes)
     58{
     59    return String.fromCharCode.apply(null, new Uint8Array(bytes));
    5560}
    5661
  • trunk/Source/WebCore/ChangeLog

    r159391 r159392  
     12013-11-17  Alexey Proskuryakov  <ap@apple.com>
     2
     3        JWK crypto key export result is a DOM string instead of an array buffer
     4        https://bugs.webkit.org/show_bug.cgi?id=124473
     5
     6        Reviewed by Sam Weinig.
     7
     8        * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::exportKey):
     9        Fix it.
     10
    1112013-11-17  Sam Weinig  <sam@webkit.org>
    212
  • trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp

    r159379 r159392  
    549549        Vector<unsigned char> resultBuffer;
    550550        resultBuffer.append(utf8String.data(), utf8String.length());
    551         promiseWrapper->fulfill(result);
     551        promiseWrapper->fulfill(resultBuffer);
    552552        break;
    553553    }
Note: See TracChangeset for help on using the changeset viewer.