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

Re: JS code examples for ACTION 43

From: David Dahl <ddahl@mozilla.com>
Date: Thu, 6 Sep 2012 08:13:10 -0700 (PDT)
To: Wan-Teh Chang <wtc@google.com>, Ryan Sleevi <sleevi@google.com>, Arun Ranganathan <aranganathan@mozilla.com>
Cc: "public-webcrypto@w3.org Working Group" <public-webcrypto@w3.org>
Message-ID: <81183801.865143.1346944390901.JavaMail.root@mozilla.com>

Thank you for the patch, I have applied it to my local copy and am going through the rest of Ryan's feedback and will push a new version soon. I will just go ahead and add the code samples to the draft spec after that.

Ryan, Wan-Teh, Arun:

Should I create a new header - perhaps as a "Example JavaScript Code" appendix? Further, targeted code samples can maybe live right next to the WebIDL of the interface?



----- Original Message -----
From: "Wan-Teh Chang" <wtc@google.com>
To: "David Dahl" <ddahl@mozilla.com>
Cc: "public-webcrypto@w3.org Working Group" <public-webcrypto@w3.org>
Sent: Wednesday, September 5, 2012 7:22:49 PM
Subject: Re: JS code examples for ACTION 43

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 15:13:46 UTC

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