W3C home > Mailing lists > Public > public-web-security@w3.org > June 2011

Re: Request for feedback: DOMCrypt API proposal

From: Stephen Farrell <stephen.farrell@cs.tcd.ie>
Date: Mon, 06 Jun 2011 14:34:26 +0100
Message-ID: <4DECD762.5050508@cs.tcd.ie>
To: "Richard L. Barnes" <rbarnes@bbn.com>
CC: David Dahl <ddahl@mozilla.com>, public-web-security@w3.org

On 06/06/11 02:45, Richard L. Barnes wrote:
> I apologize if this question is obvious; I haven't had a chance to read the document yet.
> 
> Is there any notion of how this document relates to the PKCS11 standard for interfacing to crypto devices?  
> <http://en.wikipedia.org/wiki/PKCS11>
> 
> PKCS11 clearly has more things than the DOMCrypt API would require (e.g., the ability to select and log into different devices).   But it seems like it would simplify implementation for browsers if they could just present a script with something logically equivalent to a virtual PKCS11 device, probably one per origin.  Especially given that at least one browser (Firefox) can use PKCS11 to talk to hardware devices.

I think that'd be a useful exercise.

Separately (maybe), I think the API should be defined so as
to reduce to the minimum the methods that have parameters that
are secret/private keys that are passed in directly. E.g., for
a secret key, generating or injecting a key via method1 that
is later used via a handle input to method2 is better. However,
I'm not a JS person, so I don't know how much is really
practical and useful here.

The reason is to favour keys being generated from within the
crypto support rather than being selected by the application
developers - when the latter case is encouraged by the API,
a lot of the symmetric keys end up with the value "password"
etc. and/or being stored in easily accessed locations.

S.



> 
> --Richard
> 
> 
> 
> 
> 
> On Jun 2, 2011, at 9:46 AM, David Dahl wrote:
> 
>> Hello public-web-security members,
>>
>> (I wanted to post this proposed draft spec for the DOMCrypt API ( https://wiki.mozilla.org/Privacy/Features/DOMCryptAPISpec/Latest ) to this list - if there is a more fitting mailing list, please let me know)
>>
>> I recently posted this draft spec for a crypto API for browsers to the whatwg (see: http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-May/031741.html) and wanted to get feedback from W3C as well.
>>
>> Privacy and user control on the web is of utter importance. Tracking, unauthorized user data aggregation and personal information breaches are becoming so commonplace you see a new headline almost daily. (It seems).
>>
>> We need crypto APIs in browsers to allow developers to create more secure communications tools and web applications that don’t have to implicitly trust the server, among other use cases.
>>
>> The DOMCrypt API is a good start, and more feedback and discussion will really help round out how all of this should work – as well as how it can work in any browser that will support such an API.
>>
>> This API will provide each web browser window with a ‘cipher’ property[1] that facilitates:
>>
>>    asymmetric encryption key pair generation
>>    public key encryption
>>    public key decryption
>>    symmetric encryption
>>    signature generation
>>    signature verification
>>    hashing
>>    easy public key discovery via meta tags or an ‘addressbookentry’ tag
>>
>> [1] There is a bit of discussion around adding this API to window.navigator or consolidation within window.crypto
>>
>> I have created a Firefox extension that implements most of the above, and am working on an experimental patch that integrates this API into Firefox.
>>
>> The project originated in an extension I wrote, the home page is here: http://domcrypt.org
>>
>> The source code for the extension is here: https://github.com/daviddahl/domcrypt
>>
>> The Mozilla bugs are here:
>>
>> https://bugzilla.mozilla.org/show_bug.cgi?id=649154
>> https://bugzilla.mozilla.org/show_bug.cgi?id=657432
>>
>> Firefox "feature wiki page": https://wiki.mozilla.org/Privacy/Features/DOMCryptAPI
>>
>> You can test the API by installing the extension hosted at domcrypt.org, and going to http://domcrypt.org
>>
>> A recent blog post updating all of this is posted here: http://monocleglobe..wordpress.com/2011/06/01/domcrypt-update-2011-06-01/
>>
>> The API:
>>
>> window.cipher = {
>> // Public Key API
>> pk: {
>>   set algorithm(algorithm){ },
>>   get algorithm(){ },
>>
>>  // Generate a keypair and then execute the callback function
>>  generateKeypair: function ( function callback( aPublicKey ) { } ) {  },
>>
>>  // encrypt a plainText
>>  encrypt: function ( plainText, function callback (cipherMessageObject) ) {  } ) {  },
>>
>>  // decrypt a cipherMessage
>>  decrypt: function ( cipherMessageObject, function callback ( plainText ) { } ) {  },
>>
>>  // sign a message
>>  sign: function ( plainText, function callback ( signature ) { } ) {  },
>>
>>  // verify a signature
>>  verify: function ( signature, plainText, function callback ( boolean ) { } ) {  },
>>
>>  // get the JSON cipherAddressbook
>>  get addressbook() {},
>>
>>  // make changes to the addressbook
>>  saveAddressbook: function (JSONObject, function callback ( addresssbook ) { }) {  }
>>  },
>>
>>  // Symmetric Crypto API
>>  sym: {
>>  get algorithm(),
>>  set algorithm(algorithm),
>>
>>  // create a new symmetric key
>>  generateKey: function (function callback ( key ){ }) {  },
>>
>>  // encrypt some data
>>  encrypt: function (plainText, key, function callback( cipherText ){ }) {  },
>>
>>  // decrypt some data
>>  decrypt: function (cipherText, key, function callback( plainText ) { }) {  },
>>  },
>>
>>  // hashing
>>  hash: {
>>    SHA256: function (function callback (hash){}) {  }
>>  }
>> }
>>
>> Your feedback and criticism will be invaluable.
>>
>> Best regards,
>>
>> David Dahl
>>
>> Firefox Engineer, Mozilla Corp.
>>
>>
>>
> 
> 
> 
> 
Received on Monday, 6 June 2011 13:35:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 6 June 2011 13:35:10 GMT