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

Unified Diff: Source/modules/crypto/NormalizeAlgorithm.cpp

Issue 284973002: [webcrypto] Remove RSA-ES support (3 of 3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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: Source/modules/crypto/NormalizeAlgorithm.cpp
diff --git a/Source/modules/crypto/NormalizeAlgorithm.cpp b/Source/modules/crypto/NormalizeAlgorithm.cpp
index 19965eeb8aab1e51759a8bcca196f5b11a9bfd2d..c1b669677ca01993f7739849852e0aaa4f33d161 100644
--- a/Source/modules/crypto/NormalizeAlgorithm.cpp
+++ b/Source/modules/crypto/NormalizeAlgorithm.cpp
@@ -72,7 +72,6 @@ const AlgorithmNameMapping algorithmNameMappings[] = {
{"AES-CBC", 7, blink::WebCryptoAlgorithmIdAesCbc},
{"AES-GCM", 7, blink::WebCryptoAlgorithmIdAesGcm},
{"AES-CTR", 7, blink::WebCryptoAlgorithmIdAesCtr},
- {"RSAES-PKCS1-V1_5", 16, blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5},
{"RSASSA-PKCS1-V1_5", 17, blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5},
};
@@ -133,20 +132,6 @@ const AlgorithmInfo algorithmIdToInfo[] = {
Undefined // UnwrapKey
}
}, { // Index 3
- "RSAES-PKCS1-v1_5", {
- blink::WebCryptoAlgorithmParamsTypeNone, // Encrypt
- blink::WebCryptoAlgorithmParamsTypeNone, // Decrypt
- Undefined, // Sign
- Undefined, // Verify
- Undefined, // Digest
- blink::WebCryptoAlgorithmParamsTypeRsaKeyGenParams, // GenerateKey
- blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey
- Undefined, // DeriveKey
- Undefined, // DeriveBits
- blink::WebCryptoAlgorithmParamsTypeNone, // WrapKey
- blink::WebCryptoAlgorithmParamsTypeNone // UnwrapKey
- }
- }, { // Index 4
"SHA-1", {
Undefined, // Encrypt
Undefined, // Decrypt
@@ -160,7 +145,7 @@ const AlgorithmInfo algorithmIdToInfo[] = {
Undefined, // WrapKey
Undefined // UnwrapKey
}
- }, { // Index 5
+ }, { // Index 4
"SHA-256", {
Undefined, // Encrypt
Undefined, // Decrypt
@@ -174,7 +159,7 @@ const AlgorithmInfo algorithmIdToInfo[] = {
Undefined, // WrapKey
Undefined // UnwrapKey
}
- }, { // Index 6
+ }, { // Index 5
"SHA-384", {
Undefined, // Encrypt
Undefined, // Decrypt
@@ -188,7 +173,7 @@ const AlgorithmInfo algorithmIdToInfo[] = {
Undefined, // WrapKey
Undefined // UnwrapKey
}
- }, { // Index 7
+ }, { // Index 6
"SHA-512", {
Undefined, // Encrypt
Undefined, // Decrypt
@@ -202,7 +187,7 @@ const AlgorithmInfo algorithmIdToInfo[] = {
Undefined, // WrapKey
Undefined // UnwrapKey
}
- }, { // Index 8
+ }, { // Index 7
"AES-GCM", {
blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Encrypt
blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Decrypt
@@ -216,7 +201,7 @@ const AlgorithmInfo algorithmIdToInfo[] = {
blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // WrapKey
blink::WebCryptoAlgorithmParamsTypeAesGcmParams // UnwrapKey
}
- }, { // Index 9
+ }, { // Index 8
"RSA-OAEP", {
// FIXME:
Undefined, // Encrypt
@@ -231,7 +216,7 @@ const AlgorithmInfo algorithmIdToInfo[] = {
Undefined, // WrapKey
Undefined // UnwrapKey
}
- }, { // Index 10
+ }, { // Index 9
"AES-CTR", {
blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Encrypt
blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Decrypt
@@ -245,7 +230,7 @@ const AlgorithmInfo algorithmIdToInfo[] = {
blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // WrapKey
blink::WebCryptoAlgorithmParamsTypeAesCtrParams // UnwrapKey
}
- }, { // Index 11
+ }, { // Index 10
"AES-KW", {
Undefined, // Encrypt
Undefined, // Decrypt
@@ -268,16 +253,15 @@ const AlgorithmInfo algorithmIdToInfo[] = {
COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCbc == 0, AesCbc_idDoesntMatch);
COMPILE_ASSERT(blink::WebCryptoAlgorithmIdHmac == 1, Hmac_idDoesntMatch);
COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 == 2, RsaSsaPkcs1v1_5_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5 == 3, RsaEsPkcs1v1_5_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha1 == 4, Sha1_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha256 == 5, Sha256_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha384 == 6, Sha384_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha512 == 7, Sha512_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesGcm == 8, AesGcm_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaOaep == 9, RsaOaep_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCtr == 10, AesCtr_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesKw == 11, AesKw_idDoesntMatch);
-COMPILE_ASSERT(blink::WebCryptoAlgorithmIdLast == 11, Last_idDoesntMatch);
+COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha1 == 3, Sha1_idDoesntMatch);
+COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha256 == 4, Sha256_idDoesntMatch);
+COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha384 == 5, Sha384_idDoesntMatch);
+COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha512 == 6, Sha512_idDoesntMatch);
+COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesGcm == 7, AesGcm_idDoesntMatch);
+COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaOaep == 8, RsaOaep_idDoesntMatch);
+COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCtr == 9, AesCtr_idDoesntMatch);
+COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesKw == 10, AesKw_idDoesntMatch);
+COMPILE_ASSERT(blink::WebCryptoAlgorithmIdLast == 10, Last_idDoesntMatch);
COMPILE_ASSERT(10 == LastAlgorithmOperation, UpdateParamsMapping);
#if ASSERT_ENABLED
@@ -719,42 +703,22 @@ bool parseRsaHashedImportParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAl
// Defined by the WebCrypto spec as:
//
+// dictionary RsaHashedKeyGenParams : RsaKeyGenParams {
+// AlgorithmIdentifier hash;
+// };
+//
// dictionary RsaKeyGenParams : Algorithm {
// unsigned long modulusLength;
// BigInteger publicExponent;
// };
-bool parseRsaKeyGenParams(const Dictionary& raw, uint32_t& modulusLength, RefPtr<Uint8Array>& publicExponent, const ErrorContext& context, CryptoResult* result)
-{
- if (!getUint32(raw, "modulusLength", modulusLength, context, result))
- return false;
-
- if (!getBigInteger(raw, "publicExponent", publicExponent, context, result))
- return false;
-
- return true;
-}
-
-bool parseRsaKeyGenParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAlgorithmParams>& params, const ErrorContext& context, CryptoResult* result)
+bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAlgorithmParams>& params, const ErrorContext& context, CryptoResult* result)
{
uint32_t modulusLength;
- RefPtr<Uint8Array> publicExponent;
- if (!parseRsaKeyGenParams(raw, modulusLength, publicExponent, context, result))
+ if (!getUint32(raw, "modulusLength", modulusLength, context, result))
return false;
- params = adoptPtr(new blink::WebCryptoRsaKeyGenParams(modulusLength, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExponent->byteLength()));
- return true;
-}
-
-// Defined by the WebCrypto spec as:
-//
-// dictionary RsaHashedKeyGenParams : RsaKeyGenParams {
-// AlgorithmIdentifier hash;
-// };
-bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAlgorithmParams>& params, const ErrorContext& context, CryptoResult* result)
-{
- uint32_t modulusLength;
RefPtr<Uint8Array> publicExponent;
- if (!parseRsaKeyGenParams(raw, modulusLength, publicExponent, context, result))
+ if (!getBigInteger(raw, "publicExponent", publicExponent, context, result))
return false;
blink::WebCryptoAlgorithm hash;
@@ -841,9 +805,6 @@ bool parseAlgorithmParams(const Dictionary& raw, blink::WebCryptoAlgorithmParams
case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams:
context.add("RsaHashedImportParams");
return parseRsaHashedImportParams(raw, params, context, result);
- case blink::WebCryptoAlgorithmParamsTypeRsaKeyGenParams:
- context.add("RsaKeyGenParams");
- return parseRsaKeyGenParams(raw, params, context, result);
case blink::WebCryptoAlgorithmParamsTypeAesCtrParams:
context.add("AesCtrParams");
return parseAesCtrParams(raw, params, context, result);

Powered by Google App Engine
This is Rietveld 408576698