summaryrefslogtreecommitdiffstats
path: root/content/child
diff options
context:
space:
mode:
Diffstat (limited to 'content/child')
-rw-r--r--content/child/webcrypto/generate_key_result.cc6
-rw-r--r--content/child/webcrypto/openssl/rsa_key_openssl.cc4
-rw-r--r--content/child/webcrypto/test/aes_cbc_unittest.cc76
-rw-r--r--content/child/webcrypto/test/aes_gcm_unittest.cc2
-rw-r--r--content/child/webcrypto/test/aes_kw_unittest.cc28
-rw-r--r--content/child/webcrypto/test/hmac_unittest.cc20
-rw-r--r--content/child/webcrypto/test/rsa_oaep_unittest.cc38
-rw-r--r--content/child/webcrypto/test/rsa_ssa_unittest.cc60
-rw-r--r--content/child/webcrypto/test/test_helpers.cc4
-rw-r--r--content/child/webcrypto/webcrypto_impl.cc6
10 files changed, 119 insertions, 125 deletions
diff --git a/content/child/webcrypto/generate_key_result.cc b/content/child/webcrypto/generate_key_result.cc
index 1709e47..3c61657 100644
--- a/content/child/webcrypto/generate_key_result.cc
+++ b/content/child/webcrypto/generate_key_result.cc
@@ -10,11 +10,7 @@ namespace content {
namespace webcrypto {
-GenerateKeyResult::GenerateKeyResult()
- : type_(TYPE_NULL),
- secret_key_(blink::WebCryptoKey::createNull()),
- public_key_(blink::WebCryptoKey::createNull()),
- private_key_(blink::WebCryptoKey::createNull()) {
+GenerateKeyResult::GenerateKeyResult() : type_(TYPE_NULL) {
}
GenerateKeyResult::Type GenerateKeyResult::type() const {
diff --git a/content/child/webcrypto/openssl/rsa_key_openssl.cc b/content/child/webcrypto/openssl/rsa_key_openssl.cc
index 13b2333..b93de69 100644
--- a/content/child/webcrypto/openssl/rsa_key_openssl.cc
+++ b/content/child/webcrypto/openssl/rsa_key_openssl.cc
@@ -284,8 +284,8 @@ Status RsaHashedAlgorithm::GenerateKey(
return Status::OperationError();
}
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
// Note that extractable is unconditionally set to true. This is because per
// the WebCrypto spec generated public keys are always public.
diff --git a/content/child/webcrypto/test/aes_cbc_unittest.cc b/content/child/webcrypto/test/aes_cbc_unittest.cc
index 467f8ed..7ad0e27 100644
--- a/content/child/webcrypto/test/aes_cbc_unittest.cc
+++ b/content/child/webcrypto/test/aes_cbc_unittest.cc
@@ -110,7 +110,7 @@ TEST(WebCryptoAesCbcTest, KeyTooSmall) {
std::vector<uint8_t> key_raw(1);
std::vector<uint8_t> iv(16);
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
EXPECT_EQ(Status::ErrorImportAesKeyLength(),
ImportKey(blink::WebCryptoKeyFormatRaw,
CryptoData(key_raw),
@@ -134,7 +134,7 @@ TEST(WebCryptoAesCbcTest, ExportKeyUnsupportedFormat) {
}
TEST(WebCryptoAesCbcTest, ImportKeyUnsupportedFormat) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(Status::ErrorUnsupportedImportKeyFormat(),
ImportKey(blink::WebCryptoKeyFormatSpki,
CryptoData(HexStringToBytes(kPublicKeySpkiDerHex)),
@@ -254,7 +254,7 @@ TEST(WebCryptoAesCbcTest, GenerateKeyIsRandom) {
const unsigned short kKeyLength[] = {128, 256};
for (size_t key_length_i = 0; key_length_i < arraysize(kKeyLength);
++key_length_i) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
std::vector<std::vector<uint8_t> > keys;
std::vector<uint8_t> key_bytes;
@@ -283,7 +283,7 @@ TEST(WebCryptoAesCbcTest, GenerateKeyIsRandom) {
TEST(WebCryptoAesCbcTest, GenerateKeyBadLength) {
const unsigned short kKeyLen[] = {0, 127, 257};
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
for (size_t i = 0; i < arraysize(kKeyLen); ++i) {
SCOPED_TRACE(i);
EXPECT_EQ(Status::ErrorGenerateKeyLength(),
@@ -294,7 +294,7 @@ TEST(WebCryptoAesCbcTest, GenerateKeyBadLength) {
// If key_ops is specified but empty, no key usages are allowed for the key.
TEST(WebCryptoAesCbcTest, ImportKeyJwkEmptyKeyOps) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetBoolean("ext", false);
@@ -332,7 +332,7 @@ TEST(WebCryptoAesCbcTest, ImportKeyJwkEmptyKeyOps) {
// If key_ops is missing, then any key usages can be specified.
TEST(WebCryptoAesCbcTest, ImportKeyJwkNoKeyOps) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -358,7 +358,7 @@ TEST(WebCryptoAesCbcTest, ImportKeyJwkNoKeyOps) {
}
TEST(WebCryptoAesCbcTest, ImportKeyJwkKeyOpsEncryptDecrypt) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -404,7 +404,7 @@ TEST(WebCryptoAesCbcTest, ImportKeyJwkKeyOpsEncryptDecrypt) {
// Test failure if input usage is NOT a strict subset of the JWK usage.
TEST(WebCryptoAesCbcTest, ImportKeyJwkKeyOpsNotSuperset) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -424,7 +424,7 @@ TEST(WebCryptoAesCbcTest, ImportKeyJwkKeyOpsNotSuperset) {
}
TEST(WebCryptoAesCbcTest, ImportKeyJwkUseEnc) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -449,7 +449,7 @@ TEST(WebCryptoAesCbcTest, ImportKeyJwkUseEnc) {
}
TEST(WebCryptoAesCbcTest, ImportJwkInvalidJson) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
// Fail on empty JSON.
EXPECT_EQ(Status::ErrorImportEmptyKeyData(),
ImportKey(blink::WebCryptoKeyFormatJwk,
@@ -476,7 +476,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkInvalidJson) {
// Fail on JWK alg present but incorrect (expecting A128CBC).
TEST(WebCryptoAesCbcTest, ImportJwkIncorrectAlg) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -494,7 +494,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkIncorrectAlg) {
// Fail on invalid kty.
TEST(WebCryptoAesCbcTest, ImportJwkInvalidKty) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "foo");
@@ -510,7 +510,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkInvalidKty) {
// Fail on missing kty.
TEST(WebCryptoAesCbcTest, ImportJwkMissingKty) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -525,7 +525,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkMissingKty) {
// Fail on kty wrong type.
TEST(WebCryptoAesCbcTest, ImportJwkKtyWrongType) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetDouble("kty", 0.1);
@@ -542,7 +542,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkKtyWrongType) {
// Fail on invalid use.
TEST(WebCryptoAesCbcTest, ImportJwkUnrecognizedUse) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -560,7 +560,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkUnrecognizedUse) {
// Fail on invalid use (wrong type).
TEST(WebCryptoAesCbcTest, ImportJwkUseWrongType) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -578,7 +578,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkUseWrongType) {
// Fail on invalid extractable (wrong type).
TEST(WebCryptoAesCbcTest, ImportJwkExtWrongType) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -596,7 +596,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkExtWrongType) {
// Fail on invalid key_ops (wrong type).
TEST(WebCryptoAesCbcTest, ImportJwkKeyOpsWrongType) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -615,7 +615,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkKeyOpsWrongType) {
// Fail on inconsistent key_ops - asking for "encrypt" however JWK contains
// only "foo".
TEST(WebCryptoAesCbcTest, ImportJwkKeyOpsLacksUsages) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -636,7 +636,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkKeyOpsLacksUsages) {
// Import a JWK with unrecognized values for "key_ops".
TEST(WebCryptoAesCbcTest, ImportJwkUnrecognizedKeyOps) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
blink::WebCryptoAlgorithm algorithm =
CreateAlgorithm(blink::WebCryptoAlgorithmIdAesCbc);
blink::WebCryptoKeyUsageMask usage_mask = blink::WebCryptoKeyUsageEncrypt;
@@ -660,7 +660,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkUnrecognizedKeyOps) {
// Import a JWK with a value in key_ops array that is not a string.
TEST(WebCryptoAesCbcTest, ImportJwkNonStringKeyOp) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
blink::WebCryptoAlgorithm algorithm =
CreateAlgorithm(blink::WebCryptoAlgorithmIdAesCbc);
blink::WebCryptoKeyUsageMask usage_mask = blink::WebCryptoKeyUsageEncrypt;
@@ -682,7 +682,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkNonStringKeyOp) {
// Fail on missing k.
TEST(WebCryptoAesCbcTest, ImportJwkMissingK) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -698,7 +698,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkMissingK) {
// Fail on bad b64 encoding for k.
TEST(WebCryptoAesCbcTest, ImportJwkBadB64ForK) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -714,7 +714,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkBadB64ForK) {
// Fail on empty k.
TEST(WebCryptoAesCbcTest, ImportJwkEmptyK) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -731,7 +731,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkEmptyK) {
// Fail on empty k (with alg specified).
TEST(WebCryptoAesCbcTest, ImportJwkEmptyK2) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -750,7 +750,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkEmptyK2) {
// Fail on k actual length (120 bits) inconsistent with the embedded JWK alg
// value (128) for an AES key.
TEST(WebCryptoAesCbcTest, ImportJwkInconsistentKLength) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -768,7 +768,7 @@ TEST(WebCryptoAesCbcTest, ImportJwkInconsistentKLength) {
// Fail on k actual length (192 bits) inconsistent with the embedded JWK alg
// value (128) for an AES key.
TEST(WebCryptoAesCbcTest, ImportJwkInconsistentKLength2) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -810,7 +810,7 @@ TEST(WebCryptoAesCbcTest, ImportExportJwk) {
// AES 192-bit is not allowed: http://crbug.com/381829
TEST(WebCryptoAesCbcTest, ImportAesCbc192Raw) {
std::vector<uint8_t> key_raw(24, 0);
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
Status status = ImportKey(blink::WebCryptoKeyFormatRaw,
CryptoData(key_raw),
CreateAlgorithm(blink::WebCryptoAlgorithmIdAesCbc),
@@ -822,7 +822,7 @@ TEST(WebCryptoAesCbcTest, ImportAesCbc192Raw) {
// AES 192-bit is not allowed: http://crbug.com/381829
TEST(WebCryptoAesCbcTest, ImportAesCbc192Jwk) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
@@ -840,7 +840,7 @@ TEST(WebCryptoAesCbcTest, ImportAesCbc192Jwk) {
// AES 192-bit is not allowed: http://crbug.com/381829
TEST(WebCryptoAesCbcTest, GenerateAesCbc192) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
Status status = GenerateSecretKey(CreateAesCbcKeyGenAlgorithm(192),
true,
blink::WebCryptoKeyUsageEncrypt,
@@ -859,7 +859,7 @@ TEST(WebCryptoAesCbcTest, UnwrapAesCbc192) {
CreateAlgorithm(blink::WebCryptoAlgorithmIdAesKw),
blink::WebCryptoKeyUsageUnwrapKey);
- blink::WebCryptoKey unwrapped_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_key;
ASSERT_EQ(Status::ErrorAes192BitUnsupported(),
UnwrapKey(blink::WebCryptoKeyFormatRaw,
CryptoData(wrapped_key),
@@ -890,7 +890,7 @@ TEST(WebCryptoAesCbcTest, ImportKeyBadUsage_Raw) {
for (size_t i = 0; i < arraysize(bad_usages); ++i) {
SCOPED_TRACE(i);
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(Status::ErrorCreateKeyBadUsages(),
ImportKey(blink::WebCryptoKeyFormatRaw,
CryptoData(key_bytes),
@@ -912,7 +912,7 @@ TEST(WebCryptoAesCbcTest, GenerateKeyBadUsages) {
for (size_t i = 0; i < arraysize(bad_usages); ++i) {
SCOPED_TRACE(i);
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(Status::ErrorCreateKeyBadUsages(),
GenerateSecretKey(
@@ -928,7 +928,7 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) {
return;
// Generate the wrapping key.
- blink::WebCryptoKey wrapping_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey wrapping_key;
ASSERT_EQ(Status::Success(),
GenerateSecretKey(CreateAesCbcKeyGenAlgorithm(128),
true,
@@ -940,8 +940,8 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) {
const unsigned int modulus_length = 256;
const std::vector<uint8_t> public_exponent = HexStringToBytes("010001");
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
ASSERT_EQ(Status::Success(),
GenerateKeyPair(CreateRsaHashedKeyGenAlgorithm(
blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
@@ -990,7 +990,7 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) {
CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
blink::WebCryptoAlgorithmIdSha256);
- blink::WebCryptoKey unwrapped_public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_public_key;
ASSERT_EQ(Status::Success(),
UnwrapKey(blink::WebCryptoKeyFormatSpki,
@@ -1002,7 +1002,7 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) {
0,
&unwrapped_public_key));
- blink::WebCryptoKey unwrapped_private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_private_key;
ASSERT_EQ(Status::Success(),
UnwrapKey(blink::WebCryptoKeyFormatPkcs8,
diff --git a/content/child/webcrypto/test/aes_gcm_unittest.cc b/content/child/webcrypto/test/aes_gcm_unittest.cc
index 8f4b910..8825741 100644
--- a/content/child/webcrypto/test/aes_gcm_unittest.cc
+++ b/content/child/webcrypto/test/aes_gcm_unittest.cc
@@ -109,7 +109,7 @@ TEST(WebCryptoAesGcmTest, GenerateKeyBadLength) {
}
const unsigned short kKeyLen[] = {0, 127, 257};
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
for (size_t i = 0; i < arraysize(kKeyLen); ++i) {
SCOPED_TRACE(i);
EXPECT_EQ(Status::ErrorGenerateKeyLength(),
diff --git a/content/child/webcrypto/test/aes_kw_unittest.cc b/content/child/webcrypto/test/aes_kw_unittest.cc
index f75b020..5b073d9 100644
--- a/content/child/webcrypto/test/aes_kw_unittest.cc
+++ b/content/child/webcrypto/test/aes_kw_unittest.cc
@@ -25,7 +25,7 @@ blink::WebCryptoAlgorithm CreateAesKwKeyGenAlgorithm(
TEST(WebCryptoAesKwTest, GenerateKeyBadLength) {
const unsigned short kKeyLen[] = {0, 127, 257};
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
for (size_t i = 0; i < arraysize(kKeyLen); ++i) {
SCOPED_TRACE(i);
EXPECT_EQ(Status::ErrorGenerateKeyLength(),
@@ -35,7 +35,7 @@ TEST(WebCryptoAesKwTest, GenerateKeyBadLength) {
}
TEST(WebCryptoAesKwTest, ImportKeyJwkKeyOpsWrapUnwrap) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -87,7 +87,7 @@ TEST(WebCryptoAesKwTest, ImportExportJwk) {
}
TEST(WebCryptoAesKwTest, AesKwKeyImport) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
blink::WebCryptoAlgorithm algorithm =
CreateAlgorithm(blink::WebCryptoAlgorithmIdAesKw);
@@ -180,7 +180,7 @@ TEST(WebCryptoAesKwTest, UnwrapFailures) {
const std::vector<uint8_t> test_ciphertext =
GetBytesFromHexString(test, "ciphertext");
- blink::WebCryptoKey unwrapped_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_key;
// Using a wrapping algorithm that does not match the wrapping key algorithm
// should fail.
@@ -237,7 +237,7 @@ TEST(WebCryptoAesKwTest, AesKwRawSymkeyWrapUnwrapKnownAnswer) {
EXPECT_BYTES_EQ(test_ciphertext, wrapped_key);
// Unwrap the known ciphertext to get a new test_key.
- blink::WebCryptoKey unwrapped_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_key;
ASSERT_EQ(
Status::Success(),
UnwrapKey(blink::WebCryptoKeyFormatRaw,
@@ -282,7 +282,7 @@ TEST(WebCryptoAesKwTest, AesKwRawSymkeyUnwrapSignVerifyHmac) {
test_kek, wrapping_algorithm, blink::WebCryptoKeyUsageUnwrapKey);
// Unwrap the known ciphertext.
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(
Status::Success(),
UnwrapKey(blink::WebCryptoKeyFormatRaw,
@@ -349,7 +349,7 @@ TEST(WebCryptoAesKwTest, AesKwRawSymkeyWrapUnwrapErrors) {
// Unwrap with wrapped data too small must fail.
const std::vector<uint8_t> small_data(test_ciphertext.begin(),
test_ciphertext.begin() + 23);
- blink::WebCryptoKey unwrapped_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_key;
EXPECT_EQ(Status::ErrorDataTooSmall(),
UnwrapKey(blink::WebCryptoKeyFormatRaw,
CryptoData(small_data),
@@ -395,7 +395,7 @@ TEST(WebCryptoAesKwTest, AesKwRawSymkeyUnwrapCorruptData) {
// Unwrap of a corrupted version of the known ciphertext should fail, due to
// AES-KW's built-in integrity check.
- blink::WebCryptoKey unwrapped_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_key;
EXPECT_EQ(Status::OperationError(),
UnwrapKey(blink::WebCryptoKeyFormatRaw,
CryptoData(Corrupted(test_ciphertext)),
@@ -432,7 +432,7 @@ TEST(WebCryptoAesKwTest, AesKwJwkSymkeyUnwrapKnownData) {
wrapping_key_data, wrapping_algorithm, blink::WebCryptoKeyUsageUnwrapKey);
// Unwrap the known wrapped key data to produce a new key
- blink::WebCryptoKey unwrapped_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_key;
ASSERT_EQ(
Status::Success(),
UnwrapKey(blink::WebCryptoKeyFormatJwk,
@@ -483,7 +483,7 @@ TEST(WebCryptoAesKwTest, ImportKeyBadUsage_Raw) {
for (size_t i = 0; i < arraysize(bad_usages); ++i) {
SCOPED_TRACE(i);
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(Status::ErrorCreateKeyBadUsages(),
ImportKey(blink::WebCryptoKeyFormatRaw,
CryptoData(key_bytes),
@@ -510,7 +510,7 @@ TEST(WebCryptoAesKwTest, UnwrapHmacKeyBadUsage_JWK) {
};
// Import the wrapping key.
- blink::WebCryptoKey wrapping_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey wrapping_key;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatRaw,
CryptoData(std::vector<uint8_t>(16)),
@@ -529,7 +529,7 @@ TEST(WebCryptoAesKwTest, UnwrapHmacKeyBadUsage_JWK) {
for (size_t i = 0; i < arraysize(bad_usages); ++i) {
SCOPED_TRACE(i);
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(
Status::ErrorCreateKeyBadUsages(),
@@ -560,7 +560,7 @@ TEST(WebCryptoAesKwTest, UnwrapRsaSsaPublicKeyBadUsage_JWK) {
};
// Import the wrapping key.
- blink::WebCryptoKey wrapping_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey wrapping_key;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatRaw,
CryptoData(std::vector<uint8_t>(16)),
@@ -584,7 +584,7 @@ TEST(WebCryptoAesKwTest, UnwrapRsaSsaPublicKeyBadUsage_JWK) {
for (size_t i = 0; i < arraysize(bad_usages); ++i) {
SCOPED_TRACE(i);
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(Status::ErrorCreateKeyBadUsages(),
UnwrapKey(blink::WebCryptoKeyFormatJwk,
diff --git a/content/child/webcrypto/test/hmac_unittest.cc b/content/child/webcrypto/test/hmac_unittest.cc
index fe5d082..3ec123b 100644
--- a/content/child/webcrypto/test/hmac_unittest.cc
+++ b/content/child/webcrypto/test/hmac_unittest.cc
@@ -118,7 +118,7 @@ TEST(WebCryptoHmacTest, GenerateKeyIsRandom) {
std::vector<std::vector<uint8_t> > keys;
for (int i = 0; i < 16; ++i) {
std::vector<uint8_t> key_bytes;
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
blink::WebCryptoAlgorithm algorithm =
CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha1, 512);
ASSERT_EQ(Status::Success(), GenerateSecretKey(algorithm, true, 0, &key));
@@ -143,7 +143,7 @@ TEST(WebCryptoHmacTest, GenerateKeyIsRandom) {
// If the key length is not provided, then the block size is used.
TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha1) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
blink::WebCryptoAlgorithm algorithm =
CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha1, 0);
ASSERT_EQ(Status::Success(), GenerateSecretKey(algorithm, true, 0, &key));
@@ -161,7 +161,7 @@ TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha1) {
// If the key length is not provided, then the block size is used.
TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha512) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
blink::WebCryptoAlgorithm algorithm =
CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha512, 0);
ASSERT_EQ(Status::Success(), GenerateSecretKey(algorithm, true, 0, &key));
@@ -176,7 +176,7 @@ TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha512) {
}
TEST(WebCryptoHmacTest, ImportKeyJwkKeyOpsSignVerify) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -210,7 +210,7 @@ TEST(WebCryptoHmacTest, ImportKeyJwkKeyOpsSignVerify) {
// Test 'use' inconsistent with 'key_ops'.
TEST(WebCryptoHmacTest, ImportKeyJwkUseInconsisteWithKeyOps) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -233,7 +233,7 @@ TEST(WebCryptoHmacTest, ImportKeyJwkUseInconsisteWithKeyOps) {
// Test JWK composite 'sig' use
TEST(WebCryptoHmacTest, ImportKeyJwkUseSig) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -256,7 +256,7 @@ TEST(WebCryptoHmacTest, ImportJwkInputConsistency) {
// inconsistent with the input value, the operation must fail.
// Consistency rules when JWK value is not present: Inputs should be used.
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
bool extractable = false;
blink::WebCryptoAlgorithm algorithm =
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha256);
@@ -408,7 +408,7 @@ TEST(WebCryptoHmacTest, ImportJwkHappy) {
// This test verifies the happy path of JWK import, including the application
// of the imported key material.
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
bool extractable = false;
blink::WebCryptoAlgorithm algorithm =
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha256);
@@ -488,7 +488,7 @@ TEST(WebCryptoHmacTest, ExportJwkEmptyKey) {
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha1);
blink::WebCryptoKeyUsageMask usages = blink::WebCryptoKeyUsageSign;
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
// Import a zero-byte HMAC key.
const char key_data_hex[] = "";
@@ -527,7 +527,7 @@ TEST(WebCryptoHmacTest, ExportJwkEmptyKey) {
TEST(WebCryptoHmacTest, ImportRawKeyTooLarge) {
CryptoData big_data(NULL, UINT_MAX); // Invalid data of big length.
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
EXPECT_EQ(
Status::ErrorDataTooLarge(),
ImportKey(blink::WebCryptoKeyFormatRaw,
diff --git a/content/child/webcrypto/test/rsa_oaep_unittest.cc b/content/child/webcrypto/test/rsa_oaep_unittest.cc
index f6bec71..972ffaa 100644
--- a/content/child/webcrypto/test/rsa_oaep_unittest.cc
+++ b/content/child/webcrypto/test/rsa_oaep_unittest.cc
@@ -47,7 +47,7 @@ TEST(WebCryptoRsaOaepTest, ImportPkcs8WithRsaEncryption) {
return;
}
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey private_key;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatPkcs8,
CryptoData(HexStringToBytes(kPrivateKeyPkcs8DerHex)),
@@ -67,7 +67,7 @@ TEST(WebCryptoRsaOaepTest, ImportPublicJwkWithNoAlg) {
scoped_ptr<base::DictionaryValue> jwk(CreatePublicKeyJwkDict());
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::Success(),
ImportKeyJwkFromDict(*jwk.get(),
CreateRsaHashedImportAlgorithm(
@@ -87,7 +87,7 @@ TEST(WebCryptoRsaOaepTest, ImportPublicJwkWithMatchingAlg) {
scoped_ptr<base::DictionaryValue> jwk(CreatePublicKeyJwkDict());
jwk->SetString("alg", "RSA-OAEP");
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::Success(),
ImportKeyJwkFromDict(*jwk.get(),
CreateRsaHashedImportAlgorithm(
@@ -107,7 +107,7 @@ TEST(WebCryptoRsaOaepTest, ImportPublicJwkWithMismatchedAlgFails) {
scoped_ptr<base::DictionaryValue> jwk(CreatePublicKeyJwkDict());
jwk->SetString("alg", "RSA-OAEP-512");
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::ErrorJwkAlgorithmInconsistent(),
ImportKeyJwkFromDict(*jwk.get(),
CreateRsaHashedImportAlgorithm(
@@ -128,7 +128,7 @@ TEST(WebCryptoRsaOaepTest, ImportPublicJwkWithMismatchedTypeFails) {
jwk->SetString("kty", "oct");
jwk->SetString("alg", "RSA-OAEP");
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::ErrorJwkUnexpectedKty("RSA"),
ImportKeyJwkFromDict(*jwk.get(),
CreateRsaHashedImportAlgorithm(
@@ -160,7 +160,7 @@ TEST(WebCryptoRsaOaepTest, ExportPublicJwk) {
jwk->SetString("alg", test_data.expected_jwk_alg);
// Import the key in a known-good format
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::Success(),
ImportKeyJwkFromDict(
*jwk.get(),
@@ -210,8 +210,8 @@ TEST(WebCryptoRsaOaepTest, EncryptDecryptKnownAnswerTest) {
blink::WebCryptoAlgorithm import_algorithm = CreateRsaHashedImportAlgorithm(
blink::WebCryptoAlgorithmIdRsaOaep, digest_algorithm.id());
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
ASSERT_NO_FATAL_FAILURE(ImportRsaKeyPair(public_key_der,
private_key_der,
@@ -256,7 +256,7 @@ TEST(WebCryptoRsaOaepTest, EncryptWithLargeMessageFails) {
scoped_ptr<base::DictionaryValue> jwk(CreatePublicKeyJwkDict());
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::Success(),
ImportKeyJwkFromDict(*jwk.get(),
CreateRsaHashedImportAlgorithm(
@@ -323,7 +323,7 @@ TEST(WebCryptoRsaOaepTest, EncryptWithLargeDigestFails) {
scoped_ptr<base::DictionaryValue> jwk(CreatePublicKeyJwkDict());
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::Success(),
ImportKeyJwkFromDict(*jwk.get(),
CreateRsaHashedImportAlgorithm(
@@ -353,7 +353,7 @@ TEST(WebCryptoRsaOaepTest, DecryptWithLargeMessageFails) {
return;
}
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey private_key;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatPkcs8,
CryptoData(HexStringToBytes(kPrivateKeyPkcs8DerHex)),
@@ -387,8 +387,8 @@ TEST(WebCryptoRsaOaepTest, WrapUnwrapRawKey) {
blink::WebCryptoAlgorithm import_algorithm = CreateRsaHashedImportAlgorithm(
blink::WebCryptoAlgorithmIdRsaOaep, blink::WebCryptoAlgorithmIdSha1);
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
ASSERT_NO_FATAL_FAILURE(ImportRsaKeyPair(
HexStringToBytes(kPublicKeySpkiDerHex),
@@ -432,7 +432,7 @@ TEST(WebCryptoRsaOaepTest, WrapUnwrapRawKey) {
EXPECT_BYTES_EQ_HEX(key_hex, decrypted_key);
// Now attempt to unwrap the key, which should also decrypt the data.
- blink::WebCryptoKey unwrapped_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_key;
ASSERT_EQ(Status::Success(),
UnwrapKey(blink::WebCryptoKeyFormatRaw,
CryptoData(wrapped_key),
@@ -505,8 +505,8 @@ TEST(WebCryptoRsaOaepTest, WrapUnwrapJwkSymKey) {
"37f3e1972c45a477e66db95c9609bb27f862700ef93379930786cf751b";
blink::WebCryptoAlgorithm import_algorithm = CreateRsaHashedImportAlgorithm(
blink::WebCryptoAlgorithmIdRsaOaep, blink::WebCryptoAlgorithmIdSha1);
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
ASSERT_NO_FATAL_FAILURE(ImportRsaKeyPair(
HexStringToBytes(kPublicKey2048SpkiDerHex),
@@ -551,7 +551,7 @@ TEST(WebCryptoRsaOaepTest, WrapUnwrapJwkSymKey) {
decrypted_jwk, "A128CBC", key_hex, blink::WebCryptoKeyUsageEncrypt));
// Now attempt to unwrap the key, which should also decrypt the data.
- blink::WebCryptoKey unwrapped_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey unwrapped_key;
ASSERT_EQ(Status::Success(),
UnwrapKey(blink::WebCryptoKeyFormatJwk,
CryptoData(wrapped_key),
@@ -598,7 +598,7 @@ TEST(WebCryptoRsaOaepTest, ImportExportJwkRsaPublicKey) {
test.hash);
// Import the spki to create a public key
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatSpki,
CryptoData(HexStringToBytes(kPublicKeySpkiDerHex)),
@@ -618,7 +618,7 @@ TEST(WebCryptoRsaOaepTest, ImportExportJwkRsaPublicKey) {
test.usage));
// Import the JWK back in to create a new key
- blink::WebCryptoKey public_key2 = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key2;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatJwk,
CryptoData(jwk),
diff --git a/content/child/webcrypto/test/rsa_ssa_unittest.cc b/content/child/webcrypto/test/rsa_ssa_unittest.cc
index 33d0751..3ce88b1 100644
--- a/content/child/webcrypto/test/rsa_ssa_unittest.cc
+++ b/content/child/webcrypto/test/rsa_ssa_unittest.cc
@@ -38,7 +38,7 @@ void RestoreJwkRsaDictionary(base::DictionaryValue* dict) {
TEST(WebCryptoRsaSsaTest, ImportExportSpki) {
// Passing case: Import a valid RSA key in SPKI format.
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatSpki,
CryptoData(HexStringToBytes(kPublicKeySpkiDerHex)),
@@ -127,7 +127,7 @@ TEST(WebCryptoRsaSsaTest, ImportExportPkcs8) {
return;
// Passing case: Import a valid RSA key in PKCS#8 format.
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatPkcs8,
CryptoData(HexStringToBytes(kPrivateKeyPkcs8DerHex)),
@@ -226,7 +226,7 @@ TEST(WebCryptoRsaSsaTest, ImportInvalidPkcs8) {
HexStringToBytes(kPrivateKeyPkcs8DerHex);
corrupted_data[i] = ~corrupted_data[i];
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
EXPECT_EQ(Status::DataError(),
ImportKey(blink::WebCryptoKeyFormatPkcs8,
CryptoData(corrupted_data),
@@ -247,7 +247,7 @@ TEST(WebCryptoRsaSsaTest, ImportRsaPrivateKeyJwkToPkcs8RoundTrip) {
if (!SupportsRsaPrivateKeyImport())
return;
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatPkcs8,
CryptoData(HexStringToBytes(kPrivateKeyPkcs8DerHex)),
@@ -341,7 +341,7 @@ TEST(WebCryptoRsaSsaTest, ImportMultipleRSAPrivateKeysJwk) {
int modulus_length_bits = 0;
ASSERT_TRUE(key_values->GetInteger("modulusLength", &modulus_length_bits));
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey private_key;
// Import the key from JWK.
ASSERT_EQ(
@@ -389,7 +389,7 @@ TEST(WebCryptoRsaSsaTest, ImportJwkExistingModulusAndInvalid) {
base::DictionaryValue* key1_jwk;
ASSERT_TRUE(key1_props->GetDictionary("jwk", &key1_jwk));
- blink::WebCryptoKey key1 = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key1;
ASSERT_EQ(Status::Success(),
ImportKeyJwkFromDict(*key1_jwk,
CreateRsaHashedImportAlgorithm(
@@ -413,7 +413,7 @@ TEST(WebCryptoRsaSsaTest, ImportJwkExistingModulusAndInvalid) {
// This should fail, as the n,e,d parameters are not consistent. It MUST NOT
// somehow return the key created earlier.
- blink::WebCryptoKey key2 = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key2;
ASSERT_EQ(Status::OperationError(),
ImportKeyJwkFromDict(*key2_jwk,
CreateRsaHashedImportAlgorithm(
@@ -432,7 +432,7 @@ TEST(WebCryptoRsaSsaTest, ImportJwkExistingModulusAndInvalid) {
// This fails because JWA says that producers must include either ALL optional
// parameters or NONE.
TEST(WebCryptoRsaSsaTest, ImportRsaPrivateKeyJwkMissingOptionalParams) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "RSA");
@@ -475,7 +475,7 @@ TEST(WebCryptoRsaSsaTest, ImportRsaPrivateKeyJwkIncorrectOptionalEmpty) {
if (!SupportsRsaPrivateKeyImport())
return;
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "RSA");
@@ -515,7 +515,7 @@ TEST(WebCryptoRsaSsaTest, ImportJwkRsaNonMinimalExponent) {
"p0LGxjD1M8jMcvYq6DPEC_JYQumEu3i9v5fAEH1VvbZi9cTg-rmEXLUUjvc5LdOq_5OuHmtm"
"e7PUJHYW1PW6ENTP0ibeiNOfFvs");
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
EXPECT_EQ(Status::ErrorJwkBigIntegerHasLeadingZero("e"),
ImportKeyJwkFromDict(dict,
@@ -540,8 +540,8 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairRsa) {
public_exponent);
bool extractable = true;
const blink::WebCryptoKeyUsageMask usage_mask = 0;
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
EXPECT_EQ(Status::Success(),
GenerateKeyPair(
@@ -732,8 +732,8 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairRsaBadModulusLength) {
public_exponent);
bool extractable = true;
const blink::WebCryptoKeyUsageMask usage_mask = 0;
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
EXPECT_EQ(
Status::ErrorGenerateRsaUnsupportedModulus(),
@@ -763,8 +763,8 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairRsaBadExponent) {
modulus_length,
HexStringToBytes(kPublicExponents[i]));
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
EXPECT_EQ(Status::ErrorGenerateKeyPublicExponent(),
GenerateKeyPair(algorithm, true, 0, &public_key, &private_key));
@@ -779,8 +779,8 @@ TEST(WebCryptoRsaSsaTest, SignVerifyFailures) {
blink::WebCryptoAlgorithm import_algorithm =
CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
blink::WebCryptoAlgorithmIdSha1);
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
ASSERT_NO_FATAL_FAILURE(
ImportRsaKeyPair(HexStringToBytes(kPublicKeySpkiDerHex),
HexStringToBytes(kPrivateKeyPkcs8DerHex),
@@ -872,7 +872,7 @@ TEST(WebCryptoRsaSsaTest, SignVerifyFailures) {
CryptoData(data),
&signature));
- blink::WebCryptoKey public_key_256 = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key_256;
EXPECT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatSpki,
CryptoData(HexStringToBytes(kPublicKeySpkiDerHex)),
@@ -914,8 +914,8 @@ TEST(WebCryptoRsaSsaTest, SignVerifyKnownAnswer) {
blink::WebCryptoAlgorithm import_algorithm =
CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
blink::WebCryptoAlgorithmIdSha1);
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
ASSERT_NO_FATAL_FAILURE(
ImportRsaKeyPair(HexStringToBytes(kPublicKeySpkiDerHex),
HexStringToBytes(kPrivateKeyPkcs8DerHex),
@@ -976,7 +976,7 @@ TEST(WebCryptoRsaSsaTest, ImportRsaSsaPublicKeyBadUsage_SPKI) {
for (size_t i = 0; i < arraysize(bad_usages); ++i) {
SCOPED_TRACE(i);
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::ErrorCreateKeyBadUsages(),
ImportKey(blink::WebCryptoKeyFormatSpki,
CryptoData(HexStringToBytes(kPublicKeySpkiDerHex)),
@@ -1009,7 +1009,7 @@ TEST(WebCryptoRsaSsaTest, ImportRsaSsaPublicKeyBadUsage_JWK) {
for (size_t i = 0; i < arraysize(bad_usages); ++i) {
SCOPED_TRACE(i);
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::ErrorCreateKeyBadUsages(),
ImportKeyJwkFromDict(
dict, algorithm, false, bad_usages[i], &public_key));
@@ -1031,8 +1031,8 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyBadUsages) {
for (size_t i = 0; i < arraysize(bad_usages); ++i) {
SCOPED_TRACE(i);
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
ASSERT_EQ(Status::ErrorCreateKeyBadUsages(),
GenerateKeyPair(CreateRsaHashedKeyGenAlgorithm(
@@ -1054,8 +1054,8 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairIntersectUsages) {
const unsigned int modulus_length = 256;
const std::vector<uint8_t> public_exponent = HexStringToBytes("010001");
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
- blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
+ blink::WebCryptoKey private_key;
ASSERT_EQ(Status::Success(),
GenerateKeyPair(
@@ -1112,7 +1112,7 @@ TEST(WebCryptoRsaSsaTest, ImportExportJwkRsaPublicKey) {
blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, test.hash);
// Import the spki to create a public key
- blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatSpki,
CryptoData(HexStringToBytes(kPublicKeySpkiDerHex)),
@@ -1132,7 +1132,7 @@ TEST(WebCryptoRsaSsaTest, ImportExportJwkRsaPublicKey) {
test.usage));
// Import the JWK back in to create a new key
- blink::WebCryptoKey public_key2 = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey public_key2;
ASSERT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatJwk,
CryptoData(jwk),
@@ -1160,7 +1160,7 @@ TEST(WebCryptoRsaSsaTest, ImportJwkRsaFailures) {
CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
blink::WebCryptoAlgorithmIdSha256);
blink::WebCryptoKeyUsageMask usage_mask = blink::WebCryptoKeyUsageVerify;
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
// An RSA public key JWK _must_ have an "n" (modulus) and an "e" (exponent)
// entry, while an RSA private key must have those plus at least a "d"
diff --git a/content/child/webcrypto/test/test_helpers.cc b/content/child/webcrypto/test/test_helpers.cc
index f7dc73c..f10538f 100644
--- a/content/child/webcrypto/test/test_helpers.cc
+++ b/content/child/webcrypto/test/test_helpers.cc
@@ -75,7 +75,7 @@ bool operator!=(const CryptoData& a, const CryptoData& b) {
bool SupportsAesGcm() {
std::vector<uint8_t> key_raw(16, 0);
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
Status status = ImportKey(blink::WebCryptoKeyFormatRaw,
CryptoData(key_raw),
CreateAlgorithm(blink::WebCryptoAlgorithmIdAesGcm),
@@ -344,7 +344,7 @@ blink::WebCryptoKey ImportSecretKeyFromRaw(
const std::vector<uint8_t>& key_raw,
const blink::WebCryptoAlgorithm& algorithm,
blink::WebCryptoKeyUsageMask usage) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
bool extractable = true;
EXPECT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatRaw,
diff --git a/content/child/webcrypto/webcrypto_impl.cc b/content/child/webcrypto/webcrypto_impl.cc
index 418c0f8..205d515 100644
--- a/content/child/webcrypto/webcrypto_impl.cc
+++ b/content/child/webcrypto/webcrypto_impl.cc
@@ -238,8 +238,7 @@ struct ImportKeyState : public BaseState {
key_data(key_data, key_data + key_data_size),
algorithm(algorithm),
extractable(extractable),
- usage_mask(usage_mask),
- key(blink::WebCryptoKey::createNull()) {}
+ usage_mask(usage_mask) {}
const blink::WebCryptoKeyFormat format;
const std::vector<uint8_t> key_data;
@@ -324,8 +323,7 @@ struct UnwrapKeyState : public BaseState {
unwrap_algorithm(unwrap_algorithm),
unwrapped_key_algorithm(unwrapped_key_algorithm),
extractable(extractable),
- usages(usages),
- unwrapped_key(blink::WebCryptoKey::createNull()) {}
+ usages(usages) {}
const blink::WebCryptoKeyFormat format;
const std::vector<uint8_t> wrapped_key;