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

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

Issue 306433003: enterprise.platformKeys: Support the publicExponent parameter. (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 41fff64969801798c1e3ac270cbff1087c208628..b095e9eecf2be211bf1c5ba8053b0952aa78312c 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
@@ -309,17 +309,26 @@ function runTests(userToken) {
assertTrue(false, "Export failed: " + error);
})
.then(callbackPass(function(signature) {
+ var importParams = {
+ name: algorithm.name,
+ // RsaHashedImportParams
+ hash: {
+ name: "SHA-1",
+ }
+ };
assertTrue(!!signature, "No signature.");
assertTrue(signature.length != 0, "Signature is empty.");
cachedSignature = signature;
return window.crypto.subtle.importKey(
- "spki", cachedSpki, algorithm, false, ["verify"]);
+ "spki", cachedSpki, importParams, false, ["verify"]);
}),
function(error) { assertTrue(false, "Sign failed: " + error); })
.then(callbackPass(function(webCryptoPublicKey) {
assertTrue(!!webCryptoPublicKey);
assertEq(algorithm.modulusLength,
webCryptoPublicKey.algorithm.modulusLength);
+ assertEq(algorithm.publicExponent,
+ webCryptoPublicKey.algorithm.publicExponent);
return window.crypto.subtle.verify(
algorithm, webCryptoPublicKey, cachedSignature, data);
}),
@@ -364,8 +373,8 @@ function runTests(userToken) {
function algorithmParameterMissingModulusLength() {
var algorithm = {
name: "RSASSA-PKCS1-v1_5",
- publicExponent:
- new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
+ // Equivalent to 65537
+ publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
hash: {
name: "SHA-1",
}
@@ -386,8 +395,28 @@ function runTests(userToken) {
var algorithm = {
name: 'RSASSA-PKCS1-v1_5',
modulusLength: 512,
- publicExponent:
- new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
+ // Equivalent to 65537
+ publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
+ };
+ userToken.subtleCrypto.generateKey(algorithm, false, ['sign']).then(
+ function(keyPair) {
+ assertTrue(false, 'generateKey was expected to fail');
+ },
+ callbackPass(function(error) {
+ assertEq(
+ new Error('Error: A required parameter was missing our out-of-range'),
+ error);
+ }));
+ },
+
+ // Call generate key with invalid algorithm parameter, unsupported public
+ // exponent.
+ function algorithmParameterUnsupportedPublicExponent() {
+ var algorithm = {
+ name: 'RSASSA-PKCS1-v1_5',
+ modulusLength: 512,
+ // Different from 65537.
+ publicExponent: new Uint8Array([0x01, 0x01]),
};
userToken.subtleCrypto.generateKey(algorithm, false, ['sign']).then(
function(keyPair) {
« 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