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

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

Issue 500653002: [webcrypto] Don't disallow RSA public key import using SPKI format when on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « content/child/webcrypto/nss/rsa_key_nss.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/shared_crypto_unittest.cc
diff --git a/content/child/webcrypto/shared_crypto_unittest.cc b/content/child/webcrypto/shared_crypto_unittest.cc
index a117f2266b6e0dbc4b6968759153c69ecb3a0e2f..80a4191d5c486679ea623639dd7645baff5ae8e9 100644
--- a/content/child/webcrypto/shared_crypto_unittest.cc
+++ b/content/child/webcrypto/shared_crypto_unittest.cc
@@ -122,7 +122,7 @@ bool SupportsRsaOaep() {
#endif
}
-bool SupportsRsaKeyImport() {
+bool SupportsRsaPrivateKeyImport() {
// TODO(eroman): Exclude version test for OS_CHROMEOS
#if defined(USE_NSS)
crypto::EnsureNSSInit();
@@ -1841,9 +1841,6 @@ TEST(WebCryptoAesCbcTest, ImportJwkInconsistentKLength2) {
}
TEST(WebCryptoRsaSsaTest, ImportExportJwkRsaPublicKey) {
- if (!SupportsRsaKeyImport())
- return;
-
struct TestCase {
const blink::WebCryptoAlgorithmId hash;
const blink::WebCryptoKeyUsageMask usage;
@@ -1907,9 +1904,6 @@ TEST(WebCryptoRsaSsaTest, ImportExportJwkRsaPublicKey) {
}
TEST(WebCryptoRsaOaepTest, ImportExportJwkRsaPublicKey) {
- if (!SupportsRsaKeyImport())
- return;
-
if (!SupportsRsaOaep()) {
LOG(WARNING) << "RSA-OAEP support not present; skipping.";
return;
@@ -2395,9 +2389,6 @@ TEST(WebCryptoHmacTest, ExportJwkEmptyKey) {
}
TEST(WebCryptoRsaSsaTest, ImportExportSpki) {
- if (!SupportsRsaKeyImport())
- return;
-
// Passing case: Import a valid RSA key in SPKI format.
blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
ASSERT_EQ(Status::Success(),
@@ -2484,7 +2475,7 @@ TEST(WebCryptoRsaSsaTest, ImportExportSpki) {
}
TEST(WebCryptoRsaSsaTest, ImportExportPkcs8) {
- if (!SupportsRsaKeyImport())
+ if (!SupportsRsaPrivateKeyImport())
return;
// Passing case: Import a valid RSA key in PKCS#8 format.
@@ -2551,7 +2542,7 @@ TEST(WebCryptoRsaSsaTest, ImportExportPkcs8) {
// Tests importing of PKCS8 data that does not define a valid RSA key.
TEST(WebCryptoRsaSsaTest, ImportInvalidPkcs8) {
- if (!SupportsRsaKeyImport())
+ if (!SupportsRsaPrivateKeyImport())
return;
// kPrivateKeyPkcs8DerHex defines an RSA private key in PKCS8 format, whose
@@ -2605,7 +2596,7 @@ TEST(WebCryptoRsaSsaTest, ImportInvalidPkcs8) {
//
// PKCS8 --> JWK --> PKCS8
TEST(WebCryptoRsaSsaTest, ImportRsaPrivateKeyJwkToPkcs8RoundTrip) {
- if (!SupportsRsaKeyImport())
+ if (!SupportsRsaPrivateKeyImport())
return;
blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
@@ -2673,7 +2664,7 @@ TEST(WebCryptoRsaSsaTest, ImportRsaPrivateKeyJwkToPkcs8RoundTrip) {
// be imported correctly, however every key after that would actually import
// the first key.
TEST(WebCryptoRsaSsaTest, ImportMultipleRSAPrivateKeysJwk) {
- if (!SupportsRsaKeyImport())
+ if (!SupportsRsaPrivateKeyImport())
return;
scoped_ptr<base::ListValue> key_list;
@@ -2837,7 +2828,7 @@ TEST(WebCryptoRsaSsaTest, ImportRsaPrivateKeyJwkMissingOptionalParams) {
// accept them, but are not required to. Chromium's WebCrypto does
// not allow such degenerate keys.
TEST(WebCryptoRsaSsaTest, ImportRsaPrivateKeyJwkIncorrectOptionalEmpty) {
- if (!SupportsRsaKeyImport())
+ if (!SupportsRsaPrivateKeyImport())
return;
blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
@@ -2935,7 +2926,7 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairRsa) {
Status::Success(),
ExportKey(blink::WebCryptoKeyFormatSpki, public_key, &public_key_spki));
- if (SupportsRsaKeyImport()) {
+ if (SupportsRsaPrivateKeyImport()) {
public_key = blink::WebCryptoKey::createNull();
EXPECT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatSpki,
@@ -3139,7 +3130,7 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairRsaBadExponent) {
}
TEST(WebCryptoRsaSsaTest, SignVerifyFailures) {
- if (!SupportsRsaKeyImport())
+ if (!SupportsRsaPrivateKeyImport())
return;
// Import a key pair.
@@ -3271,7 +3262,7 @@ TEST(WebCryptoRsaSsaTest, SignVerifyFailures) {
}
TEST(WebCryptoRsaSsaTest, SignVerifyKnownAnswer) {
- if (!SupportsRsaKeyImport())
+ if (!SupportsRsaPrivateKeyImport())
return;
scoped_ptr<base::ListValue> tests;
@@ -4750,7 +4741,7 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairIntersectUsages) {
// key pair (using SPKI format for public key, PKCS8 format for private key).
// Then unwrap the wrapped key pair and verify that the key data is the same.
TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) {
- if (!SupportsRsaKeyImport())
+ if (!SupportsRsaPrivateKeyImport())
return;
// Generate the wrapping key.
« no previous file with comments | « content/child/webcrypto/nss/rsa_key_nss.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698