Rsa Key unittest.

Change-Id: I761db06762e594884f339aee66fec171c92b8108
This commit is contained in:
Kongqun Yang 2014-01-07 10:32:23 -08:00 committed by KongQun Yang
parent a725f3fd02
commit 1eb5236c90
8 changed files with 766 additions and 1 deletions

View File

@ -156,6 +156,6 @@ class AesCbcDecryptor {
DISALLOW_COPY_AND_ASSIGN(AesCbcDecryptor); DISALLOW_COPY_AND_ASSIGN(AesCbcDecryptor);
}; };
} // namespace } // namespace media
#endif // MEDIA_BASE_AES_ENCRYPTOR_H_ #endif // MEDIA_BASE_AES_ENCRYPTOR_H_

71
media/base/fake_prng.cc Normal file
View File

@ -0,0 +1,71 @@
// Copyright (c) 2013 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/fake_prng.h"
#include <openssl/rand.h>
#include "base/file_util.h"
#include "base/logging.h"
#include "media/base/test_data_util.h"
namespace {
FILE* g_rand_source_fp = NULL;
const char kFakePrngDataFile[] = "fake_prng_data.bin";
// RAND_bytes and RAND_pseudorand implementation.
int FakeBytes(uint8* buf, int num) {
DCHECK(buf);
DCHECK(g_rand_source_fp);
if (fread(buf, 1, num, g_rand_source_fp) < num) {
LOG(ERROR) << "Ran out of fake PRNG data";
return 0;
}
return 1;
}
const RAND_METHOD kFakeRandMethod = {NULL, // RAND_seed function.
FakeBytes, // RAND_bytes function.
NULL, // RAND_cleanup function.
NULL, // RAND_add function.
FakeBytes, // RAND_pseudorand function.
NULL}; // RAND_status function.
} // namespace
namespace media {
namespace fake_prng {
bool StartFakePrng() {
if (g_rand_source_fp) {
LOG(ERROR) << "Fake PRNG already started.";
return false;
}
// Open deterministic random data file and set the OpenSSL PRNG.
g_rand_source_fp =
file_util::OpenFile(GetTestDataFilePath(kFakePrngDataFile), "rb");
if (!g_rand_source_fp) {
LOG(ERROR) << "Cannot open " << kFakePrngDataFile;
return false;
}
RAND_set_rand_method(&kFakeRandMethod);
return true;
}
void StopFakePrng() {
if (g_rand_source_fp) {
file_util::CloseFile(g_rand_source_fp);
g_rand_source_fp = NULL;
} else {
LOG(WARNING) << "Fake PRNG not started.";
}
RAND_set_rand_method(RAND_SSLeay());
}
} // namespace fake_prng
} // namespace media

23
media/base/fake_prng.h Normal file
View File

@ -0,0 +1,23 @@
// Copyright (c) 2013 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Fake, deterministic PRNG for OpenSSL to be used for unit testing.
#ifndef MEDIA_BASE_FAKE_PRNG_H
#define MEDIA_BASE_FAKE_PRNG_H
namespace media {
namespace fake_prng {
// Start using fake, deterministic PRNG for OpenSSL.
// Return true if successful.
bool StartFakePrng();
// Stop using fake, deterministic PRNG for OpenSSL.
void StopFakePrng();
} // namespace fake_prng
} // namespace media
#endif // MEDIA_BASE_FAKE_PRNG_H

View File

