This is the initial code drop of the reference implementation and test cases for the Widevine Whitebox API. In this drop, the full reference implementation for the AEAD white-box is provided and all test cases verifying the top-level behave have are enabled. Since the implementations can vary so much the testing is mostly left to verifying the return codes for specific parameter conditions. A full reference implementation for the license white-box is provided, however not all tests are implemented or enabled. A number of tests have been disabled as they required a loaded license and test licenses are still being worked on. The two license white-box API functions that are the further from competition are ProcessLicenseResponse() and MaskedDecryt(). ProcessLicenseResponse() is still being worked on and MaskedDecrypt() is waiting on Decrypt() to be fully functional. Most tests focus on verifying return code for specific parameter conditions, but as test licenses are created, tests looking to test the internal behaviour of license management will be added to ProcessLicenseResponse(), Decrypt(), and MaskedDecrypt().
93 lines
3.0 KiB
C++
93 lines
3.0 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// Copyright 2016 Google LLC.
|
|
//
|
|
// This software is licensed under the terms defined in the Widevine Master
|
|
// License Agreement. For a copy of this agreement, please contact
|
|
// widevine-licensing@google.com.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
// Description:
|
|
// RSA keys generated using fake_prng for purposes of testing.
|
|
|
|
#ifndef WHITEBOX_CRYPTO_UTILS_RSA_TEST_KEYS_H_
|
|
#define WHITEBOX_CRYPTO_UTILS_RSA_TEST_KEYS_H_
|
|
|
|
#include <string>
|
|
|
|
namespace widevine {
|
|
|
|
// Container for test RSA keys
|
|
//
|
|
// Except for the keys noted below, these keys were generated using Euler's
|
|
// Totient.
|
|
//
|
|
class RsaTestKeys {
|
|
public:
|
|
RsaTestKeys();
|
|
|
|
// Returns 3072-bit private RSA test key 1
|
|
const std::string& private_test_key_1_3072_bits() const {
|
|
return private_key_1_3072_bits_;
|
|
}
|
|
// Returns 3072-bit public RSA test key 1
|
|
const std::string& public_test_key_1_3072_bits() const {
|
|
return public_key_1_3072_bits_;
|
|
}
|
|
// Returns 2048-bit private RSA test key 2
|
|
const std::string& private_test_key_2_2048_bits() const {
|
|
return private_key_2_2048_bits_;
|
|
}
|
|
// Returns 2048-bit public RSA test key 2
|
|
const std::string& public_test_key_2_2048_bits() const {
|
|
return public_key_2_2048_bits_;
|
|
}
|
|
// Returns 2048-bit private RSA test key 3
|
|
const std::string& private_test_key_3_2048_bits() const {
|
|
return private_key_3_2048_bits_;
|
|
}
|
|
// Returns 2048-bit public RSA test key 3
|
|
const std::string& public_test_key_3_2048_bits() const {
|
|
return public_key_3_2048_bits_;
|
|
}
|
|
|
|
// This key was converted to a Carmichael totient version from the original
|
|
// private_key_2_2048_bits_.
|
|
const std::string& private_test_key_2_carmichael_totient_2048_bits() const {
|
|
return private_key_2_carmichael_totient_2048_bits_;
|
|
}
|
|
|
|
// This key was converted to a Carmichael totient version from the original
|
|
// private_key_3_2048_bits_.
|
|
const std::string& private_test_key_3_carmichael_totient_2048_bits() const {
|
|
return private_key_3_carmichael_totient_2048_bits_;
|
|
}
|
|
|
|
// This key has been created using the Carmichael totient. This is
|
|
// useful for testing with some RSA implementations that had challenges
|
|
// with keys generated this way.
|
|
const std::string& private_test_key_4_carmichael_totient_2048_bits() const {
|
|
return private_key_4_carmichael_totient_2048_bits_;
|
|
}
|
|
|
|
private:
|
|
RsaTestKeys(const RsaTestKeys&) = delete;
|
|
RsaTestKeys& operator=(const RsaTestKeys&) = delete;
|
|
|
|
std::string private_key_1_3072_bits_;
|
|
std::string public_key_1_3072_bits_;
|
|
std::string private_key_2_2048_bits_;
|
|
std::string public_key_2_2048_bits_;
|
|
std::string private_key_3_2048_bits_;
|
|
std::string public_key_3_2048_bits_;
|
|
|
|
// Tests keys that use the Carmichael totient to calculate d.
|
|
std::string private_key_2_carmichael_totient_2048_bits_;
|
|
std::string private_key_3_carmichael_totient_2048_bits_;
|
|
std::string private_key_4_carmichael_totient_2048_bits_;
|
|
};
|
|
|
|
} // namespace widevine
|
|
|
|
#endif // WHITEBOX_CRYPTO_UTILS_RSA_TEST_KEYS_H_
|