OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var utils = require('utils'); | 5 var utils = require('utils'); |
6 var internalAPI = require('enterprise.platformKeys.internalAPI'); | 6 var internalAPI = require('enterprise.platformKeys.internalAPI'); |
7 var intersect = require('enterprise.platformKeys.utils').intersect; | 7 var intersect = require('enterprise.platformKeys.utils').intersect; |
8 var KeyPair = require('enterprise.platformKeys.KeyPair').KeyPair; | 8 var KeyPair = require('enterprise.platformKeys.KeyPair').KeyPair; |
9 var keyModule = require('enterprise.platformKeys.Key'); | 9 var keyModule = require('enterprise.platformKeys.Key'); |
10 var getSpki = keyModule.getSpki; | 10 var getSpki = keyModule.getSpki; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 throw CreateSyntaxError(); | 83 throw CreateSyntaxError(); |
84 } | 84 } |
85 | 85 |
86 if (normalizedAlgorithmParameters.name !== 'RSASSA-PKCS1-V1_5') { | 86 if (normalizedAlgorithmParameters.name !== 'RSASSA-PKCS1-V1_5') { |
87 // Note: This deviates from WebCrypto.SubtleCrypto. | 87 // Note: This deviates from WebCrypto.SubtleCrypto. |
88 throw CreateNotSupportedError(); | 88 throw CreateNotSupportedError(); |
89 } | 89 } |
90 | 90 |
91 internalAPI.generateKey(subtleCrypto.tokenId, | 91 internalAPI.generateKey(subtleCrypto.tokenId, |
92 normalizedAlgorithmParameters.modulusLength, | 92 normalizedAlgorithmParameters.modulusLength, |
| 93 normalizedAlgorithmParameters.publicExponent, |
93 function(spki) { | 94 function(spki) { |
94 if (catchInvalidTokenError(reject)) | 95 if (catchInvalidTokenError(reject)) |
95 return; | 96 return; |
96 if (chrome.runtime.lastError) { | 97 if (chrome.runtime.lastError) { |
97 reject(CreateOperationError()); | 98 reject(CreateOperationError()); |
98 return; | 99 return; |
99 } | 100 } |
100 resolve(new KeyPair(spki, algorithm, keyUsages)); | 101 resolve(new KeyPair(spki, algorithm, keyUsages)); |
101 }); | 102 }); |
102 }); | 103 }); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // TODO(pneubeck): It should be possible to export to format 'jwk'. | 148 // TODO(pneubeck): It should be possible to export to format 'jwk'. |
148 throw CreateNotSupportedError(); | 149 throw CreateNotSupportedError(); |
149 } | 150 } |
150 }); | 151 }); |
151 }; | 152 }; |
152 | 153 |
153 exports.SubtleCrypto = | 154 exports.SubtleCrypto = |
154 utils.expose('SubtleCrypto', | 155 utils.expose('SubtleCrypto', |
155 SubtleCryptoImpl, | 156 SubtleCryptoImpl, |
156 {functions:['generateKey', 'sign', 'exportKey']}); | 157 {functions:['generateKey', 'sign', 'exportKey']}); |
OLD | NEW |