| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="resources/common.js"></script> | 5 <script src="resources/common.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <p id="description"></p> | 8 <p id="description"></p> |
| 9 <div id="console"></div> | 9 <div id="console"></div> |
| 10 | 10 |
| 11 <script> | 11 <script> |
| 12 description("Tests generateKey() with bad ECDSA parameters."); | 12 description("Tests generateKey() with bad ECDSA parameters."); |
| 13 jsTestIsAsync = true; | 13 jsTestIsAsync = true; |
| 14 | 14 |
| 15 extractable = true; | 15 extractable = true; |
| 16 keyUsages = ['sign', 'verify']; | 16 keyUsages = ['sign', 'verify']; |
| 17 | 17 |
| 18 Promise.resolve(null).then(function() { | 18 Promise.resolve(null).then(function() { |
| 19 // Missing curve name. | 19 // Missing curve name. |
| 20 debug("\ngenerateKey() without namedCurve..."); |
| 20 return crypto.subtle.generateKey({name: 'ECDSA'}, extractable , keyUsages); | 21 return crypto.subtle.generateKey({name: 'ECDSA'}, extractable , keyUsages); |
| 21 }).then(failAndFinishJSTest, function(result) { | 22 }).then(failAndFinishJSTest, function(result) { |
| 22 logError(result); | 23 logError(result); |
| 23 | 24 |
| 24 // Named curve is invalid (an integer when it should be a string). | 25 // Named curve is invalid (an integer when it should be a string). |
| 26 debug("\ngenerateKey() with namedCurve that is an integer..."); |
| 25 return crypto.subtle.generateKey({name: 'ECDSA', namedCurve: -1}, extractabl
e , keyUsages); | 27 return crypto.subtle.generateKey({name: 'ECDSA', namedCurve: -1}, extractabl
e , keyUsages); |
| 26 }).then(failAndFinishJSTest, function(result) { | 28 }).then(failAndFinishJSTest, function(result) { |
| 27 logError(result); | 29 logError(result); |
| 28 | 30 |
| 29 // Named curve is unrecognized (lower case when it should be upper case) | 31 // Named curve is unrecognized (lower case when it should be upper case) |
| 32 debug("\ngenerateKey() with lower case namedCurve..."); |
| 30 return crypto.subtle.generateKey({name: 'ECDSA', namedCurve: 'p-256'}, extra
ctable , keyUsages); | 33 return crypto.subtle.generateKey({name: 'ECDSA', namedCurve: 'p-256'}, extra
ctable , keyUsages); |
| 31 }).then(failAndFinishJSTest, function(result) { | 34 }).then(failAndFinishJSTest, function(result) { |
| 32 logError(result); | 35 logError(result); |
| 33 | 36 |
| 34 // Named curve is unrecognized (contains some trailing characters). | 37 // Named curve is unrecognized (contains some trailing characters). |
| 38 debug("\ngenerateKey() with namedCurve that contains some trailing character
s..."); |
| 35 return crypto.subtle.generateKey({name: 'ECDSA', namedCurve: 'P-256aa'}, ext
ractable , keyUsages); | 39 return crypto.subtle.generateKey({name: 'ECDSA', namedCurve: 'P-256aa'}, ext
ractable , keyUsages); |
| 36 }).then(failAndFinishJSTest, function(result) { | 40 }).then(failAndFinishJSTest, function(result) { |
| 37 logError(result); | 41 logError(result); |
| 38 }).then(finishJSTest, failAndFinishJSTest); | 42 }).then(finishJSTest, failAndFinishJSTest); |
| 39 | 43 |
| 40 </script> | 44 </script> |
| 41 | 45 |
| 42 </body> | 46 </body> |
| 43 </html> | 47 </html> |
| OLD | NEW |