OLD | NEW |
1 function generateRsaKey() | 1 function generateRsaKey() |
2 { | 2 { |
3 var extractable = false; | 3 var extractable = false; |
4 var usages = ['sign', 'verify']; | 4 var usages = ['sign', 'verify']; |
5 var algorithm = {name: "RSASSA-PKCS1-v1_5", modulusLength: 512, publicExpone
nt: new Uint8Array([1, 0, 1]), hash: {name: 'sha-1'}}; | 5 var algorithm = {name: "RSASSA-PKCS1-v1_5", modulusLength: 512, publicExpone
nt: new Uint8Array([1, 0, 1]), hash: {name: 'sha-1'}}; |
6 | 6 |
7 return crypto.subtle.generateKey(algorithm, extractable, usages).then(undefi
ned, function(error) { | 7 return crypto.subtle.generateKey(algorithm, extractable, usages).then(undefi
ned, function(error) { |
8 postMessage(error); | 8 postMessage(error); |
9 }); | 9 }); |
10 } | 10 } |
11 | 11 |
12 // Start many concurrent operations but don't do anything with the result, or | 12 // Start many concurrent operations but don't do anything with the result, or |
13 // even wait for them to complete. | 13 // even wait for them to complete. |
14 for (var i = 0; i < 1000; ++i) | 14 for (var i = 0; i < 1000; ++i) |
15 generateRsaKey(); | 15 generateRsaKey(); |
16 | 16 |
17 // Inform the outer script that the worker started. | 17 // Inform the outer script that the worker started. |
18 postMessage("Worker started"); | 18 postMessage("Worker started"); |
19 | 19 |
20 close(); | 20 close(); |
OLD | NEW |