| Index: chrome/renderer/resources/extensions/enterprise_platform_keys/subtle_crypto.js
|
| diff --git a/chrome/renderer/resources/extensions/enterprise_platform_keys/subtle_crypto.js b/chrome/renderer/resources/extensions/enterprise_platform_keys/subtle_crypto.js
|
| index d94722c79985f7ac9345f363ce216ce456be922f..0980e5a028b5db62d0db7a80d3f730fb6a2425e2 100644
|
| --- a/chrome/renderer/resources/extensions/enterprise_platform_keys/subtle_crypto.js
|
| +++ b/chrome/renderer/resources/extensions/enterprise_platform_keys/subtle_crypto.js
|
| @@ -10,6 +10,9 @@ var keyModule = require('enterprise.platformKeys.Key');
|
| var getSpki = keyModule.getSpki;
|
| var KeyUsage = keyModule.KeyUsage;
|
|
|
| +var normalizeAlgorithm =
|
| + requireNative('enterprise_platform_keys_natives').NormalizeAlgorithm;
|
| +
|
| // This error is thrown by the internal and public API's token functions and
|
| // must be rethrown by this custom binding. Keep this in sync with the C++ part
|
| // of this API.
|
| @@ -72,29 +75,29 @@ SubtleCryptoImpl.prototype.generateKey =
|
| keyUsages.length) {
|
| throw CreateDataError();
|
| }
|
| - if (!algorithm.name) {
|
| + var normalizedAlgorithmParameters = normalizeAlgorithm(algorithm, '');
|
| + if (!normalizedAlgorithmParameters) {
|
| // TODO(pneubeck): It's not clear from the WebCrypto spec which error to
|
| // throw here.
|
| throw CreateSyntaxError();
|
| }
|
|
|
| - if (algorithm.name.toUpperCase() !== 'RSASSA-PKCS1-V1_5') {
|
| + if (normalizedAlgorithmParameters.name !== 'RSASSA-PKCS1-V1_5') {
|
| // Note: This deviates from WebCrypto.SubtleCrypto.
|
| throw CreateNotSupportedError();
|
| }
|
| - if (!algorithm.modulusLength || !algorithm.publicExponent)
|
| - throw CreateSyntaxError();
|
|
|
| - internalAPI.generateKey(
|
| - subtleCrypto.tokenId, algorithm.modulusLength, function(spki) {
|
| - if (catchInvalidTokenError(reject))
|
| - return;
|
| - if (chrome.runtime.lastError) {
|
| - reject(CreateOperationError());
|
| - return;
|
| - }
|
| - resolve(new KeyPair(spki, algorithm, keyUsages));
|
| - });
|
| + internalAPI.generateKey(subtleCrypto.tokenId,
|
| + normalizedAlgorithmParameters.modulusLength,
|
| + function(spki) {
|
| + if (catchInvalidTokenError(reject))
|
| + return;
|
| + if (chrome.runtime.lastError) {
|
| + reject(CreateOperationError());
|
| + return;
|
| + }
|
| + resolve(new KeyPair(spki, algorithm, keyUsages));
|
| + });
|
| });
|
| };
|
|
|
|
|