Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4933)

Unified Diff: chrome/test/data/extensions/api_test/enterprise_platform_keys/basic.js

Issue 298073009: Reuse WebCrypto's normalizeCryptoAlgorithm in enterprise.platformKeys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/enterprise_platform_keys.crx ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/enterprise_platform_keys/basic.js
diff --git a/chrome/test/data/extensions/api_test/enterprise_platform_keys/basic.js b/chrome/test/data/extensions/api_test/enterprise_platform_keys/basic.js
index 557ae680c4cf2d22d441f75f4426449e1c7d161d..41fff64969801798c1e3ac270cbff1087c208628 100644
--- a/chrome/test/data/extensions/api_test/enterprise_platform_keys/basic.js
+++ b/chrome/test/data/extensions/api_test/enterprise_platform_keys/basic.js
@@ -301,8 +301,9 @@ function runTests(userToken) {
})
.then(callbackPass(function(publicKeySpki) {
cachedSpki = publicKeySpki;
+ var signParams = {name: 'RSASSA-PKCS1-v1_5'};
return userToken.subtleCrypto.sign(
- {}, cachedKeyPair.privateKey, data);
+ signParams, cachedKeyPair.privateKey, data);
}),
function(error) {
assertTrue(false, "Export failed: " + error);
@@ -358,6 +359,47 @@ function runTests(userToken) {
]);
},
+ // Call generate key with invalid algorithm parameter, missing
+ // modulusLength.
+ function algorithmParameterMissingModulusLength() {
+ var algorithm = {
+ name: "RSASSA-PKCS1-v1_5",
+ publicExponent:
+ new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
+ hash: {
+ name: "SHA-1",
+ }
+ };
+ userToken.subtleCrypto.generateKey(algorithm, false, ['sign']).then(
+ function(keyPair) {
+ assertTrue(false, 'generateKey was expected to fail');
+ },
+ callbackPass(function(error) {
+ assertTrue(error instanceof Error);
+ assertEq('A required parameter was missing or out-of-range',
+ error.message);
+ }));
+ },
+
+ // Call generate key with invalid algorithm parameter, missing hash.
+ function algorithmParameterMissingHash() {
+ var algorithm = {
+ name: 'RSASSA-PKCS1-v1_5',
+ modulusLength: 512,
+ publicExponent:
+ new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
+ };
+ userToken.subtleCrypto.generateKey(algorithm, false, ['sign']).then(
+ function(keyPair) {
+ assertTrue(false, 'generateKey was expected to fail');
+ },
+ callbackPass(function(error) {
+ assertTrue(error instanceof Error);
+ assertEq('A required parameter was missing or out-of-range',
+ error.message);
+ }));
+ },
+
// Imports a certificate for which now private key was imported/generated
// before.
function missingPrivateKey() {
« no previous file with comments | « chrome/test/data/extensions/api_test/enterprise_platform_keys.crx ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698