@ -0,0 +1,146 @@
// Copyright (c) 2013 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Unit test for rsa_key RSA encryption and signing.
#include "media/base/rsa_key.h"
#include "base/memory/scoped_ptr.h"
#include "media/base/fake_prng.h"
#include "media/base/rsa_test_data.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
class RsaKeyTest : public ::testing::TestWithParam<RsaTestSet> {
public:
RsaKeyTest() : test_set_(GetParam()) {}
virtual void SetUp() {
// Make OpenSSL RSA deterministic.
ASSERT_TRUE(fake_prng::StartFakePrng());
private_key_.reset(RsaPrivateKey::Create(test_set_.private_key));
ASSERT_TRUE(private_key_ != NULL);
public_key_.reset(RsaPublicKey::Create(test_set_.public_key));
ASSERT_TRUE(public_key_ != NULL);
}
virtual void TearDown() { fake_prng::StopFakePrng(); }
protected:
const RsaTestSet& test_set_;
scoped_ptr<RsaPrivateKey> private_key_;
scoped_ptr<RsaPublicKey> public_key_;
};
TEST_P(RsaKeyTest, BadPublicKey) {
scoped_ptr<RsaPublicKey> public_key(RsaPublicKey::Create("bad_public_key"));
EXPECT_TRUE(public_key == NULL);
}
TEST_P(RsaKeyTest, BadPrivateKey) {
scoped_ptr<RsaPrivateKey> private_key(
RsaPrivateKey::Create("bad_private_key"));
EXPECT_TRUE(private_key == NULL);
}
TEST_P(RsaKeyTest, LoadPublicKey) {
scoped_ptr<RsaPublicKey> public_key(
RsaPublicKey::Create(test_set_.public_key));
EXPECT_TRUE(public_key != NULL);
}
TEST_P(RsaKeyTest, LoadPrivateKey) {
scoped_ptr<RsaPrivateKey> private_key(
RsaPrivateKey::Create(test_set_.private_key));
EXPECT_TRUE(private_key != NULL);
}
TEST_P(RsaKeyTest, LoadPublicKeyInPrivateKey) {
scoped_ptr<RsaPrivateKey> private_key(
RsaPrivateKey::Create(test_set_.public_key));
EXPECT_TRUE(private_key == NULL);
}
TEST_P(RsaKeyTest, LoadPrivateKeyInPublicKey) {
scoped_ptr<RsaPublicKey> public_key(
RsaPublicKey::Create(test_set_.private_key));
EXPECT_TRUE(public_key == NULL);
}
TEST_P(RsaKeyTest, EncryptAndDecrypt) {
std::string encrypted_message;
EXPECT_TRUE(public_key_->Encrypt(test_set_.test_message, &encrypted_message));
EXPECT_EQ(test_set_.encrypted_message, encrypted_message);
std::string decrypted_message;
EXPECT_TRUE(private_key_->Decrypt(encrypted_message, &decrypted_message));
EXPECT_EQ(test_set_.test_message, decrypted_message);
}
TEST_P(RsaKeyTest, BadEncMessage1) {
// Add a byte to the encrypted message.
std::string bad_enc_message = test_set_.encrypted_message + '\0';
std::string decrypted_message;
EXPECT_FALSE(private_key_->Decrypt(bad_enc_message, &decrypted_message));
}
TEST_P(RsaKeyTest, BadEncMessage2) {
// Remove a byte from the encrypted message.
std::string bad_enc_message = test_set_.encrypted_message;
bad_enc_message.erase(bad_enc_message.end() - 1);
std::string decrypted_message;
EXPECT_FALSE(private_key_->Decrypt(bad_enc_message, &decrypted_message));
}
TEST_P(RsaKeyTest, BadEncMessage3) {
// Change a byte in the encrypted message.
std::string bad_enc_message = test_set_.encrypted_message;
bad_enc_message[bad_enc_message.size() / 2] ^= 0x55;
std::string decrypted_message;
EXPECT_FALSE(private_key_->Decrypt(bad_enc_message, &decrypted_message));
}
TEST_P(RsaKeyTest, SignAndVerify) {
std::string signature;
EXPECT_TRUE(
private_key_->GenerateSignature(test_set_.test_message, &signature));
EXPECT_EQ(test_set_.signature, signature);
EXPECT_TRUE(public_key_->VerifySignature(test_set_.test_message, signature));
}
TEST_P(RsaKeyTest, BadSignature1) {
// Add a byte to the signature.
std::string bad_signature = test_set_.signature + '\0';
EXPECT_FALSE(
public_key_->VerifySignature(test_set_.test_message, bad_signature));
}
TEST_P(RsaKeyTest, BadSignature2) {
// Remove a byte from the signature.
std::string bad_signature = test_set_.signature;
bad_signature.erase(bad_signature.end() - 1);
EXPECT_FALSE(
public_key_->VerifySignature(test_set_.test_message, bad_signature));
}
TEST_P(RsaKeyTest, BadSignature3) {
// Change a byte in the signature.
std::string bad_signature = test_set_.signature;
bad_signature[bad_signature.size() / 2] ^= 0x55;
EXPECT_FALSE(
public_key_->VerifySignature(test_set_.test_message, bad_signature));
}
INSTANTIATE_TEST_CASE_P(RsaTestKeys,
RsaKeyTest,
::testing::Values(RsaTestData().test_set_3072_bits(),
RsaTestData().test_set_2048_bits()));
} // namespace media

