| Index: LayoutTests/crypto/hmac-generateKey-parseAlgorithm-failures.html
|
| diff --git a/LayoutTests/crypto/aes-gcm-parseAlgorithm-failures.html b/LayoutTests/crypto/hmac-generateKey-parseAlgorithm-failures.html
|
| similarity index 40%
|
| copy from LayoutTests/crypto/aes-gcm-parseAlgorithm-failures.html
|
| copy to LayoutTests/crypto/hmac-generateKey-parseAlgorithm-failures.html
|
| index dd4e3b3120ccdbd95cfda458fb4ccfbc5740af40..fb5dc6b9b4f7d5736768580e907820259277160c 100644
|
| --- a/LayoutTests/crypto/aes-gcm-parseAlgorithm-failures.html
|
| +++ b/LayoutTests/crypto/hmac-generateKey-parseAlgorithm-failures.html
|
| @@ -9,54 +9,54 @@
|
| <div id="console"></div>
|
|
|
| <script>
|
| -description("Tests bad algorithm inputs for AES-GCM");
|
| -
|
| +description("Tests generateKey() with bad HMAC parameters.");
|
| jsTestIsAsync = true;
|
|
|
| -var keyData = hexStringToUint8Array("2b7e151628aed2a6abf7158809cf4f3c");
|
| -var data = asciiToUint8Array("hello");
|
| -var key = null;
|
| +extractable = true;
|
| +keyUsages = ['sign', 'verify'];
|
|
|
| -Promise.resolve(null).then(function(result) {
|
| - var usages = ['encrypt', 'decrypt'];
|
| - var extractable = false;
|
| - var algorithm = {name: 'aes-gcm'};
|
| +Promise.resolve(null).then(function() {
|
| + return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: -3}, extractable , keyUsages);
|
| +}).then(failAndFinishJSTest, function(result) {
|
| + error = result;
|
| + shouldBeNull("error");
|
|
|
| - return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usages);
|
| -}).then(function(result) {
|
| - key = result;
|
| + return crypto.subtle.generateKey({name: 'hmac', hash: {name: ''}, length: 48}, extractable , keyUsages);
|
| +}).then(failAndFinishJSTest, function(result) {
|
| + error = result;
|
| + shouldBeNull("error");
|
|
|
| - return crypto.subtle.encrypt({name: 'AES-gcm'}, key, data);
|
| + return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: 5000000000}, extractable , keyUsages);
|
| }).then(failAndFinishJSTest, function(result) {
|
| error = result;
|
| shouldBeNull("error");
|
|
|
| - return crypto.subtle.encrypt({name: 'AES-gcm', iv: 3}, key, data);
|
| + return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: NaN}, extractable , keyUsages);
|
| }).then(failAndFinishJSTest, function(result) {
|
| error = result;
|
| shouldBeNull("error");
|
|
|
| - return crypto.subtle.encrypt({name: 'AES-gcm', iv: 'foo'}, key, data);
|
| + return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: Infinity}, extractable , keyUsages);
|
| }).then(failAndFinishJSTest, function(result) {
|
| error = result;
|
| shouldBeNull("error");
|
|
|
| - return crypto.subtle.encrypt({name: 'AeS-gcm', iv: new Uint8Array(16), additionalData: '5'}, key, data);
|
| + return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: -Infinity}, extractable , keyUsages);
|
| }).then(failAndFinishJSTest, function(result) {
|
| error = result;
|
| shouldBeNull("error");
|
|
|
| - return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), additionalData: new Uint8Array(1), tagLength: 'foo'}, key, data);
|
| + return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: crypto}, extractable , keyUsages);
|
| }).then(failAndFinishJSTest, function(result) {
|
| error = result;
|
| shouldBeNull("error");
|
|
|
| - return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), additionalData: new Uint8Array(1), tagLength: -1}, key, data);
|
| + return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: undefined}, extractable , keyUsages);
|
| }).then(failAndFinishJSTest, function(result) {
|
| error = result;
|
| shouldBeNull("error");
|
|
|
| - return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), additionalData: new Uint8Array(1), tagLength: 8000}, key, data);
|
| + return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: true}, extractable , keyUsages);
|
| }).then(failAndFinishJSTest, function(result) {
|
| error = result;
|
| shouldBeNull("error");
|
|
|