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

Unified Diff: chrome/renderer/resources/extensions/platform_keys/get_public_key.js

Issue 998293002: chrome.platformKeys.getKeyPair: Check requested algorithm against certificate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@require_alg_name
Patch Set: Fix string in test. Created 5 years, 9 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
Index: chrome/renderer/resources/extensions/platform_keys/get_public_key.js
diff --git a/chrome/renderer/resources/extensions/platform_keys/get_public_key.js b/chrome/renderer/resources/extensions/platform_keys/get_public_key.js
index d88fc608c92bbff69213b93260b079d5866c4ec1..af4a858ad3146b066d705d20118636c2408456d1 100644
--- a/chrome/renderer/resources/extensions/platform_keys/get_public_key.js
+++ b/chrome/renderer/resources/extensions/platform_keys/get_public_key.js
@@ -53,14 +53,15 @@ function combineAlgorithms(algorithm, importParams) {
function getPublicKey(cert, importParams, callback) {
importParams = normalizeImportParams(importParams);
- // TODO(pneubeck): pass importParams.name to the internal getPublicKey and
- // verify on the C++ side that the requested algorithm is compatible with the
- // given SubjectPublicKeyInfo of the certificate.
- // https://crbug.com/466584
- internalAPI.getPublicKey(cert, function(publicKey, algorithm) {
- var combinedAlgorithm = combineAlgorithms(algorithm, importParams);
- callback(publicKey, combinedAlgorithm);
- });
+ internalAPI.getPublicKey(
+ cert, importParams.name, function(publicKey, algorithm) {
+ if (chrome.runtime.lastError) {
+ callback();
+ return;
+ }
+ var combinedAlgorithm = combineAlgorithms(algorithm, importParams);
+ callback(publicKey, combinedAlgorithm);
+ });
}
exports.getPublicKey = getPublicKey;

Powered by Google App Engine
This is Rietveld 408576698