475
media/base/rsa_test_data.cc Normal file
View File

@ -0,0 +1,475 @@
// Copyright (c) 2013 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/rsa_test_data.h"
namespace {
const uint8 kTestRsaPrivateKey_3072[] = {
0x30, 0x82, 0x06, 0xe3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x81, 0x00,
0xa5, 0x62, 0x07, 0xdf, 0xc8, 0x84, 0x74, 0xe1, 0x2a, 0xb7, 0xbb, 0xc0,
0x78, 0x76, 0xbe, 0x13, 0x3b, 0xe6, 0x2c, 0x09, 0x9d, 0x35, 0x3f, 0xf3,
0x0f, 0xe9, 0x61, 0x96, 0x20, 0x53, 0x6e, 0x78, 0x62, 0xe0,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 0x52, 0xa7, 0x21, 0x9f, 0x1f, 0x8f,
0x69, 0x23, 0x3b, 0xb8, 0xf9, 0x6d, 0xe7, 0xc1, 0x53, 0x9f, 0x8f, 0x67,
0xfc, 0x6e, 0x20, 0x18, 0x31, 0x89, 0xe7, 0xbb, 0xd4, 0xc1, 0x03, 0x67,
0xd6, 0xa5, 0x76, 0xc9, 0xea, 0x97, 0x93, 0x02, 0xca, 0x44, 0x52, 0x55,
0x0f, 0xed, 0x55, 0xb5, 0x49, 0xd6, 0x94, 0x59, 0xee, 0xcc, 0x1b, 0x5a,
0x00, 0x3d, 0xcd};
const uint8 kTestRsaPublicKey_3072[] = {
0x30, 0x82, 0x01, 0x8a, 0x02, 0x82, 0x01, 0x81, 0x00, 0xa5, 0x62, 0x07,
0xdf, 0xc8, 0x84, 0x74, 0xe1, 0x2a, 0xb7, 0xbb, 0xc0, 0x78, 0x76, 0xbe,
0x13, 0x3b, 0xe6, 0x2c, 0x09, 0x9d, 0x35, 0x3f, 0xf3, 0x0f, 0xe9, 0x61,
0x96, 0x20, 0x53, 0x6e, 0x78, 0x62, 0xe0, 0x10, 0xd2, 0xca, 0xe4, 0xdd,
0xd5, 0x96, 0xaf, 0x9a, 0xd7, 0x08, 0x47, 0xe4, 0x55, 0x1b, 0x83, 0xbe,
0x10, 0x66, 0x74, 0x08, 0xf2, 0x49, 0x79, 0xea, 0x29, 0x46, 0xc2, 0x65,
0x97, 0xa6, 0xcc, 0x4b, 0xa4, 0x08, 0xc3, 0x04, 0x17, 0x01, 0xb5, 0x11,
0x53, 0xe9, 0x68, 0x34, 0x3c, 0x26, 0x56, 0x44, 0x37, 0x5c, 0xb4, 0x7a,
0x1d, 0x5d, 0x6c, 0x58, 0xc2, 0x82, 0xa0, 0x92, 0xf1, 0x14, 0xf1, 0x22,
0xff, 0x64, 0xde, 0xdf, 0xb3, 0x3d, 0x9d, 0xa5, 0x86, 0xcd, 0xa0, 0x0a,
0x63, 0x08, 0xdd, 0x60, 0x5d, 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x4a, 0xe9, 0x4c,
0x46, 0x2b, 0xb6, 0xe1, 0xed, 0x82, 0xb2, 0xf0, 0xd1, 0x72, 0x71, 0x04,
0x35, 0x19, 0xc1, 0x16, 0x17, 0xd6, 0x75, 0xe0, 0xab, 0xde, 0x8f, 0xe1,
0xc1, 0x49, 0x68, 0x0c, 0xc8, 0xce, 0x6d, 0x87, 0x50, 0x04, 0xb5, 0xd7,
0x24, 0xf4, 0x2e, 0x0c, 0x11, 0x35, 0xb2, 0x67, 0x85, 0x1b, 0x38, 0xff,
0x2f, 0x71, 0xf5, 0x30, 0x18, 0x1e, 0x6f, 0xd7, 0xf0, 0x33, 0x61, 0x53,
0x7e, 0x55, 0x7f, 0x0d, 0x60, 0x83, 0xf3, 0x8a, 0x2b, 0x67, 0xd5, 0xf0,
0x2e, 0x23, 0x23, 0x60, 0x0b, 0x83, 0x9c, 0xc2, 0x87, 0x02, 0x03, 0x01,
0x00, 0x01};
const uint8 kTestRsaPrivateKey_2048[] = {
0x30, 0x82, 0x04, 0xa2, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
0xa7, 0x00, 0x36, 0x60, 0x65, 0xdc, 0xbd, 0x54, 0x5a, 0x2a, 0x40, 0xb4,
0xe1, 0x15, 0x94, 0x58, 0x11, 0x4f, 0x94, 0x58, 0xdd, 0xde, 0xa7, 0x1f,
0x3c, 0x2c, 0xe0, 0x88, 0x09, 0x29, 0x61, 0x57, 0x67, 0x5e, 0x56, 0x7e,
0xee, 0x27, 0x8f, 0x59, 0x34, 0x9a, 0x2a, 0xaa, 0x9d, 0xb4, 0x4e, 0xfa,
0xa7, 0x6a, 0xd4, 0xc9, 0x7a, 0x53, 0xc1, 0x4e, 0x9f, 0xe3, 0x34, 0xf7,
0x3d, 0xb7, 0xc9, 0x10, 0x47, 0x4f, 0x28, 0xda, 0x3f, 0xce, 0x31, 0x7b,
0xfd, 0x06, 0x10, 0xeb, 0xf7, 0xbe, 0x92, 0xf9, 0xaf, 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3b, 0x70, 0x1c, 0xd4, 0x48, 0xbe, 0xa7, 0x0a, 0xd9, 0xbe,
0xdc, 0xc3, 0x0c, 0x21, 0x33, 0xb3, 0x66, 0xff, 0x1c, 0x1b, 0xc8, 0x96,
0x76, 0xe8, 0x6f, 0x44, 0x74, 0xbc, 0x9b, 0x1c, 0x7d, 0xc8, 0xac, 0x21,
0xa8, 0x6e, 0x37, 0x02, 0x81, 0x80, 0x2c, 0x7c, 0xad, 0x1e, 0x75, 0xf6,
0x69, 0x1d, 0xe7, 0xa6, 0xca, 0x74, 0x7d, 0x67, 0xc8, 0x65, 0x28, 0x66,
0xc4, 0x43, 0xa6, 0xbd, 0x40, 0x57, 0xae, 0xb7, 0x65, 0x2c, 0x52, 0xf9,
0xe4, 0xc7, 0x81, 0x7b, 0x56, 0xa3, 0xd2, 0x0d, 0xe8, 0x33, 0x70, 0xcf,
0x06, 0x84, 0xb3, 0x4e, 0x44, 0x50, 0x75, 0x61, 0x96, 0x86, 0x4b, 0xb6,
0x2b, 0xad, 0xf0, 0xad, 0x57, 0xd0, 0x37, 0x0d, 0x1d, 0x35, 0x50, 0xcb,
0x69, 0x22, 0x39, 0x29, 0xb9, 0x3a, 0xd3, 0x29, 0x23, 0x02, 0x60, 0xf7,
0xab, 0x30, 0x40, 0xda, 0x8e, 0x4d, 0x45, 0x70, 0x26, 0xf4, 0xa2, 0x0d,
0xd0, 0x64, 0x5d, 0x47, 0x3c, 0x18, 0xf4, 0xd4, 0x52, 0x95, 0x00, 0xae,
0x84, 0x6b, 0x47, 0xb2, 0x3c, 0x82, 0xd3, 0x72, 0x53, 0xde, 0x72, 0x2c,
0xf7, 0xc1, 0x22, 0x36, 0xd9, 0x18, 0x56, 0xfe, 0x39, 0x28, 0x33, 0xe0,
0xdb, 0x03};
const uint8 kTestRsaPublicKey_2048[] = {
0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xa7, 0x00, 0x36,
0x60, 0x65, 0xdc, 0x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, 0xa2, 0xfc, 0xbb, 0x21,
0x18, 0x30, 0xda, 0xfe, 0x40, 0xfb, 0x01, 0xca, 0x2e, 0x37, 0x0e, 0xce,
0xdd, 0x76, 0x87, 0x82, 0x46, 0x0b, 0x3a, 0x77, 0x8f, 0xc0, 0x72, 0x07,
0x2c, 0x7f, 0x9d, 0x1e, 0x86, 0x5b, 0xed, 0x27, 0x29, 0xdf, 0x03, 0x97,
0x62, 0xef, 0x44, 0xd3, 0x5b, 0x3d, 0xdb, 0x9c, 0x5e, 0x1b, 0x7b, 0x39,
0xb4, 0x0b, 0x6d, 0x04, 0x6b, 0xbb, 0xbb, 0x2c, 0x5f, 0xcf, 0xb3, 0x7a,
0x05, 0x02, 0x03, 0x01, 0x00, 0x01};
const char kTestMessage[] =
"A fool thinks himself to be wise, but a"
" wise man knows himself to be a fool.";
const uint8 kTestEncryptedMessage_3072[] = {
0x4e, 0x85, 0x01, 0x65, 0x1c, 0xb2, 0xe6, 0x39, 0xb9, 0x6e, 0x93, 0x6a,
0x18, 0xa4, 0xa6, 0xb2, 0x86, 0x3d, 0x8e, 0x23, 0x34, 0x68, 0xa9, 0x74,
0x78, 0x0e, 0x6f, 0x94, 0xb3, 0x4f, 0x14, 0xc0, 0x88, 0x0a, 0xec, 0x64,
0x47, 0xbd, 0x4b, 0x66, 0x17, 0xed, 0xc9, 0xe4, 0xff, 0x5e, 0xbe, 0x6b,
0xac, 0xf1, 0xd7, 0xc3, 0xef, 0x24, 0x52, 0xf7, 0x92, 0x1a, 0xe9, 0xee,
0xa3, 0x31, 0x0c, 0xf5, 0xbc, 0x66, 0xf8, 0x20, 0x03, 0x2a, 0x1e, 0xb2,
0x67, 0x3c, 0xbd, 0xe8, 0x8e, 0x13, 0xc5, 0x00, 0xd6, 0xe0, 0x99, 0x91,
0xd1, 0x55, 0x36, 0x0e, 0x66, 0x55, 0x38, 0x0b, 0xa4, 0x43, 0xe7, 0xfc,
0x8a, 0xa1, 0xee, 0xef, 0x20, 0x45, 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f0, 0xab, 0x21, 0xf6, 0xe0, 0x78, 0x5a, 0x72, 0xb5, 0x6a, 0xf9, 0xcb,
0x15, 0x3d, 0x80, 0x49, 0xb3, 0x6a, 0x71, 0x9e, 0xe0, 0xf4, 0xa0, 0xbd,
0x0d, 0x6a, 0xae, 0x0f, 0xd5, 0xda, 0x42, 0xe4, 0xd8, 0x98, 0x11, 0xc0,
0xc5, 0x1c, 0x1d, 0xdd, 0x38, 0x02, 0xb5, 0x69, 0x9e, 0x11, 0x83, 0xbd,
0x01, 0x7d, 0xbc, 0x6d, 0x8f, 0xc8, 0x3a, 0x48, 0x49, 0xbf, 0x36, 0xb4,
0x19, 0xa2, 0x0c, 0x6a, 0x0a, 0xaa, 0x15, 0x9e, 0xe3, 0x30, 0x91, 0x95,
0x0a, 0xed, 0x2a, 0xa3, 0xec, 0x97, 0x01, 0xfb, 0xee, 0x28, 0xd7, 0xfc,
0x34, 0xd5, 0x1a, 0x62, 0x9c, 0xb2, 0x9d, 0x8b, 0xe9, 0x49, 0x48, 0x1d};
// Self-generated test vector. Used to verify algorithm stability.
const uint8 kTestEncryptedMessage_2048[] = {
0x73, 0x37, 0xa5, 0xe3, 0x73, 0xbb, 0xa7, 0xbf, 0xb1, 0xfc, 0x98, 0x6c,
0xd2, 0x20, 0xe2, 0x79, 0xea, 0x90, 0x41, 0xcf, 0x2b, 0xe0, 0x22, 0x0f,
0xe3, 0x6e, 0x2e, 0x61, 0x7d, 0xe5, 0xc7, 0x5a, 0x46, 0x87, 0xed, 0x35,
0x01, 0x38, 0x65, 0x20, 0x2c, 0x42, 0x9d, 0x15, 0x54, 0x43, 0x40, 0x9f,
0x01, 0x24, 0x03, 0x93, 0xd5, 0x74, 0xc3, 0x40, 0x8c, 0x3e, 0xa5, 0x7a,
0x32, 0xb1, 0x85, 0xd5, 0x48, 0xba, 0xe3, 0x94, 0xfc, 0xbc, 0x98, 0x2d,
0xc6, 0x79, 0x00, 0xc8, 0xab, 0xe0, 0x3d, 0x7f,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x3e, 0x5e, 0xac, 0x67, 0xcd, 0xdb, 0xd4, 0xa7,
0x8c, 0xf8, 0x00, 0xb3, 0x35, 0xfb, 0x37, 0xbb, 0xeb, 0x0a, 0xbf, 0x67,
0x6e, 0x3e, 0x20, 0xeb, 0x84, 0x6b, 0x07, 0xc4, 0x64, 0x14, 0xd6, 0x79,
0xed, 0x3f, 0x01, 0x79, 0xe4, 0xa2, 0xbe, 0xaa, 0x62, 0x32, 0xa5, 0xf8,
0x8c, 0xcf, 0x80, 0x3b, 0xc9, 0xf5, 0x38, 0x34, 0x69, 0x12, 0x8c, 0xd6,
0x4a, 0x2b, 0x4b, 0x7f, 0x3a, 0xff, 0x84, 0x7a, 0x3d, 0x99, 0xd5, 0x99,
0xc7, 0x4b, 0x8b, 0x25, 0x3c, 0x3d, 0x3c, 0x71, 0xc8, 0x76, 0x80, 0x3d,
0xf3, 0xb4, 0x61, 0xe1};
} // namespace
namespace media {
RsaTestData::RsaTestData() {
test_set_3072_bits_.test_message = kTestMessage;
test_set_3072_bits_.public_key.assign(
kTestRsaPublicKey_3072,
kTestRsaPublicKey_3072 + sizeof(kTestRsaPublicKey_3072));
test_set_3072_bits_.private_key.assign(
kTestRsaPrivateKey_3072,
kTestRsaPrivateKey_3072 + sizeof(kTestRsaPrivateKey_3072));
test_set_3072_bits_.encrypted_message.assign(
kTestEncryptedMessage_3072,
kTestEncryptedMessage_3072 + sizeof(kTestEncryptedMessage_3072));
test_set_3072_bits_.signature.assign(
kTestSignature_3072, kTestSignature_3072 + sizeof(kTestSignature_3072));
test_set_2048_bits_.test_message = kTestMessage;
test_set_2048_bits_.public_key.assign(
kTestRsaPublicKey_2048,
kTestRsaPublicKey_2048 + sizeof(kTestRsaPublicKey_2048));
test_set_2048_bits_.private_key.assign(
kTestRsaPrivateKey_2048,
kTestRsaPrivateKey_2048 + sizeof(kTestRsaPrivateKey_2048));
test_set_2048_bits_.encrypted_message.assign(
kTestEncryptedMessage_2048,
kTestEncryptedMessage_2048 + sizeof(kTestEncryptedMessage_2048));
test_set_2048_bits_.signature.assign(
kTestSignature_2048, kTestSignature_2048 + sizeof(kTestSignature_2048));
}
RsaTestData::~RsaTestData() {}
} // namespace media

