W3C home > Mailing lists > Public > public-webcrypto@w3.org > September 2012

Re: JS code examples for ACTION 43

From: Wan-Teh Chang <wtc@google.com>
Date: Wed, 5 Sep 2012 17:22:49 -0700
Message-ID: <CALTJjxEKuakgGL1KaiQNid_J-Ceqc=8E8Ktz70yP1M8a4PAS9Q@mail.gmail.com>
To: David Dahl <ddahl@mozilla.com>
Cc: "public-webcrypto@w3.org Working Group" <public-webcrypto@w3.org>
David, Arun,

Thank you for writing the sample code.

Some of the mistakes in your sample code are caused by incomplete
specification of the current API draft. Some mistakes indicate areas
for improvement. I noted some mistakes below. (I didn't correct all
mistakes I found.)

1. In the algorithm object for RSA key pair generation:

// Algorithm Object
var algorithm = {
  name: "RSAES-PKCS1-v1_5",
  // AlgorithmParams
  params: {
    modulusLength: 2048,
    publicExponent: 65537

The value of publicExponent needs to be a Uint8Array. So 65537 needs
to be represented as an array of three Uint8 elements: 0x01, 0x00,

2. In the onKeyGenComplete function, we have:

  console.log("Key ID: " + event.target.key.id);

This requires adding a |key| attribute to the KeyOperation interface
in Section 13 "KeyOperation interface". But it seems that the |key|
should be the |result| of the KeyOperation object for key generation.
So perhaps this line should read:
  console.log("Key ID: " + event.target.result.id);

3. Call sequences like the following don't work because the methods
are all asynchronous:


4. Please see the attached patch file for additional fixes. If you
have questions about any change in the patch file, please let me know.


Received on Thursday, 6 September 2012 00:23:17 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:17:13 UTC