9 var algorithmKeyGen = {
10 name: "RSASSA-PKCS1-v1_5",
13 publicExponent: new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
18 name: "RSASSA-PKCS1-v1_5",
19 params: { hash: { name: "SHA-256" } }
22 var keyGen = this.crypto.generateKey(algorithmKeyGen, false, ["sign"]);
24 keyGen.oncomplete = function(event) {
25 // Because we are not supplying data to .sign(), a multi-part
26 // CryptoOperation will be returned, which requires us to call .process()
28 var signer = window.crypt.sign(algorithmSign, event.target.result.privateKey);
29 signer.oncomplete = function(event) {
30 console.log("The signature is: " + event.target.result);
32 signer.onerror = function(event) {
33 console.error("Unable to sign");
36 var dataPart1 = convertPlainTextToArrayBufferView("hello,");
37 var dataPart2 = convertPlainTextToArrayBufferView(" world!");
38 // TODO: create example utility function that converts text -> ArrayBufferView
40 signer.process(dataPart1);
41 signer.process(dataPart2);
45 keyGen.onerror = function(event) {
46 console.error("Unable to generate a key.");