View File

@ -0,0 +1,43 @@
// Copyright (c) 2013 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// RSA test data generated using fake_prng for purposes of testing.
#ifndef MEDIA_BASE_RSA_TEST_DATA_H_
#define MEDIA_BASE_RSA_TEST_DATA_H_
#include <string>
#include "base/basictypes.h"
namespace media {
// Self generated test vector to verify algorithm stability.
struct RsaTestSet {
std::string public_key;
std::string private_key;
std::string test_message;
std::string encrypted_message;
std::string signature;
};
// Collection of test sets.
class RsaTestData {
public:
RsaTestData();
~RsaTestData();
const RsaTestSet& test_set_3072_bits() const { return test_set_3072_bits_; }
const RsaTestSet& test_set_2048_bits() const { return test_set_2048_bits_; }
private:
RsaTestSet test_set_3072_bits_;
RsaTestSet test_set_2048_bits_;
DISALLOW_COPY_AND_ASSIGN(RsaTestData);
};
} // namespace media
#endif // MEDIA_BASE_RSA_TEST_DATA_H_

Binary file not shown.

View File

@ -47,6 +47,8 @@
'media/base/media_stream.h', 'media/base/media_stream.h',
'media/base/muxer.cc', 'media/base/muxer.cc',
'media/base/muxer.h', 'media/base/muxer.h',
'media/base/rsa_key.cc',
'media/base/rsa_key.h',
'media/base/status.cc', 'media/base/status.cc',
'media/base/status.h', 'media/base/status.h',
'media/base/stream_info.cc', 'media/base/stream_info.cc',
@ -81,6 +83,11 @@
'media/base/bit_reader_unittest.cc', 'media/base/bit_reader_unittest.cc',
'media/base/buffer_writer_unittest.cc', 'media/base/buffer_writer_unittest.cc',
'media/base/container_names_unittest.cc', 'media/base/container_names_unittest.cc',
'media/base/fake_prng.cc', # For rsa_key_unittest
'media/base/fake_prng.h', # For rsa_key_unittest
'media/base/rsa_key_unittest.cc',
'media/base/rsa_test_data.cc', # For rsa_key_unittest
'media/base/rsa_test_data.h', # For rsa_key_unittest
'media/base/status_test_util.h', 'media/base/status_test_util.h',
'media/base/status_test_util_unittest.cc', 'media/base/status_test_util_unittest.cc',
'media/base/status_unittest.cc', 'media/base/status_unittest.cc',