| Index: crypto/rsa_private_key_unittest.cc
|
| diff --git a/crypto/rsa_private_key_unittest.cc b/crypto/rsa_private_key_unittest.cc
|
| index d53d50228d288b3c5cbe3472213df07a4a8302ab..a7253e2d447070b6b99c83881fd6da4f023e2b2a 100644
|
| --- a/crypto/rsa_private_key_unittest.cc
|
| +++ b/crypto/rsa_private_key_unittest.cc
|
| @@ -150,6 +150,20 @@ TEST(RSAPrivateKeyUnitTest, CopyTest) {
|
| ASSERT_EQ(input, privkey_copy);
|
| }
|
|
|
| +// Test that CreateFromPrivateKeyInfo fails if there is extra data after the RSA
|
| +// key.
|
| +TEST(RSAPrivateKeyUnitTest, ExtraData) {
|
| + std::vector<uint8> input(
|
| + kTestPrivateKeyInfo, kTestPrivateKeyInfo + sizeof(kTestPrivateKeyInfo));
|
| + input.push_back(0);
|
| +
|
| + scoped_ptr<crypto::RSAPrivateKey> key(
|
| + crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(input));
|
| +
|
| + // Import should fail.
|
| + EXPECT_FALSE(key);
|
| +}
|
| +
|
|
|
| // Verify that generated public keys look good. This test data was generated
|
| // with the openssl command line tool.
|
|
|