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

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

Issue 275943004: Add support for RSA-OAEP when using NSS 3.16.2 or later (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unit tests Created 6 years, 7 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: content/child/webcrypto/jwk.cc
diff --git a/content/child/webcrypto/jwk.cc b/content/child/webcrypto/jwk.cc
index 53dd787d7a36cc5ebe15fc9aedc7370a1d10aff4..e2a255a43c476e6b4ab5197332e5a890ef5f518f 100644
--- a/content/child/webcrypto/jwk.cc
+++ b/content/child/webcrypto/jwk.cc
@@ -284,6 +284,15 @@ class JwkAlgorithmRegistry {
alg_to_info_["RSA-OAEP"] =
JwkAlgorithmInfo(&BindAlgorithmId<CreateRsaOaepImportAlgorithm,
blink::WebCryptoAlgorithmIdSha1>);
+ alg_to_info_["RSA-OAEP-256"] =
+ JwkAlgorithmInfo(&BindAlgorithmId<CreateRsaOaepImportAlgorithm,
+ blink::WebCryptoAlgorithmIdSha256>);
+ alg_to_info_["RSA-OAEP-384"] =
+ JwkAlgorithmInfo(&BindAlgorithmId<CreateRsaOaepImportAlgorithm,
+ blink::WebCryptoAlgorithmIdSha384>);
+ alg_to_info_["RSA-OAEP-512"] =
+ JwkAlgorithmInfo(&BindAlgorithmId<CreateRsaOaepImportAlgorithm,
+ blink::WebCryptoAlgorithmIdSha512>);
alg_to_info_["A128KW"] = JwkAlgorithmInfo(
&BindAlgorithmId<CreateAlgorithm, blink::WebCryptoAlgorithmIdAesKw>,
128);
@@ -565,22 +574,47 @@ Status WriteAlg(const blink::WebCryptoKeyAlgorithm& algorithm,
}
break;
case blink::WebCryptoKeyAlgorithmParamsTypeRsaHashed:
- switch (algorithm.rsaHashedParams()->hash().id()) {
- case blink::WebCryptoAlgorithmIdRsaOaep:
- jwk_dict->SetString("alg", "RSA-OAEP");
Ryan Sleevi 2014/05/16 05:17:22 LULWUT
- break;
- case blink::WebCryptoAlgorithmIdSha1:
- jwk_dict->SetString("alg", "RS1");
- break;
- case blink::WebCryptoAlgorithmIdSha256:
- jwk_dict->SetString("alg", "RS256");
- break;
- case blink::WebCryptoAlgorithmIdSha384:
- jwk_dict->SetString("alg", "RS384");
+ switch (algorithm.id()) {
+ case blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5: {
+ switch (algorithm.rsaHashedParams()->hash().id()) {
+ case blink::WebCryptoAlgorithmIdSha1:
+ jwk_dict->SetString("alg", "RS1");
+ break;
+ case blink::WebCryptoAlgorithmIdSha256:
+ jwk_dict->SetString("alg", "RS256");
+ break;
+ case blink::WebCryptoAlgorithmIdSha384:
+ jwk_dict->SetString("alg", "RS384");
+ break;
+ case blink::WebCryptoAlgorithmIdSha512:
+ jwk_dict->SetString("alg", "RS512");
+ break;
+ default:
+ NOTREACHED();
+ return Status::ErrorUnexpected();
+ }
break;
- case blink::WebCryptoAlgorithmIdSha512:
- jwk_dict->SetString("alg", "RS512");
+ }
+ case blink::WebCryptoAlgorithmIdRsaOaep: {
+ switch (algorithm.rsaHashedParams()->hash().id()) {
+ case blink::WebCryptoAlgorithmIdSha1:
+ jwk_dict->SetString("alg", "RSA-OAEP");
+ break;
+ case blink::WebCryptoAlgorithmIdSha256:
+ jwk_dict->SetString("alg", "RSA-OAEP-256");
+ break;
+ case blink::WebCryptoAlgorithmIdSha384:
+ jwk_dict->SetString("alg", "RSA-OAEP-384");
+ break;
+ case blink::WebCryptoAlgorithmIdSha512:
+ jwk_dict->SetString("alg", "RSA-OAEP-512");
+ break;
+ default:
+ NOTREACHED();
+ return Status::ErrorUnexpected();
+ }
break;
+ }
default:
NOTREACHED();
return Status::ErrorUnexpected();
« no previous file with comments | « no previous file | content/child/webcrypto/platform_crypto.h » ('j') | content/child/webcrypto/platform_crypto_nss.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698