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

Unified Diff: content/child/webcrypto/jwk.cc

Issue 195893034: [webcrypto] Add JWK symmetric key RSAES-PKCS1-v1_5 wrap / unwrap for NSS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | content/child/webcrypto/shared_crypto.cc » ('j') | content/child/webcrypto/shared_crypto.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/jwk.cc
diff --git a/content/child/webcrypto/jwk.cc b/content/child/webcrypto/jwk.cc
index 6defa3184304117e4d2d86ddcaa664cabfba2162..2601323696255909def76883948e3de6bf5365cc 100644
--- a/content/child/webcrypto/jwk.cc
+++ b/content/child/webcrypto/jwk.cc
@@ -165,20 +165,25 @@ bool ImportAlgorithmsConsistent(const blink::WebCryptoAlgorithm& alg1,
DCHECK(!alg2.isNull());
if (alg1.id() != alg2.id())
return false;
- if (alg1.paramsType() != alg2.paramsType())
- return false;
- switch (alg1.paramsType()) {
- case blink::WebCryptoAlgorithmParamsTypeNone:
- return true;
- case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams:
- return ImportAlgorithmsConsistent(alg1.rsaHashedImportParams()->hash(),
- alg2.rsaHashedImportParams()->hash());
- case blink::WebCryptoAlgorithmParamsTypeHmacImportParams:
- return ImportAlgorithmsConsistent(alg1.hmacImportParams()->hash(),
- alg2.hmacImportParams()->hash());
- default:
+ // Inner hash algorithms must be compared too, but only if present.
+ if (alg1.paramsType() ==
eroman 2014/03/18 06:18:39 I am not sure that I understand the change made he
padolph 2014/03/18 17:52:19 Without this change the RsaEsJwkSymkeyWrapUnwrapRo
eroman 2014/03/19 04:04:00 I see thanks for explaining. That sounds like a p
+ blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams ||
+ alg1.paramsType() ==
+ blink::WebCryptoAlgorithmParamsTypeHmacImportParams) {
+ if (alg1.paramsType() != alg2.paramsType())
return false;
+ switch (alg1.paramsType()) {
+ case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams:
+ return ImportAlgorithmsConsistent(alg1.rsaHashedImportParams()->hash(),
+ alg2.rsaHashedImportParams()->hash());
+ case blink::WebCryptoAlgorithmParamsTypeHmacImportParams:
+ return ImportAlgorithmsConsistent(alg1.hmacImportParams()->hash(),
+ alg2.hmacImportParams()->hash());
+ default:
+ return false;
+ }
}
+ return true;
}
// Extracts the required string property with key |path| from |dict| and saves
@@ -391,9 +396,6 @@ Status ImportKeyJwk(const CryptoData& key_data,
// TODO(padolph): Generalize this comment to include export, and move to top
// of file.
- // TODO(padolph): Generalize this comment to include export, and move to top
- // of file.
-
// The goal of this method is to extract key material and meta data from the
// incoming JWK, combine them with the input parameters, and ultimately import
// a Web Crypto Key.
« no previous file with comments | « no previous file | content/child/webcrypto/shared_crypto.cc » ('j') | content/child/webcrypto/shared_crypto.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698