Update repo with latest changes

This updates the repo to match the internal repo at commit:
521466f84993e273105bd41d930c00cf6d61008f
This commit is contained in:
Jacob Trimble
2021-07-02 11:11:15 -07:00
parent ac8b2f59ea
commit 06a325cfaf
43 changed files with 1752 additions and 1461 deletions

View File

@@ -62,6 +62,9 @@ void WB_Aead_Delete(WB_Aead_Whitebox* whitebox);
// should be at least |input_data_size| + 22 to allow room for the nonce and the
// verification tag.
//
// This must support |input_data| and |output_data| pointing to the same buffer
// (in-place encrypt).
//
// Args:
// whitebox (in) : The white-box containing the keys for encryption.
//
@@ -94,6 +97,9 @@ WB_Result WB_Aead_Encrypt(const WB_Aead_Whitebox* whitebox,
// Decrypts |input_data| and writes the plaintext to |output_data|. |input_data|
// must have been encrypted using WB_Aead_Encrypt() with the same |whitebox|.
//
// This must support |input_data| and |output_data| pointing to the same buffer
// (in-place decrypt).
//
// Args:
// whitebox (in) : The white-box containing the keys for decryption.
//

View File

@@ -59,6 +59,29 @@ TEST_F(AeadWhiteboxEncryptTest, Success) {
ASSERT_GT(output_size, input_.size());
}
// This also validates Decrypt in-place.
TEST_F(AeadWhiteboxEncryptTest, InPlace) {
size_t output_size = kDefaultOutputSize;
std::vector<uint8_t> output(output_size);
// Copy the input to the first part of the output. Then pass the original
// size in input, but the real size as output.
ASSERT_GE(output_size, input_.size());
memcpy(output.data(), input_.data(), input_.size());
ASSERT_EQ(WB_Aead_Encrypt(whitebox_, output.data(), input_.size(),
output.data(), &output_size),
WB_RESULT_OK);
output.resize(output_size);
ASSERT_EQ(WB_Aead_Decrypt(whitebox_, output.data(), output.size(),
output.data(), &output_size),
WB_RESULT_OK);
output.resize(output_size);
ASSERT_EQ(output, input_);
}
TEST_F(AeadWhiteboxEncryptTest, InvalidParameterForNullWhitebox) {
size_t output_size = kDefaultOutputSize;
std::vector<uint8_t> output(output_size);

View File

@@ -3,84 +3,87 @@
#include "api/golden_data.h"
namespace widevine {
namespace {
GoldenData::Content CreateContent(const std::vector<uint8_t>& plaintext,
const std::vector<uint8_t>& ciphertext,
const AesIv& iv,
const AesKey& key,
const KeyId& undefined_key_id,
const KeyId& software_crypto_key_id,
const KeyId& software_decode_key_id,
const KeyId& hardware_key_id) {
GoldenData::Content content;
content.plaintext = plaintext;
content.ciphertext = ciphertext;
content.iv = iv;
content.undefined_key.id = undefined_key_id;
content.undefined_key.level = SecurityLevel::kUndefined;
content.undefined_key.key = key;
content.software_crypto_key.id = software_crypto_key_id;
content.software_crypto_key.level = SecurityLevel::kSoftwareSecureCrypto;
content.software_crypto_key.key = key;
content.software_decode_key.id = software_decode_key_id;
content.software_decode_key.level = SecurityLevel::kSoftwareSecureDecode;
content.software_decode_key.key = key;
content.hardware_key.id = hardware_key_id;
content.hardware_key.level = SecurityLevel::kHardwareSecureCrypto;
content.hardware_key.key = key;
return content;
}
} // namespace
GoldenData::GoldenData() {
// Content generated with:
// openssl aes-128-cbc -e -in data.txt
// -K EBDD62F16814D27B68EF122AFCE4AE3C
// -iv 30313233343536373839303132333435 | xxd -i
// Extra padding was stripped off.
cbc_content_ = {
/* plaintext */ {'t', 'h', 'i', 's', ' ', 'i', 's', ' ', 't', 'h', 'e',
' ', 'p', 'l', 'a', 'i', 'n', 't', 'e', 'x', 't', ' ',
':', ' ', '3', '2', ' ', 'b', 'y', 't', 'e', 's'},
/* ciphertext */
{0x5e, 0x60, 0x0d, 0x3c, 0x29, 0xb9, 0x49, 0x4c, 0x65, 0x67, 0x7e,
0x87, 0x82, 0x9d, 0x47, 0x58, 0xb9, 0x86, 0xd0, 0x39, 0x6a, 0x67,
0x2c, 0x53, 0xe9, 0xbc, 0x99, 0x5b, 0x23, 0x34, 0x9f, 0xf8},
/* key */
{0xEB, 0xDD, 0x62, 0xF1, 0x68, 0x14, 0xD2, 0x7B, 0x68, 0xEF, 0x12, 0x2A,
0xFC, 0xE4, 0xAE, 0x3C},
/* iv */
cbc_content_ = CreateContent(
/* plaintext= */ {'t', 'h', 'i', 's', ' ', 'i', 's', ' ', 't', 'h', 'e',
' ', 'p', 'l', 'a', 'i', 'n', 't', 'e', 'x', 't', ' ',
':', ' ', '3', '2', ' ', 'b', 'y', 't', 'e', 's'},
/* ciphertext= */ {0x5e, 0x60, 0x0d, 0x3c, 0x29, 0xb9, 0x49, 0x4c,
0x65, 0x67, 0x7e, 0x87, 0x82, 0x9d, 0x47, 0x58,
0xb9, 0x86, 0xd0, 0x39, 0x6a, 0x67, 0x2c, 0x53,
0xe9, 0xbc, 0x99, 0x5b, 0x23, 0x34, 0x9f, 0xf8},
/* iv= */
{0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31,
0x32, 0x33, 0x34, 0x35},
};
cbc_crypto_key_ = {
SecurityLevel::kSoftwareSecureCrypto,
{0xFF, 0, 0, 0},
&cbc_content_,
};
cbc_decode_key_ = {
SecurityLevel::kSoftwareSecureDecode,
{0xFF, 1, 0, 0},
&cbc_content_,
};
cbc_hardware_key_ = {
SecurityLevel::kHardwareSecureCrypto,
{0xFF, 2, 0, 0},
&cbc_content_,
};
/* key= */
{0xEB, 0xDD, 0x62, 0xF1, 0x68, 0x14, 0xD2, 0x7B, 0x68, 0xEF, 0x12, 0x2A,
0xFC, 0xE4, 0xAE, 0x3C},
/* undefined_key_id= */ {0xFF, 0, 0, 0},
/* software_crypto_key_id= */ {0xFF, 1, 0, 0},
/* software_decode_key_id= */ {0xFF, 2, 0, 0},
/* hardware_key_id= */ {0xFF, 3, 0, 0});
// Content generated with:
// openssl aes-128-ctr -e -in data.txt
// -K dd3c6cd4ea73b99d55f2e0357e1f560f
// -iv d50c08b31fc09e9e748431ca972334e6 | xxd -i
ctr_content_ = {
ctr_content_ = CreateContent(
/* plaintext */ {'T', 'h', 'i', 'r', 't', 'y', '-', 't', 'w', 'o', ' ',
'b', 'y', 't', 'e', 's', ' ', 'o', 'f', ' ', 'r', 'a',
'n', 'd', 'o', 'm', ' ', 'd', 'a', 't', 'a', '.'},
/* ciphertext */
{0x5d, 0x83, 0xdd, 0xb9, 0xed, 0x18, 0x2f, 0x10, 0xbf, 0x6f, 0x4d,
0xb0, 0xb3, 0xeb, 0x0d, 0x20, 0xd7, 0x7e, 0x9a, 0x3a, 0xc4, 0x41,
0xcf, 0x0a, 0xb3, 0xae, 0x02, 0x01, 0x0a, 0xf2, 0x72, 0x72},
/* key */
{0xdd, 0x3c, 0x6c, 0xd4, 0xea, 0x73, 0xb9, 0x9d, 0x55, 0xf2, 0xe0, 0x35,
0x7e, 0x1f, 0x56, 0x0f},
/* ciphertext */ {0x5d, 0x83, 0xdd, 0xb9, 0xed, 0x18, 0x2f, 0x10,
0xbf, 0x6f, 0x4d, 0xb0, 0xb3, 0xeb, 0x0d, 0x20,
0xd7, 0x7e, 0x9a, 0x3a, 0xc4, 0x41, 0xcf, 0x0a,
0xb3, 0xae, 0x02, 0x01, 0x0a, 0xf2, 0x72, 0x72},
/* iv */
{0xd5, 0x0c, 0x08, 0xb3, 0x1f, 0xc0, 0x9e, 0x9e, 0x74, 0x84, 0x31, 0xca,
0x97, 0x23, 0x34, 0xe6},
};
ctr_crypto_key_ = {
SecurityLevel::kSoftwareSecureCrypto,
{0xFF, 3, 0, 0},
&ctr_content_,
};
ctr_decode_key_ = {
SecurityLevel::kSoftwareSecureDecode,
{0xFF, 4, 0, 0},
&ctr_content_,
};
ctr_hardware_key_ = {
SecurityLevel::kHardwareSecureCrypto,
{0xFF, 5, 0, 0},
&ctr_content_,
};
/* key */
{0xdd, 0x3c, 0x6c, 0xd4, 0xea, 0x73, 0xb9, 0x9d, 0x55, 0xf2, 0xe0, 0x35,
0x7e, 0x1f, 0x56, 0x0f},
/* undefined_key_id= */ {0xFF, 4, 0, 0},
/* software_crypto_key_id= */ {0xFF, 5, 0, 0},
/* software_decode_key_id= */ {0xFF, 6, 0, 0},
/* hardware_key_id= */ {0xFF, 7, 0, 0});
}
KeyId GoldenData::GetFreeId() {

View File

@@ -8,7 +8,7 @@
#include <vector>
#include "api/test_key_types.h"
#include "cdm/protos/license_protocol.pb.h"
#include "license_protocol.pb.h"
namespace widevine {
@@ -17,40 +17,30 @@ class GoldenData {
struct Content {
std::vector<uint8_t> plaintext;
std::vector<uint8_t> ciphertext;
AesKey key;
AesIv iv;
};
struct Key {
SecurityLevel level;
KeyId id;
const Content* content;
// IV used to encrypt the plaintext.
AesIv iv;
// All the keys available to decrypt the ciphertext and get the plaintext.
// Every key here should have the same AES key, but the security level and
// ids will be different.
ContentKeyData undefined_key;
ContentKeyData software_crypto_key;
ContentKeyData software_decode_key;
ContentKeyData hardware_key;
};
GoldenData();
const Content& CBCContent() const { return cbc_content_; }
const Key& CBCCryptoKey() const { return cbc_crypto_key_; }
const Key& CBCDecodeKey() const { return cbc_decode_key_; }
const Key& CBCHardwareKey() const { return cbc_hardware_key_; }
const Content& CTRContent() const { return ctr_content_; }
const Key& CTRCryptoKey() const { return ctr_crypto_key_; }
const Key& CTRDecodeKey() const { return ctr_decode_key_; }
const Key& CTRHardwareKey() const { return ctr_hardware_key_; }
KeyId GetFreeId();
private:
Content cbc_content_;
Key cbc_crypto_key_;
Key cbc_decode_key_;
Key cbc_hardware_key_;
Content ctr_content_;
Key ctr_crypto_key_;
Key ctr_decode_key_;
Key ctr_hardware_key_;
uint8_t next_id_ = 0;
};

View File

@@ -90,7 +90,9 @@ void WB_License_Delete(WB_License_Whitebox* whitebox);
//
// license_request_size (in) : The number of bytes in the license_request.
//
// signature (out) : The generated signature for |license_request|.
// signature (out) : The generated signature for |license_request|. This can be
// null if |*signature_size| is 0; this should return
// WB_RESULT_BUFFER_TOO_SMALL and fill |signature_size|.
//
// signature_size (in/out) : As input, this contains the max number of bytes
// that can be written to |signature|. As output, |signature_size| is set to
@@ -245,7 +247,9 @@ WB_Result WB_License_QueryKeyStatus(const WB_License_Whitebox* whitebox,
//
// message_size (in) : The number of bytes in |message|.
//
// signature (out) : The output parameter used to return the signature.
// signature (out) : The output parameter used to return the signature. This
// can be null if |*signature_size| is 0; this should return
// WB_RESULT_BUFFER_TOO_SMALL and fill |signature_size|.
//
// signature_size (in/out) : As input, this contains the max number of bytes
// that can be written to |signature|. As output, |signature_size| is set to
@@ -315,7 +319,9 @@ WB_Result WB_License_VerifyRenewalResponse(const WB_License_Whitebox* whitebox,
// key_id_size (in) : The number of bytes in |key_id|.
//
// secret_string (out) : The output parameter used to return the secret string
// that can be passed to WB_License_Unmask().
// that can be passed to WB_License_Unmask(). This can be null if
// |*secret_string_size| is 0; this should return WB_RESULT_BUFFER_TOO_SMALL
// and fill |secret_string_size|.
//
// secret_string_size (in/out) : As input, this contains the max number of
// bytes that can be written to |secret_string|. As output,
@@ -349,6 +355,9 @@ WB_Result WB_License_GetSecretString(const WB_License_Whitebox* whitebox,
// Decrypts |input_data| and writes the plaintext to |output_data|.
//
// This must support |input_data| and |output_data| pointing to the same buffer
// (in-place decrypt).
//
// Args:
// whitebox (in) : The white-box containing the keys needed to decrypt
// |input_data|.
@@ -410,6 +419,9 @@ WB_Result WB_License_Decrypt(const WB_License_Whitebox* whitebox,
// |masked_output_data|. The obfuscated plaintext can be deobfuscated using
// WB_License_GetSecretString() and WB_License_Unmask().
//
// This must support |input_data| and |output_data| pointing to the same buffer
// (in-place decrypt).
//
// Args:
// whitebox (in) : The white-box containing the keys needed to decrypt
// |input_data|.

View File

@@ -21,8 +21,12 @@ constexpr size_t kBlockSize = 16; // This must align with the AES block size.
} // namespace
void LicenseWhiteboxBenchmark::SetUp() {
key_id_ = data_source_.Get<4>(); // We use size=4 for all our test key ids.
key_ = data_source_.Get<kBlockSize>();
// We use size=4 for all our test key ids.
key_data_.id = data_source_.Get<4>();
key_data_.key = data_source_.Get<kBlockSize>();
// Use secure crypto as it will work with both Decrypt() and MaskedDecrypt().
key_data_.level = SecurityLevel::kSoftwareSecureCrypto;
iv_ = data_source_.Get<kBlockSize>();
const auto public_key_data = GetEncryptionKey().public_key;
@@ -31,14 +35,24 @@ void LicenseWhiteboxBenchmark::SetUp() {
ASSERT_TRUE(encryption_public_key_);
}
License LicenseWhiteboxBenchmark::CreateLicense(
WB_LicenseKeyMode key_mode) const {
License LicenseWhiteboxBenchmark::CreateLicense(WB_LicenseKeyMode key_mode,
int number_of_content_keys,
SecurityLevel security_level) {
TestLicenseBuilder license_builder;
license_builder.AddSigningKey(TestLicenseBuilder::DefaultSigningKey());
// Use secure crypto as it will work with both Decrypt() and
// MaskedDecrypt().
license_builder.AddContentKey(SecurityLevel::kSoftwareSecureCrypto, key_id_,
key_);
// Update the first key to match the security level.
key_data_.level = security_level;
license_builder.AddContentKey(key_data_);
CHECK_GE(number_of_content_keys, 1);
for (int i = 1; i < number_of_content_keys; ++i) {
ContentKeyData key;
key.id = data_source_.Get<4>();
key.key = data_source_.Get<kBlockSize>();
key.level = security_level;
license_builder.AddContentKey(key);
}
std::unique_ptr<TestServer> server;

View File

@@ -20,19 +20,22 @@ class LicenseWhiteboxBenchmark : public ::testing::Test {
protected:
virtual void SetUp() override;
// Create a new license. The given key mode will change how the license is
// encrypted and signed. The white-box instance is expected to use the correct
// key mode in order to process the license response.
License CreateLicense(WB_LicenseKeyMode key_mode) const;
// Create a new license with the specified number of content keys using the
// security_level provided. The first content key will use
// kSoftwareSecureCrypto, while the remainder will be specified by
// |security_level|. The given key mode will change how the license is
// encrypted and signed. The white-box instance is expected to use the
// correct key mode in order to process the license response.
License CreateLicense(WB_LicenseKeyMode key_mode,
int number_of_content_keys,
SecurityLevel security_level);
// Sign the message using the default HMAC signing key.
std::vector<uint8_t> SignAsServer(const std::vector<uint8_t>& message) const;
DataSource& Data() { return data_source_; }
const KeyId& ContentKeyId() const { return key_id_; }
const AesKey& ContentKey() const { return key_; }
const ContentKeyData& ContentKey() const { return key_data_; }
const AesIv& ContentIV() const { return iv_; }
@@ -40,8 +43,8 @@ class LicenseWhiteboxBenchmark : public ::testing::Test {
DataSource data_source_;
std::unique_ptr<RsaPublicKey> encryption_public_key_;
KeyId key_id_;
AesKey key_;
ContentKeyData key_data_;
AesIv iv_;
};

View File

@@ -45,7 +45,8 @@ class LicenseWhiteboxDecryptBenchmark
ASSERT_EQ(WB_License_Create(&whitebox_), WB_RESULT_OK);
const auto license = CreateLicense(WB_LICENSE_KEY_MODE_DUAL_KEY);
const auto license = CreateLicense(WB_LICENSE_KEY_MODE_DUAL_KEY, 1,
SecurityLevel::kSoftwareSecureCrypto);
ASSERT_EQ(WB_License_ProcessLicenseResponse(
whitebox_, WB_LICENSE_KEY_MODE_DUAL_KEY,
license.core_message.data(), license.core_message.size(),
@@ -75,7 +76,7 @@ TEST_P(LicenseWhiteboxDecryptBenchmark, DecryptCBCThroughput) {
size_t plaintext_size = plaintext_.size();
ASSERT_EQ(WB_RESULT_OK,
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
ContentKeyId().data(), ContentKeyId().size(),
ContentKey().id.data(), ContentKey().id.size(),
ciphertext_.data(), ciphertext_.size(),
ContentIV().data(), ContentIV().size(),
plaintext_.data(), &plaintext_size));
@@ -93,7 +94,7 @@ TEST_P(LicenseWhiteboxDecryptBenchmark, DecryptCTRThroughput) {
size_t plaintext_size = plaintext_.size();
ASSERT_EQ(WB_RESULT_OK,
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CTR,
ContentKeyId().data(), ContentKeyId().size(),
ContentKey().id.data(), ContentKey().id.size(),
ciphertext_.data(), ciphertext_.size(),
ContentIV().data(), ContentIV().size(),
plaintext_.data(), &plaintext_size));
@@ -108,8 +109,8 @@ TEST_P(LicenseWhiteboxDecryptBenchmark, MaskedDecryptCBCThroughput) {
size_t mask_size = mask.size();
ASSERT_EQ(WB_RESULT_OK,
WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC, ContentKeyId().data(),
ContentKeyId().size(), mask.data(), &mask_size));
whitebox_, WB_CIPHER_MODE_CBC, ContentKey().id.data(),
ContentKey().id.size(), mask.data(), &mask_size));
mask.resize(mask_size);
Timer timer;
@@ -121,10 +122,10 @@ TEST_P(LicenseWhiteboxDecryptBenchmark, MaskedDecryptCBCThroughput) {
size_t plaintext_size = plaintext_.size();
ASSERT_EQ(WB_RESULT_OK,
WB_License_MaskedDecrypt(
whitebox_, WB_CIPHER_MODE_CBC, ContentKeyId().data(),
ContentKeyId().size(), ciphertext_.data(), ciphertext_.size(),
ContentIV().data(), ContentIV().size(), masked_text_.data(),
&plaintext_size));
whitebox_, WB_CIPHER_MODE_CBC, ContentKey().id.data(),
ContentKey().id.size(), ciphertext_.data(),
ciphertext_.size(), ContentIV().data(), ContentIV().size(),
masked_text_.data(), &plaintext_size));
WB_License_Unmask(masked_text_.data(), 0, plaintext_size, mask.data(),
mask.size(), plaintext_.data());
@@ -140,8 +141,8 @@ TEST_P(LicenseWhiteboxDecryptBenchmark, MaskedDecryptCTRThroughput) {
size_t mask_size = mask.size();
ASSERT_EQ(WB_RESULT_OK,
WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CTR, ContentKeyId().data(),
ContentKeyId().size(), mask.data(), &mask_size));
whitebox_, WB_CIPHER_MODE_CTR, ContentKey().id.data(),
ContentKey().id.size(), mask.data(), &mask_size));
mask.resize(mask_size);
Timer timer;
@@ -153,10 +154,10 @@ TEST_P(LicenseWhiteboxDecryptBenchmark, MaskedDecryptCTRThroughput) {
size_t plaintext_size = plaintext_.size();
ASSERT_EQ(WB_RESULT_OK,
WB_License_MaskedDecrypt(
whitebox_, WB_CIPHER_MODE_CTR, ContentKeyId().data(),
ContentKeyId().size(), ciphertext_.data(), ciphertext_.size(),
ContentIV().data(), ContentIV().size(), masked_text_.data(),
&plaintext_size));
whitebox_, WB_CIPHER_MODE_CTR, ContentKey().id.data(),
ContentKey().id.size(), ciphertext_.data(),
ciphertext_.size(), ContentIV().data(), ContentIV().size(),
masked_text_.data(), &plaintext_size));
WB_License_Unmask(masked_text_.data(), 0, plaintext_size, mask.data(),
mask.size(), plaintext_.data());

View File

@@ -42,21 +42,11 @@ class LicenseWhiteboxDecryptTest : public LicenseWhiteboxTestBase,
builder.SetSettings(settings);
builder.GetSettings().padding = padding_;
builder.AddContentKey(golden_data_.CBCCryptoKey().level,
golden_data_.CBCCryptoKey().id,
golden_data_.CBCCryptoKey().content->key);
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
builder.AddContentKey(golden_data_.CBCContent().software_decode_key);
builder.AddContentKey(golden_data_.CBCContent().hardware_key);
builder.AddContentKey(golden_data_.CTRCryptoKey().level,
golden_data_.CTRCryptoKey().id,
golden_data_.CTRCryptoKey().content->key);
builder.AddContentKey(golden_data_.CBCDecodeKey().level,
golden_data_.CBCDecodeKey().id,
golden_data_.CBCDecodeKey().content->key);
builder.AddContentKey(golden_data_.CBCHardwareKey().level,
golden_data_.CBCHardwareKey().id,
golden_data_.CBCHardwareKey().content->key);
builder.AddContentKey(golden_data_.CTRContent().software_crypto_key);
builder.AddOperatorSessionKey(non_content_key_id_);
@@ -91,36 +81,76 @@ TEST_P(LicenseWhiteboxDecryptTest, CryptoKeyWithCbcDataInCbcMode) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
plaintext_.resize(plaintext_size_);
ASSERT_EQ(plaintext_, golden_data_.CBCCryptoKey().content->plaintext);
ASSERT_EQ(plaintext_, golden_data_.CBCContent().plaintext);
}
TEST_P(LicenseWhiteboxDecryptTest, InPlaceDecryptionCbc) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
memcpy(plaintext_.data(), golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size());
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
plaintext_.data(), plaintext_.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
plaintext_.resize(plaintext_size_);
ASSERT_EQ(plaintext_, golden_data_.CBCContent().plaintext);
}
TEST_P(LicenseWhiteboxDecryptTest, CryptoKeyWithCtrDataInCtrMode) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CTRCryptoKey().id.data(),
golden_data_.CTRCryptoKey().id.size(),
golden_data_.CTRCryptoKey().content->ciphertext.data(),
golden_data_.CTRCryptoKey().content->ciphertext.size(),
golden_data_.CTRCryptoKey().content->iv.data(),
golden_data_.CTRCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CTRContent().software_crypto_key.id.data(),
golden_data_.CTRContent().software_crypto_key.id.size(),
golden_data_.CTRContent().ciphertext.data(),
golden_data_.CTRContent().ciphertext.size(),
golden_data_.CTRContent().iv.data(),
golden_data_.CTRContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
plaintext_.resize(plaintext_size_);
ASSERT_EQ(plaintext_, golden_data_.CTRCryptoKey().content->plaintext);
ASSERT_EQ(plaintext_, golden_data_.CTRContent().plaintext);
}
TEST_P(LicenseWhiteboxDecryptTest, InPlaceDecryptionCtr) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
memcpy(plaintext_.data(), golden_data_.CTRContent().ciphertext.data(),
golden_data_.CTRContent().ciphertext.size());
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CTRContent().software_crypto_key.id.data(),
golden_data_.CTRContent().software_crypto_key.id.size(),
plaintext_.data(), plaintext_.size(),
golden_data_.CTRContent().iv.data(),
golden_data_.CTRContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
plaintext_.resize(plaintext_size_);
ASSERT_EQ(plaintext_, golden_data_.CTRContent().plaintext);
}
// We try to decrypt CBC encrypted data in CTR mode. All operations should be
@@ -129,18 +159,18 @@ TEST_P(LicenseWhiteboxDecryptTest, CryptoKeyWithCbcDataInCtrMode) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
plaintext_.resize(plaintext_size_);
ASSERT_NE(plaintext_, golden_data_.CBCCryptoKey().content->plaintext);
ASSERT_NE(plaintext_, golden_data_.CBCContent().plaintext);
}
// We try to decrypt CTR encrypted data in CBC mode. All operations should be
@@ -149,18 +179,18 @@ TEST_P(LicenseWhiteboxDecryptTest, CryptoKeyWithCtrDataInCbcMode) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CTRCryptoKey().id.data(),
golden_data_.CTRCryptoKey().id.size(),
golden_data_.CTRCryptoKey().content->ciphertext.data(),
golden_data_.CTRCryptoKey().content->ciphertext.size(),
golden_data_.CTRCryptoKey().content->iv.data(),
golden_data_.CTRCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CTRContent().software_crypto_key.id.data(),
golden_data_.CTRContent().software_crypto_key.id.size(),
golden_data_.CTRContent().ciphertext.data(),
golden_data_.CTRContent().ciphertext.size(),
golden_data_.CTRContent().iv.data(),
golden_data_.CTRContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
plaintext_.resize(plaintext_size_);
ASSERT_NE(plaintext_, golden_data_.CTRCryptoKey().content->plaintext);
ASSERT_NE(plaintext_, golden_data_.CTRContent().plaintext);
}
// Try decrypting two different sets of content to make sure that two
@@ -169,53 +199,53 @@ TEST_P(LicenseWhiteboxDecryptTest, SuccessWithMultipleKeys) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
plaintext_.resize(plaintext_size_);
ASSERT_EQ(plaintext_, golden_data_.CBCCryptoKey().content->plaintext);
ASSERT_EQ(plaintext_, golden_data_.CBCContent().plaintext);
// Reset our output buffer.
plaintext_.clear();
plaintext_size_ = golden_data_.CTRDecodeKey().content->plaintext.size();
plaintext_size_ = golden_data_.CTRContent().plaintext.size();
plaintext_.resize(plaintext_size_);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CTRCryptoKey().id.data(),
golden_data_.CTRCryptoKey().id.size(),
golden_data_.CTRCryptoKey().content->ciphertext.data(),
golden_data_.CTRCryptoKey().content->ciphertext.size(),
golden_data_.CTRCryptoKey().content->iv.data(),
golden_data_.CTRCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CTRContent().software_crypto_key.id.data(),
golden_data_.CTRContent().software_crypto_key.id.size(),
golden_data_.CTRContent().ciphertext.data(),
golden_data_.CTRContent().ciphertext.size(),
golden_data_.CTRContent().iv.data(),
golden_data_.CTRContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
plaintext_.resize(plaintext_size_);
ASSERT_EQ(plaintext_, golden_data_.CTRCryptoKey().content->plaintext);
ASSERT_EQ(plaintext_, golden_data_.CTRContent().plaintext);
}
TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForNullWhitebox) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(nullptr, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_Decrypt(
nullptr, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForInvalidCipherMode) {
@@ -228,13 +258,14 @@ TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForInvalidCipherMode) {
const WB_CipherMode invalid_mode = static_cast<WB_CipherMode>(0xFF);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, invalid_mode, golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
whitebox_, invalid_mode,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
@@ -242,45 +273,45 @@ TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForNullKeyId) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC, nullptr,
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC, nullptr,
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForZeroKeyIdSize) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(), 0,
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(), 0,
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForNullInputData) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(), nullptr,
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
nullptr, golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
// AES CBC requires that the input be block aligned (multiple of 16). CTR does
@@ -289,15 +320,15 @@ TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForInvalidCBCInputDataSize) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
14, golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(), 14,
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
// The white-box (using any cipher mode) should reject input with size zero.
@@ -305,30 +336,30 @@ TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForZeroInputDataSize) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
0, golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(), 0,
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForNullIV) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC, golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(), nullptr,
golden_data_.CBCCryptoKey().content->iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(), nullptr,
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
// IV size should be 16. Any number other than 16 should fail.
@@ -336,31 +367,30 @@ TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForInvalidIVSize) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(), 9,
plaintext_.data(), &plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(), 9, plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForNullOutput) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
nullptr, &plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), nullptr, &plaintext_size_),
WB_RESULT_INVALID_PARAMETER);
}
TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForNullOutputSize) {
@@ -368,14 +398,14 @@ TEST_P(LicenseWhiteboxDecryptTest, InvalidParameterForNullOutputSize) {
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), nullptr),
WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(), nullptr),
WB_RESULT_INVALID_PARAMETER);
}
@@ -386,15 +416,14 @@ TEST_P(LicenseWhiteboxDecryptTest, KeyUnavailableForMissingKeyId) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC, missing_key_id_.data(),
missing_key_id_.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_KEY_UNAVAILABLE);
ASSERT_EQ(WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
missing_key_id_.data(), missing_key_id_.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_KEY_UNAVAILABLE);
}
TEST_P(LicenseWhiteboxDecryptTest, KeyUnavailableForNonContentKey) {
@@ -404,11 +433,11 @@ TEST_P(LicenseWhiteboxDecryptTest, KeyUnavailableForNonContentKey) {
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
non_content_key_id_.data(), non_content_key_id_.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_KEY_UNAVAILABLE);
}
@@ -419,15 +448,14 @@ TEST_P(LicenseWhiteboxDecryptTest,
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCHardwareKey().id.data(),
golden_data_.CBCHardwareKey().id.size(),
golden_data_.CBCHardwareKey().content->ciphertext.data(),
golden_data_.CBCHardwareKey().content->ciphertext.size(),
golden_data_.CBCHardwareKey().content->iv.data(),
golden_data_.CBCHardwareKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
ASSERT_EQ(WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().hardware_key.id.data(),
golden_data_.CBCContent().hardware_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_INSUFFICIENT_SECURITY_LEVEL);
}
@@ -437,16 +465,16 @@ TEST_P(LicenseWhiteboxDecryptTest, InsufficientSecurityLevelForDecodeKey) {
// Use the software decode key as they are limited to
// WB_License_Decrypt().
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCDecodeKey().id.data(),
golden_data_.CBCDecodeKey().id.size(),
golden_data_.CBCDecodeKey().content->ciphertext.data(),
golden_data_.CBCDecodeKey().content->ciphertext.size(),
golden_data_.CBCDecodeKey().content->iv.data(),
golden_data_.CBCDecodeKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_INSUFFICIENT_SECURITY_LEVEL);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_decode_key.id.data(),
golden_data_.CBCContent().software_decode_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INSUFFICIENT_SECURITY_LEVEL);
}
TEST_P(LicenseWhiteboxDecryptTest, BufferTooSmall) {
@@ -457,21 +485,20 @@ TEST_P(LicenseWhiteboxDecryptTest, BufferTooSmall) {
// using a constant here.
plaintext_size_ = 8;
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_BUFFER_TOO_SMALL);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_BUFFER_TOO_SMALL);
// We don't use padding so the reported plaintext size should be the same as
// the cipher text size.
ASSERT_EQ(plaintext_size_,
golden_data_.CBCCryptoKey().content->ciphertext.size());
ASSERT_EQ(plaintext_size_, golden_data_.CBCContent().ciphertext.size());
}
TEST_P(LicenseWhiteboxDecryptTest, InvalidState) {
@@ -479,16 +506,16 @@ TEST_P(LicenseWhiteboxDecryptTest, InvalidState) {
// WB_RESULT_INVALID_STATE is that no key can be found and keys are provided
// via a license.
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_INVALID_STATE);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_INVALID_STATE);
}
TEST_P(LicenseWhiteboxDecryptTest, KeyUnavailableForInvalidKey) {
@@ -499,16 +526,16 @@ TEST_P(LicenseWhiteboxDecryptTest, KeyUnavailableForInvalidKey) {
settings.include_content_key_iv = false;
LoadLicense(settings);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_KEY_UNAVAILABLE);
ASSERT_EQ(WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
golden_data_.CBCContent().ciphertext.data(),
golden_data_.CBCContent().ciphertext.size(),
golden_data_.CBCContent().iv.data(),
golden_data_.CBCContent().iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_KEY_UNAVAILABLE);
}
INSTANTIATE_TEST_SUITE_P(NoPadding,

View File

@@ -31,17 +31,12 @@ class LicenseWhiteboxGetSecretStringTest : public LicenseWhiteboxTestBase {
TestLicenseBuilder builder;
builder.SetSettings(settings);
builder.AddContentKey(golden_data_.CBCCryptoKey().level,
golden_data_.CBCCryptoKey().id,
golden_data_.CBCCryptoKey().content->key);
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
builder.AddContentKey(golden_data_.CBCContent().software_decode_key);
builder.AddContentKey(golden_data_.CBCContent().hardware_key);
builder.AddContentKey(golden_data_.CBCDecodeKey().level,
golden_data_.CBCDecodeKey().id,
golden_data_.CBCDecodeKey().content->key);
builder.AddContentKey(golden_data_.CBCHardwareKey().level,
golden_data_.CBCHardwareKey().id,
golden_data_.CBCHardwareKey().content->key);
builder.AddContentKey(golden_data_.CTRContent().software_crypto_key);
builder.AddContentKey(golden_data_.CTRContent().software_decode_key);
builder.AddOperatorSessionKey(non_content_key_id_);
@@ -73,12 +68,12 @@ TEST_F(LicenseWhiteboxGetSecretStringTest, SuccessForCBCWithCryptoKey) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_OK);
ASSERT_GT(secret_string_size_, 0u);
}
@@ -86,12 +81,12 @@ TEST_F(LicenseWhiteboxGetSecretStringTest, SuccessForCTRWithCryptoKey) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CTRContent().software_crypto_key.id.data(),
golden_data_.CTRContent().software_crypto_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_OK);
ASSERT_GT(secret_string_size_, 0u);
}
@@ -99,12 +94,12 @@ TEST_F(LicenseWhiteboxGetSecretStringTest, SuccessForCBCWithDecodeKey) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCDecodeKey().id.data(),
golden_data_.CBCDecodeKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_decode_key.id.data(),
golden_data_.CBCContent().software_decode_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_OK);
ASSERT_GT(secret_string_size_, 0u);
}
@@ -112,12 +107,12 @@ TEST_F(LicenseWhiteboxGetSecretStringTest, SuccessForCTRWithDecodeKey) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CBCDecodeKey().id.data(),
golden_data_.CBCDecodeKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_OK);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CTR,
golden_data_.CTRContent().software_decode_key.id.data(),
golden_data_.CTRContent().software_decode_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_OK);
ASSERT_GT(secret_string_size_, 0u);
}
@@ -125,12 +120,12 @@ TEST_F(LicenseWhiteboxGetSecretStringTest, InvalidParameterForNullWhitebox) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_GetSecretString(nullptr, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_GetSecretString(
nullptr, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_INVALID_PARAMETER);
}
TEST_F(LicenseWhiteboxGetSecretStringTest,
@@ -144,9 +139,10 @@ TEST_F(LicenseWhiteboxGetSecretStringTest,
const WB_CipherMode invalid_mode = static_cast<WB_CipherMode>(0xFF);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, invalid_mode, golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(), secret_string_.data(),
&secret_string_size_),
whitebox_, invalid_mode,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_INVALID_PARAMETER);
}
@@ -154,22 +150,36 @@ TEST_F(LicenseWhiteboxGetSecretStringTest, InvalidParameterForNullKeyId) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC, nullptr,
golden_data_.CBCCryptoKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC, nullptr,
golden_data_.CBCContent().software_crypto_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_INVALID_PARAMETER);
}
TEST_F(LicenseWhiteboxGetSecretStringTest, InvalidParameterForZeroKeyIdSize) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(), 0,
secret_string_.data(), &secret_string_size_),
WB_RESULT_INVALID_PARAMETER);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(), 0,
secret_string_.data(), &secret_string_size_),
WB_RESULT_INVALID_PARAMETER);
}
TEST_F(LicenseWhiteboxGetSecretStringTest, CanProbeSizeWithNullString) {
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
secret_string_size_ = 0;
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
nullptr, &secret_string_size_),
WB_RESULT_BUFFER_TOO_SMALL);
ASSERT_GT(secret_string_size_, 0);
}
TEST_F(LicenseWhiteboxGetSecretStringTest,
@@ -177,10 +187,11 @@ TEST_F(LicenseWhiteboxGetSecretStringTest,
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
nullptr, &secret_string_size_),
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
nullptr, &secret_string_size_),
WB_RESULT_INVALID_PARAMETER);
}
@@ -189,10 +200,11 @@ TEST_F(LicenseWhiteboxGetSecretStringTest,
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
secret_string_.data(), nullptr),
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
secret_string_.data(), nullptr),
WB_RESULT_INVALID_PARAMETER);
}
@@ -228,12 +240,12 @@ TEST_F(LicenseWhiteboxGetSecretStringTest,
TestLicenseBuilder::Settings settings;
LoadLicense(settings);
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCHardwareKey().id.data(),
golden_data_.CBCHardwareKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_INSUFFICIENT_SECURITY_LEVEL);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().hardware_key.id.data(),
golden_data_.CBCContent().hardware_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_INSUFFICIENT_SECURITY_LEVEL);
}
TEST_F(LicenseWhiteboxGetSecretStringTest, BufferTooSmall) {
@@ -245,12 +257,12 @@ TEST_F(LicenseWhiteboxGetSecretStringTest, BufferTooSmall) {
// as it would not introduce enough variation to be effective. We avoid using
// zero here so that we can verify that we are not just checking for zero.
secret_string_size_ = 1;
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_BUFFER_TOO_SMALL);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_BUFFER_TOO_SMALL);
// Make sure that the output included the required size. We don't know what
// it is, so we rely on checking that it is just bigger than the "too small"
@@ -262,12 +274,12 @@ TEST_F(LicenseWhiteboxGetSecretStringTest, InvalidState) {
// Purposely do not load a license so that we won't have any keys, causing
// use to be in an invalid state.
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_INVALID_STATE);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_INVALID_STATE);
}
TEST_F(LicenseWhiteboxGetSecretStringTest, KeyUnavailableForInvalidKey) {
@@ -278,12 +290,12 @@ TEST_F(LicenseWhiteboxGetSecretStringTest, KeyUnavailableForInvalidKey) {
settings.include_content_key_iv = false;
LoadLicense(settings);
ASSERT_EQ(
WB_License_GetSecretString(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_KEY_UNAVAILABLE);
ASSERT_EQ(WB_License_GetSecretString(
whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCContent().software_crypto_key.id.data(),
golden_data_.CBCContent().software_crypto_key.id.size(),
secret_string_.data(), &secret_string_size_),
WB_RESULT_KEY_UNAVAILABLE);
}
} // namespace widevine

View File

@@ -21,11 +21,6 @@ class LicenseWhiteboxKeyControlBlockTest
server_ = TestServer::CreateDualKey();
}
void AddKeyToLicense(const GoldenData::Key& key,
TestLicenseBuilder* license) {
license->AddContentKey(key.level, key.id, key.content->key);
}
TestLicenseBuilder::KeyControlBlock kcb_;
TestLicenseBuilder::OdkVersion odk_;
@@ -41,9 +36,10 @@ TEST_P(LicenseWhiteboxKeyControlBlockTest, Decrypt) {
builder.GetSettings().key_control_block = kcb_;
builder.GetSettings().odk_version = odk_;
const auto& cbc_test_data = golden_data_.CBCCryptoKey();
const auto& content = golden_data_.CBCContent();
const auto& key = content.software_crypto_key;
AddKeyToLicense(cbc_test_data, &builder);
builder.AddContentKey(key);
License license;
builder.Build(*server_, &license);
@@ -57,18 +53,16 @@ TEST_P(LicenseWhiteboxKeyControlBlockTest, Decrypt) {
license.request.data(), license.request.size()),
WB_RESULT_OK);
std::vector<uint8_t> plaintext(cbc_test_data.content->ciphertext.size());
std::vector<uint8_t> plaintext(content.ciphertext.size());
size_t plaintext_size = plaintext.size();
// Make sure we can actually decrypt some data.
ASSERT_EQ(WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
cbc_test_data.id.data(), cbc_test_data.id.size(),
cbc_test_data.content->ciphertext.data(),
cbc_test_data.content->ciphertext.size(),
cbc_test_data.content->iv.data(),
cbc_test_data.content->iv.size(),
plaintext.data(), &plaintext_size),
WB_RESULT_OK);
ASSERT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC, key.id.data(),
key.id.size(), content.ciphertext.data(),
content.ciphertext.size(), content.iv.data(),
content.iv.size(), plaintext.data(), &plaintext_size),
WB_RESULT_OK);
}
TEST_P(LicenseWhiteboxKeyControlBlockTest, MaskedDecrypt) {
@@ -76,9 +70,10 @@ TEST_P(LicenseWhiteboxKeyControlBlockTest, MaskedDecrypt) {
builder.GetSettings().key_control_block = kcb_;
builder.GetSettings().odk_version = odk_;
const auto& cbc_test_data = golden_data_.CBCDecodeKey();
const auto& content = golden_data_.CBCContent();
const auto& key = content.software_decode_key;
AddKeyToLicense(cbc_test_data, &builder);
builder.AddContentKey(key);
License license;
builder.Build(*server_, &license);
@@ -92,18 +87,16 @@ TEST_P(LicenseWhiteboxKeyControlBlockTest, MaskedDecrypt) {
license.request.data(), license.request.size()),
WB_RESULT_OK);
std::vector<uint8_t> plaintext(cbc_test_data.content->ciphertext.size());
std::vector<uint8_t> plaintext(content.ciphertext.size());
size_t plaintext_size = plaintext.size();
// Make sure we can actually decrypt some data.
ASSERT_EQ(
WB_License_MaskedDecrypt(
whitebox_, WB_CIPHER_MODE_CBC, cbc_test_data.id.data(),
cbc_test_data.id.size(), cbc_test_data.content->ciphertext.data(),
cbc_test_data.content->ciphertext.size(),
cbc_test_data.content->iv.data(), cbc_test_data.content->iv.size(),
plaintext.data(), &plaintext_size),
WB_RESULT_OK);
ASSERT_EQ(WB_License_MaskedDecrypt(
whitebox_, WB_CIPHER_MODE_CBC, key.id.data(), key.id.size(),
content.ciphertext.data(), content.ciphertext.size(),
content.iv.data(), content.iv.size(), plaintext.data(),
&plaintext_size),
WB_RESULT_OK);
}
INSTANTIATE_TEST_SUITE_P(

View File

@@ -74,21 +74,19 @@ class LicenseWhiteboxLicenseKeyMode
license.request.size());
}
void Decrypt(const GoldenData::Key& golden_data) {
size_t plaintext_size = golden_data.content->plaintext.size();
void Decrypt(const GoldenData::Content& content, const ContentKeyData& key) {
size_t plaintext_size = content.plaintext.size();
std::vector<uint8_t> plaintext(plaintext_size);
ASSERT_EQ(WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data.id.data(), golden_data.id.size(),
golden_data.content->ciphertext.data(),
golden_data.content->ciphertext.size(),
golden_data.content->iv.data(),
golden_data.content->iv.size(),
plaintext.data(), &plaintext_size),
ASSERT_EQ(WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC, key.id.data(),
key.id.size(), content.ciphertext.data(),
content.ciphertext.size(), content.iv.data(),
content.iv.size(), plaintext.data(),
&plaintext_size),
WB_RESULT_OK);
plaintext.resize(plaintext_size);
ASSERT_EQ(plaintext, golden_data.content->plaintext);
ASSERT_EQ(plaintext, content.plaintext);
}
std::unique_ptr<TestServer> server_;
@@ -117,18 +115,18 @@ TEST_P(LicenseWhiteboxLicenseKeyMode, SignAndProcessLicense) {
SignLicenseRequest(*server);
const auto& golden_data = golden_data_.CBCCryptoKey();
const auto& content = golden_data_.CBCContent();
const auto& key = content.software_crypto_key;
TestLicenseBuilder builder;
builder.AddContentKey(golden_data.level, golden_data.id,
golden_data.content->key);
builder.AddContentKey(key);
License license;
builder.Build(*server, &license);
if (should_pass_) {
ASSERT_EQ(LoadLicense(license, client_mode_), WB_RESULT_OK);
Decrypt(golden_data);
Decrypt(content, key);
} else {
ASSERT_NE(LoadLicense(license, client_mode_), WB_RESULT_OK);
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
#include <stddef.h>
#include <stdint.h>
#include <tuple>
#include "api/license_whitebox.h"
#include "api/license_whitebox_benchmark.h"
@@ -14,19 +15,27 @@ namespace widevine {
namespace {
// The white-box implementation is slow, so the build bots keep timing out. To
// work around this, use a fixed number of iterations.
constexpr size_t kIterations = 100;
constexpr size_t kIterations = 10;
} // namespace
// This test takes 3 parameters. The first (key mode) will change how the
// license is encrypted and signed. The second (int) determines the number of
// content keys in the license. The third (security level) determines the
// security level of the content keys other than the first one (which is
// always kSoftwareSecureCrypto so that it works with both Decrypt() and
// MaskedDecrypt()).
class LicenseWhiteboxProcessLicenseResponseBenchmark
: public LicenseWhiteboxBenchmark,
public testing::WithParamInterface<WB_LicenseKeyMode> {
public ::testing::WithParamInterface<
std::tuple<WB_LicenseKeyMode, int, SecurityLevel>> {
protected:
void SetUp() override {
LicenseWhiteboxBenchmark::SetUp();
key_mode_ = GetParam();
key_mode_ = ::testing::get<0>(GetParam());
license_ = CreateLicense(key_mode_);
license_ = CreateLicense(key_mode_, ::testing::get<1>(GetParam()),
::testing::get<2>(GetParam()));
}
void TearDown() override { WB_License_Delete(whitebox_); }
@@ -39,6 +48,23 @@ class LicenseWhiteboxProcessLicenseResponseBenchmark
License license_;
};
TEST_P(LicenseWhiteboxProcessLicenseResponseBenchmark, ProcessLicenseCreate) {
Timer timer;
Sampler sampler;
for (size_t i = 0; i < kIterations; i++) {
timer.Reset();
ASSERT_EQ(WB_License_Create(&whitebox_), WB_RESULT_OK);
sampler.Push(timer.Get());
WB_License_Delete(whitebox_);
whitebox_ = nullptr;
}
PrettyPrint("License White-box License Create Duration", sampler,
license_.message.size());
}
TEST_P(LicenseWhiteboxProcessLicenseResponseBenchmark,
CreateAndProcessLicenseResponseAndDelete) {
Timer timer;
@@ -136,12 +162,46 @@ TEST_P(LicenseWhiteboxProcessLicenseResponseBenchmark, ProcessLicenseResponse) {
license_.message.size());
}
INSTANTIATE_TEST_SUITE_P(SingleKey,
LicenseWhiteboxProcessLicenseResponseBenchmark,
::testing::Values(WB_LICENSE_KEY_MODE_SINGLE_KEY));
INSTANTIATE_TEST_SUITE_P(
SingleKeyWithSingleKeyServer,
LicenseWhiteboxProcessLicenseResponseBenchmark,
::testing::Values(std::make_tuple(WB_LICENSE_KEY_MODE_SINGLE_KEY,
1,
SecurityLevel::kSoftwareSecureCrypto)));
INSTANTIATE_TEST_SUITE_P(DualKey,
LicenseWhiteboxProcessLicenseResponseBenchmark,
::testing::Values(WB_LICENSE_KEY_MODE_DUAL_KEY));
INSTANTIATE_TEST_SUITE_P(
FiveCryptoKeysWithSingleKeyServer,
LicenseWhiteboxProcessLicenseResponseBenchmark,
::testing::Values(std::make_tuple(WB_LICENSE_KEY_MODE_SINGLE_KEY,
5,
SecurityLevel::kSoftwareSecureCrypto)));
INSTANTIATE_TEST_SUITE_P(
FiveDecodeKeysWithSingleKeyServer,
LicenseWhiteboxProcessLicenseResponseBenchmark,
::testing::Values(std::make_tuple(WB_LICENSE_KEY_MODE_SINGLE_KEY,
5,
SecurityLevel::kSoftwareSecureDecode)));
INSTANTIATE_TEST_SUITE_P(
SingleKeyWithDualKeyServer,
LicenseWhiteboxProcessLicenseResponseBenchmark,
::testing::Values(std::make_tuple(WB_LICENSE_KEY_MODE_DUAL_KEY,
1,
SecurityLevel::kSoftwareSecureCrypto)));
INSTANTIATE_TEST_SUITE_P(
FiveCryptoKeysWithDualKeyServer,
LicenseWhiteboxProcessLicenseResponseBenchmark,
::testing::Values(std::make_tuple(WB_LICENSE_KEY_MODE_DUAL_KEY,
5,
SecurityLevel::kSoftwareSecureCrypto)));
INSTANTIATE_TEST_SUITE_P(
FiveDecodeKeysWithDualKeyServer,
LicenseWhiteboxProcessLicenseResponseBenchmark,
::testing::Values(std::make_tuple(WB_LICENSE_KEY_MODE_DUAL_KEY,
5,
SecurityLevel::kSoftwareSecureDecode)));
} // namespace widevine

View File

@@ -18,7 +18,7 @@ class LicenseWhiteboxProcessLicenseResponseWithCoreMessageTest
void UseLicenseWithoutSigningKey(OdkVersion odk_version) {
TestLicenseBuilder builder;
builder.GetSettings().odk_version = odk_version;
builder.AddStubbedContentKey();
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
const auto server = TestServer::CreateDualKey();
builder.Build(*server, &license_);
@@ -31,7 +31,7 @@ class LicenseWhiteboxProcessLicenseResponseWithCoreMessageTest
builder.GetSettings().odk_version = odk_version;
builder.AddSigningKey(TestLicenseBuilder::DefaultSigningKey());
builder.AddStubbedContentKey();
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
auto server = TestServer::CreateDualKey();
builder.Build(*server, &license_);

View File

@@ -30,7 +30,7 @@ class LicenseWhiteboxProcessLicenseResponseTest
void UseLicenseWithoutSigningKey() {
TestLicenseBuilder builder;
builder.AddStubbedContentKey();
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
builder.Build(*server_, &license_);
}
@@ -39,7 +39,7 @@ class LicenseWhiteboxProcessLicenseResponseTest
builder.GetSettings().padding = padding;
builder.AddSigningKey(TestLicenseBuilder::DefaultSigningKey());
builder.AddStubbedContentKey();
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
builder.Build(*server_, &license_);
}
@@ -98,7 +98,7 @@ TEST_F(LicenseWhiteboxProcessLicenseResponseTest,
builder.AddSigningKey(TestLicenseBuilder::DefaultSigningKey());
builder.AddSigningKey(TestLicenseBuilder::DefaultSigningKey());
builder.AddStubbedContentKey();
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
builder.Build(*server_, &license_);
ASSERT_EQ(WB_License_ProcessLicenseResponse(

View File

@@ -28,8 +28,8 @@ class LicenseWhiteboxQueryContentKeyStatus
protected:
void SetUp() override {
LicenseWhiteboxTestBase::SetUp();
decrypt_key_ = &golden_data_.CBCCryptoKey();
masked_decrypt_key_ = &golden_data_.CBCDecodeKey();
decrypt_key_ = &golden_data_.CBCContent().software_crypto_key;
masked_decrypt_key_ = &golden_data_.CBCContent().software_decode_key;
std::tie(license_parsing_, padding_) = GetParam();
@@ -40,9 +40,7 @@ class LicenseWhiteboxQueryContentKeyStatus
builder_.SetSettings(settings);
}
void AddKey(const GoldenData::Key* key) {
builder_.AddContentKey(key->level, key->id, key->content->key);
}
void AddKey(const ContentKeyData* key) { builder_.AddContentKey(*key); }
WB_Result LoadLicense() {
TestLicenseBuilder::Settings settings = builder_.GetSettings();
@@ -82,8 +80,8 @@ class LicenseWhiteboxQueryContentKeyStatus
license.request.size());
}
const GoldenData::Key* decrypt_key_;
const GoldenData::Key* masked_decrypt_key_;
const ContentKeyData* decrypt_key_;
const ContentKeyData* masked_decrypt_key_;
private:
std::unique_ptr<TestServer> server_;
@@ -180,14 +178,18 @@ TEST_P(LicenseWhiteboxQueryContentKeyStatus, InvalidKeyForNoKeyData) {
SetSettings(settings);
AddKey(decrypt_key_);
ASSERT_EQ(LoadLicense(), WB_RESULT_OK);
// Allow either a parsing error, or success and no keys loaded.
WB_Result result = LoadLicense();
if (result != WB_RESULT_INVALID_PARAMETER) {
ASSERT_EQ(result, WB_RESULT_OK);
WB_KeyStatus key_state;
ASSERT_EQ(WB_License_QueryKeyStatus(whitebox_, WB_KEY_QUERY_TYPE_CONTENT_KEY,
decrypt_key_->id.data(),
decrypt_key_->id.size(), &key_state),
WB_RESULT_OK);
ASSERT_EQ(key_state, WB_KEY_STATUS_INVALID);
WB_KeyStatus key_state;
ASSERT_EQ(WB_License_QueryKeyStatus(
whitebox_, WB_KEY_QUERY_TYPE_CONTENT_KEY,
decrypt_key_->id.data(), decrypt_key_->id.size(), &key_state),
WB_RESULT_OK);
ASSERT_EQ(key_state, WB_KEY_STATUS_INVALID);
}
}
TEST_P(LicenseWhiteboxQueryContentKeyStatus, InvalidKeyForShortKeyData) {
@@ -197,14 +199,18 @@ TEST_P(LicenseWhiteboxQueryContentKeyStatus, InvalidKeyForShortKeyData) {
SetSettings(settings);
AddKey(decrypt_key_);
ASSERT_EQ(LoadLicense(), WB_RESULT_OK);
// Allow either a parsing error, or success and no keys loaded.
WB_Result result = LoadLicense();
if (result != WB_RESULT_INVALID_PARAMETER) {
ASSERT_EQ(result, WB_RESULT_OK);
WB_KeyStatus key_state;
ASSERT_EQ(WB_License_QueryKeyStatus(whitebox_, WB_KEY_QUERY_TYPE_CONTENT_KEY,
decrypt_key_->id.data(),
decrypt_key_->id.size(), &key_state),
WB_RESULT_OK);
ASSERT_EQ(key_state, WB_KEY_STATUS_INVALID);
WB_KeyStatus key_state;
ASSERT_EQ(WB_License_QueryKeyStatus(
whitebox_, WB_KEY_QUERY_TYPE_CONTENT_KEY,
decrypt_key_->id.data(), decrypt_key_->id.size(), &key_state),
WB_RESULT_OK);
ASSERT_EQ(key_state, WB_KEY_STATUS_INVALID);
}
}
TEST_P(LicenseWhiteboxQueryContentKeyStatus, InvalidKeyForLongKeyData) {

View File

@@ -61,9 +61,7 @@ class LicenseWhiteboxQuerySigningKeyStatus
// ODK requires there to be at least one content key or else it will fail
// to create the core message.
const auto& content_key = &golden_data_.CBCCryptoKey();
builder_.AddContentKey(content_key->level, content_key->id,
content_key->content->key);
builder_.AddContentKey(golden_data_.CBCContent().software_crypto_key);
auto server = TestServer::CreateDualKey();

View File

@@ -37,8 +37,25 @@ class LicenseWhiteboxSecurityLevelTest
TEST_P(LicenseWhiteboxSecurityLevelTest, CanLoadAndUseKey) {
TestLicenseBuilder builder;
builder.GetSettings().key_control_block = key_control_block_;
builder.AddContentKey(security_level_, golden_data_.CBCCryptoKey().id,
golden_data_.CBCCryptoKey().content->key);
const auto& content = golden_data_.CBCContent();
const ContentKeyData* key = nullptr;
switch (security_level_) {
case SecurityLevel::kUndefined:
key = &content.undefined_key;
break;
case SecurityLevel::kSoftwareSecureCrypto:
key = &content.software_crypto_key;
break;
default:
ASSERT_FALSE(true);
break;
}
builder.AddContentKey(*key);
auto server = TestServer::CreateDualKey();
@@ -54,7 +71,7 @@ TEST_P(LicenseWhiteboxSecurityLevelTest, CanLoadAndUseKey) {
license.request.data(), license.request.size()),
WB_RESULT_OK);
plaintext_size_ = golden_data_.CBCCryptoKey().content->ciphertext.size();
plaintext_size_ = golden_data_.CBCContent().ciphertext.size();
plaintext_.resize(plaintext_size_);
// Make sure that the key was loaded successfully even if the security level
@@ -63,30 +80,22 @@ TEST_P(LicenseWhiteboxSecurityLevelTest, CanLoadAndUseKey) {
// Use EXPECT instead of ASSERT so that we can see the result of both decrypt
// calls before failing the test.
EXPECT_EQ(
WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC,
golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(),
plaintext_.data(), &plaintext_size_),
WB_RESULT_OK);
EXPECT_EQ(WB_License_Decrypt(whitebox_, WB_CIPHER_MODE_CBC, key->id.data(),
key->id.size(), content.ciphertext.data(),
content.ciphertext.size(), content.iv.data(),
content.iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
plaintext_size_ = golden_data_.CBCCryptoKey().content->ciphertext.size();
plaintext_size_ = content.ciphertext.size();
plaintext_.resize(plaintext_size_);
EXPECT_EQ(
WB_License_MaskedDecrypt(
whitebox_, WB_CIPHER_MODE_CBC, golden_data_.CBCCryptoKey().id.data(),
golden_data_.CBCCryptoKey().id.size(),
golden_data_.CBCCryptoKey().content->ciphertext.data(),
golden_data_.CBCCryptoKey().content->ciphertext.size(),
golden_data_.CBCCryptoKey().content->iv.data(),
golden_data_.CBCCryptoKey().content->iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
EXPECT_EQ(WB_License_MaskedDecrypt(
whitebox_, WB_CIPHER_MODE_CBC, key->id.data(), key->id.size(),
content.ciphertext.data(), content.ciphertext.size(),
content.iv.data(), content.iv.size(), plaintext_.data(),
&plaintext_size_),
WB_RESULT_OK);
}
INSTANTIATE_TEST_SUITE_P(

View File

@@ -19,7 +19,7 @@ namespace {
constexpr size_t kMessageSize = 4 * 1024;
constexpr size_t kSignatureSize = 256;
constexpr size_t kIterations = 100;
constexpr size_t kIterations = 10;
} // namespace
@@ -37,7 +37,8 @@ class LicenseWhiteboxSignBenchmark
ASSERT_EQ(WB_License_Create(&whitebox_), WB_RESULT_OK);
const auto license = CreateLicense(key_mode_);
const auto license =
CreateLicense(key_mode_, 1, SecurityLevel::kSoftwareSecureCrypto);
ASSERT_EQ(WB_License_ProcessLicenseResponse(
whitebox_, key_mode_, license.core_message.data(),
license.core_message.size(), license.message.data(),

View File

@@ -98,6 +98,15 @@ TEST_F(LicenseWhiteboxSignLicenseRequestTest,
WB_RESULT_INVALID_PARAMETER);
}
TEST_F(LicenseWhiteboxSignLicenseRequestTest, CanProbeSizeWithNullSignature) {
signature_size_ = 0;
ASSERT_EQ(WB_License_SignLicenseRequest(whitebox_, license_.request.data(),
license_.request.size(), nullptr,
&signature_size_),
WB_RESULT_BUFFER_TOO_SMALL);
ASSERT_GT(signature_size_, 0);
}
TEST_F(LicenseWhiteboxSignLicenseRequestTest,
InvalidParameterForNullSignatureSize) {
ASSERT_EQ(WB_License_SignLicenseRequest(whitebox_, license_.request.data(),

View File

@@ -32,7 +32,7 @@ class LicenseWhiteboxSignRenewalRequestTest : public LicenseWhiteboxTestBase {
builder.AddSigningKey(signing_key_);
// Add a throw away key. We just need a key in the license since a license
// should always have a content key.
builder.AddStubbedContentKey();
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
auto server = TestServer::CreateDualKey();
@@ -142,6 +142,19 @@ TEST_F(LicenseWhiteboxSignRenewalRequestTest,
WB_RESULT_INVALID_PARAMETER);
}
TEST_F(LicenseWhiteboxSignRenewalRequestTest, CanProbeSizeWithNullSignature) {
TestLicenseBuilder::Settings settings;
settings.padding = TestLicenseBuilder::Padding::kNone;
LoadLicense(settings);
signature_size_ = 0;
ASSERT_EQ(WB_License_SignRenewalRequest(whitebox_, garbage_request_.data(),
garbage_request_.size(), nullptr,
&signature_size_),
WB_RESULT_BUFFER_TOO_SMALL);
ASSERT_GT(signature_size_, 0);
}
TEST_F(LicenseWhiteboxSignRenewalRequestTest,
InvalidParameterForNullSignature) {
TestLicenseBuilder::Settings settings;
@@ -202,7 +215,7 @@ TEST_F(LicenseWhiteboxSignRenewalRequestTest, KeyUnavailableForNoSigningKey) {
// Make a license with no signing key but has a content key. Every license
// must have a content key.
TestLicenseBuilder builder;
builder.AddStubbedContentKey();
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
auto server = TestServer::CreateDualKey();

View File

@@ -12,244 +12,286 @@ namespace widevine {
namespace {
const uint8_t kMessage[] = {
0x0a, 0x2a, 0x0a, 0x10, 0x53, 0xbc, 0x88, 0x54, 0x04, 0xfc, 0x85, 0xbd,
0x75, 0xce, 0x15, 0x2a, 0x06, 0xb5, 0x1f, 0xc5, 0x12, 0x10, 0x53, 0xbc,
0x88, 0x54, 0x04, 0xfc, 0x85, 0xbd, 0x75, 0xce, 0x15, 0x2a, 0x06, 0xb5,
0x1f, 0xc5, 0x1a, 0x00, 0x20, 0x01, 0x28, 0x00, 0x12, 0x12, 0x08, 0x01,
0x10, 0x01, 0x18, 0x01, 0x20, 0x80, 0xa3, 0x05, 0x28, 0x80, 0xa3, 0x05,
0x30, 0x80, 0xa3, 0x05, 0x1a, 0x66, 0x12, 0x10, 0x94, 0x40, 0xfa, 0xa2,
0xd0, 0xe2, 0xa4, 0x80, 0xb4, 0x74, 0x68, 0x91, 0x0a, 0xb9, 0xe4, 0x6a,
0x1a, 0x50, 0x30, 0xe2, 0xcb, 0x71, 0xa1, 0x92, 0xb7, 0xc8, 0x3f, 0xd9,
0x00, 0x2e, 0xf0, 0xf8, 0xb1, 0xe6, 0x9e, 0x62, 0xca, 0x27, 0xb3, 0xa7,
0x26, 0x19, 0x73, 0x9e, 0xf8, 0xc2, 0x8e, 0x6f, 0xea, 0xb3, 0x5b, 0x01,
0xa6, 0xe8, 0x9b, 0x84, 0x1b, 0x9e, 0xaf, 0xe2, 0xa1, 0xff, 0x4a, 0xca,
0xcf, 0x84, 0x3f, 0x36, 0xaa, 0x17, 0xa6, 0x0a, 0x0a, 0xe2, 0xcc, 0x12,
0xb1, 0x9f, 0xac, 0x05, 0xdf, 0xe7, 0x00, 0xad, 0xc4, 0xa5, 0xd4, 0x4d,
0x46, 0x01, 0xbb, 0xcc, 0x18, 0x7e, 0x4d, 0xb5, 0x05, 0x2a, 0x20, 0x01,
0x1a, 0x52, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x12, 0x10, 0xf1, 0xed,
0x57, 0xf4, 0xad, 0x5d, 0x0e, 0x2c, 0xf9, 0x78, 0xc9, 0xe4, 0x4d, 0x2e,
0xcc, 0x68, 0x1a, 0x20, 0xd7, 0xf5, 0x15, 0x85, 0x3b, 0x33, 0xea, 0x8e,
0x40, 0xef, 0x2a, 0xd0, 0x8f, 0x96, 0x69, 0xb6, 0xf9, 0xdd, 0x63, 0x8f,
0x80, 0x7e, 0x68, 0x02, 0xc7, 0x74, 0x55, 0x5d, 0xd4, 0x17, 0x45, 0x09,
0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x62, 0x02, 0x48, 0x44,
0x1a, 0x52, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32, 0x12, 0x10, 0xdb, 0x38,
0x5d, 0x4a, 0x0d, 0x80, 0x37, 0x42, 0x10, 0x60, 0x0d, 0x24, 0x03, 0xde,
0xd0, 0x3c, 0x1a, 0x20, 0x22, 0xab, 0x33, 0xb9, 0xe5, 0x16, 0xa2, 0x6d,
0x5a, 0x42, 0x45, 0xd4, 0x0e, 0x47, 0x0c, 0xf3, 0x6c, 0x1f, 0x20, 0xd9,
0x0e, 0x79, 0xd7, 0xb7, 0x34, 0xc1, 0xbe, 0xd2, 0x6b, 0x01, 0xff, 0x73,
0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x62, 0x02, 0x48, 0x44,
0x1a, 0x55, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x12, 0x10, 0xdd, 0xfb,
0x7a, 0x27, 0x34, 0xd4, 0xec, 0xcf, 0x01, 0x9c, 0xbd, 0x84, 0xe3, 0xf0,
0xbd, 0xc6, 0x1a, 0x20, 0x11, 0x0c, 0xa2, 0xc3, 0xb8, 0x95, 0xaf, 0x48,
0x80, 0x57, 0xd1, 0x39, 0xec, 0xd7, 0x09, 0x5a, 0x95, 0x31, 0xf8, 0x3f,
0xa0, 0x6d, 0x9c, 0xad, 0x10, 0x70, 0xa4, 0x6b, 0x6a, 0x5c, 0xca, 0x73,
0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x62, 0x05, 0x41, 0x55,
0x44, 0x49, 0x4f, 0x1a, 0x52, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x37, 0x12,
0x10, 0xcb, 0xac, 0x50, 0x57, 0x81, 0xcd, 0x04, 0xf6, 0x71, 0xb2, 0xc2,
0x08, 0x86, 0x12, 0x78, 0x58, 0x1a, 0x20, 0x71, 0x0e, 0xd7, 0xa2, 0x8c,
0x64, 0x75, 0x0b, 0x11, 0x9e, 0x48, 0x47, 0x0c, 0x2d, 0x78, 0x48, 0x1c,
0x98, 0x2f, 0x14, 0x51, 0x15, 0x2a, 0x05, 0xe8, 0x84, 0x6e, 0x61, 0xc2,
0x26, 0x82, 0xe6, 0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x62,
0x02, 0x48, 0x44, 0x1a, 0x52, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x12,
0x10, 0xa6, 0xd4, 0xb8, 0x0a, 0x37, 0x46, 0xf6, 0xc8, 0x59, 0x5a, 0x30,
0x96, 0x39, 0x16, 0x29, 0x1e, 0x1a, 0x20, 0xff, 0xe7, 0xb2, 0x9e, 0x98,
0x40, 0x33, 0xce, 0x9e, 0xcf, 0x85, 0x60, 0x52, 0x43, 0x38, 0xe6, 0x1b,
0x07, 0x10, 0xfa, 0x71, 0xa8, 0x66, 0x0f, 0xd6, 0x9a, 0x09, 0xac, 0xb1,
0x47, 0xe4, 0x19, 0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x62,
0x02, 0x53, 0x44, 0x1a, 0x52, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x34, 0x12,
0x10, 0x57, 0x43, 0x24, 0x10, 0x4d, 0xd3, 0xcf, 0x6e, 0xef, 0x37, 0xce,
0x5b, 0xba, 0xd1, 0x61, 0x62, 0x1a, 0x20, 0x54, 0xec, 0xbb, 0xc7, 0x4b,
0xa6, 0x3f, 0x17, 0xcc, 0x5e, 0xb8, 0x20, 0x41, 0x9e, 0xcf, 0xe2, 0x9f,
0x03, 0x9d, 0x79, 0xd0, 0x06, 0x0b, 0x0e, 0x6e, 0xf4, 0x9e, 0x93, 0x92,
0x50, 0x19, 0xbd, 0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x62,
0x02, 0x53, 0x44, 0x1a, 0x52, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x35, 0x12,
0x10, 0xd7, 0x93, 0x22, 0x74, 0xf1, 0x0b, 0x61, 0x26, 0x7e, 0x16, 0xd5,
0x88, 0x5f, 0x70, 0x2b, 0x3d, 0x1a, 0x20, 0xb2, 0x21, 0xc6, 0xb4, 0x65,
0xf1, 0x00, 0x07, 0x11, 0x0e, 0xe4, 0x67, 0x3c, 0xb4, 0x4c, 0xc9, 0xe9,
0x82, 0x5e, 0xbc, 0x2a, 0x2a, 0xf0, 0x68, 0x45, 0xfe, 0xd2, 0xce, 0xea,
0xae, 0xfb, 0x9a, 0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x62,
0x02, 0x53, 0x44, 0x1a, 0x52, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36, 0x12,
0x10, 0x96, 0x9e, 0xc6, 0xcb, 0xc0, 0xbf, 0xf5, 0x83, 0xef, 0xc9, 0xe7,
0xbb, 0x2a, 0x1a, 0xce, 0x0b, 0x1a, 0x20, 0xe0, 0x23, 0x16, 0x1e, 0x00,
0x05, 0xc0, 0xfe, 0x97, 0x47, 0x5f, 0x75, 0x69, 0x8c, 0x09, 0x8b, 0x3e,
0x93, 0x1b, 0xa4, 0x84, 0x4b, 0xd3, 0xb1, 0x77, 0xd4, 0x42, 0xee, 0x7e,
0xf5, 0xe4, 0x0c, 0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x62,
0x02, 0x53, 0x44, 0x20, 0xb2, 0x88, 0xc6, 0xfa, 0x05, 0x38, 0x00,
0x0a, 0x38, 0x0a, 0x10,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x0a, 0x10, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x33, 0x12, 0x10, 0x98, 0x21, 0xd7, 0x57, 0xfe, 0xa0, 0x10,
0x76, 0x54, 0x4f, 0x72, 0x18, 0x42, 0xab, 0x9a, 0xed, 0x1a, 0x20, 0x86,
0x42, 0x40, 0x2b, 0x4e, 0x38, 0x1a, 0x0c, 0x7d, 0x29, 0x1a, 0x44, 0x4a,
0x68, 0x24, 0xc8, 0x34, 0x31, 0xf2, 0xd0, 0x2a, 0x07, 0x84, 0xfe, 0x51,
0xb0, 0x8d, 0x8f, 0x05, 0x05, 0x25, 0x55, 0x20, 0x02, 0x28, 0x01, 0x32,
0x00, 0x3a, 0x00, 0x42, 0x12, 0x0a, 0x10, 0x6b, 0x63, 0x31, 0x36, 0x00,
0x01, 0x51, 0x80, 0x01, 0x63, 0xab, 0xd0, 0x80, 0x00, 0x00, 0x08, 0x62,
0x02, 0x48, 0x44, 0x1a, 0x66, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32, 0x12,
0x10, 0x01, 0xc9, 0x40, 0x76, 0x7a, 0x89, 0xb6, 0xce, 0x46, 0x24, 0xc9,
0x2d, 0xec, 0xd8, 0xa3, 0xae, 0x1a, 0x20, 0x6a, 0x76, 0x89, 0x53, 0xf1,
0xb1, 0xef, 0x2e, 0x97, 0x34, 0x75, 0xfe, 0x17, 0x31, 0xbf, 0x08, 0x9f,
0x73, 0x5e, 0xab, 0x66, 0x33, 0x81, 0x99, 0xf6, 0xe7, 0x8b, 0x10, 0x46,
0x47, 0xc4, 0xf8, 0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x42,
0x12, 0x0a, 0x10, 0x6b, 0x63, 0x31, 0x36, 0x00, 0x01, 0x51, 0x80, 0x01,
0x63, 0xab, 0xd0, 0x80, 0x00, 0x00, 0x08, 0x62, 0x02, 0x48, 0x44, 0x1a,
0x69, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x12, 0x10, 0xa1, 0x2c, 0xfe,
0xdf, 0xf5, 0x83, 0x95, 0xa8, 0x15, 0xec, 0xad, 0x23, 0x02, 0x6a, 0xc2,
0x96, 0x1a, 0x20, 0x76, 0xd6, 0xef, 0x6f, 0x2d, 0x7e, 0xd0, 0x9c, 0x5e,
0x1e, 0x58, 0x63, 0x82, 0x1d, 0xe0, 0xe5, 0x6d, 0x62, 0x8a, 0x89, 0xc2,
0xe3, 0xce, 0xd7, 0xc3, 0xe8, 0x75, 0x8b, 0x64, 0x81, 0x6f, 0x8a, 0x20,
0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x42, 0x12, 0x0a, 0x10, 0x6b,
0x63, 0x31, 0x36, 0x00, 0x01, 0x51, 0x80, 0x01, 0x63, 0xab, 0xd0, 0x80,
0x00, 0x00, 0x08, 0x62, 0x05, 0x41, 0x55, 0x44, 0x49, 0x4f, 0x1a, 0x66,
0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x37, 0x12, 0x10, 0xf5, 0x88, 0x10, 0xa5,
0x8b, 0x02, 0xca, 0x94, 0x75, 0xd7, 0xd6, 0x98, 0x2e, 0x65, 0x87, 0x2b,
0x1a, 0x20, 0x43, 0x36, 0x3d, 0x05, 0xeb, 0xb4, 0x92, 0x7c, 0x9e, 0xc5,
0x86, 0xff, 0xe7, 0x6a, 0x5d, 0xb2, 0x35, 0x6d, 0x1e, 0xc8, 0x6e, 0xde,
0x27, 0xfa, 0xac, 0xd3, 0x3d, 0x6e, 0xcc, 0x42, 0x6c, 0xa5, 0x20, 0x02,
0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x42, 0x12, 0x0a, 0x10, 0x6b, 0x63,
0x31, 0x36, 0x00, 0x01, 0x51, 0x80, 0x01, 0x63, 0xab, 0xd0, 0x80, 0x00,
0x00, 0x08, 0x62, 0x02, 0x48, 0x44, 0x1a, 0x66, 0x0a, 0x10, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x31, 0x12, 0x10, 0xdf, 0x81, 0x18, 0xb6, 0xf0, 0xf6, 0xef, 0x8a,
0x66, 0xd1, 0x0b, 0x30, 0x6b, 0x15, 0x76, 0x70, 0x1a, 0x20, 0x44, 0xea,
0x2c, 0xec, 0xe7, 0x93, 0x9e, 0xfb, 0xc2, 0xca, 0xb9, 0x83, 0x74, 0xcb,
0x0f, 0x89, 0x7b, 0x05, 0xb3, 0xea, 0x12, 0xc2, 0x63, 0xf4, 0x17, 0x8c,
0x62, 0xd5, 0xce, 0xe7, 0x7f, 0xa3, 0x20, 0x02, 0x28, 0x01, 0x32, 0x00,
0x3a, 0x00, 0x42, 0x12, 0x0a, 0x10, 0x6b, 0x63, 0x31, 0x36, 0x00, 0x01,
0x51, 0x80, 0x01, 0x63, 0xab, 0xd0, 0x80, 0x00, 0x00, 0x08, 0x62, 0x02,
0x53, 0x44, 0x1a, 0x66, 0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x34, 0x12, 0x10,
0x49, 0x68, 0x4d, 0x67, 0x0c, 0xdd, 0xbb, 0x57, 0xcc, 0xce, 0x83, 0x3f,
0x4b, 0xcf, 0x7f, 0x8a, 0x1a, 0x20, 0x38, 0x91, 0x22, 0xc0, 0x7e, 0x89,
0xe4, 0x40, 0xa3, 0x55, 0x7e, 0x65, 0x6e, 0x7d, 0x2a, 0xad, 0x8f, 0x17,
0x70, 0x5d, 0xe3, 0x4a, 0x92, 0x12, 0x26, 0x10, 0x11, 0x4e, 0x78, 0x9a,
0x2d, 0xa1, 0x20, 0x02, 0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x42, 0x12,
0x0a, 0x10, 0x6b, 0x63, 0x31, 0x36, 0x00, 0x01, 0x51, 0x80, 0x01, 0x63,
0xab, 0xd0, 0x80, 0x00, 0x00, 0x08, 0x62, 0x02, 0x53, 0x44, 0x1a, 0x66,
0x0a, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x35, 0x12, 0x10, 0xc8, 0x2d, 0x4d, 0x9c,
0x1b, 0xbe, 0x00, 0xb3, 0x48, 0x6b, 0x57, 0xe5, 0x1e, 0x13, 0x14, 0xc9,
0x1a, 0x20, 0x5a, 0x01, 0xbd, 0x78, 0xa0, 0x24, 0x10, 0xba, 0xde, 0xf1,
0x1c, 0x29, 0x12, 0x87, 0x9e, 0x5f, 0xf7, 0x60, 0xd6, 0x06, 0x96, 0x0e,
0x2e, 0x77, 0x08, 0x6e, 0xda, 0x15, 0xac, 0x05, 0x43, 0xc5, 0x20, 0x02,
0x28, 0x01, 0x32, 0x00, 0x3a, 0x00, 0x42, 0x12, 0x0a, 0x10, 0x6b, 0x63,
0x31, 0x36, 0x00, 0x01, 0x51, 0x80, 0x01, 0x63, 0xab, 0xd0, 0x80, 0x00,
0x00, 0x08, 0x62, 0x02, 0x53, 0x44, 0x1a, 0x66, 0x0a, 0x10, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x36, 0x12, 0x10, 0x83, 0x61, 0x7c, 0xa2, 0x1a, 0x00, 0xe3, 0x7b,
0x02, 0x41, 0x3d, 0xc6, 0x42, 0x06, 0x6f, 0x51, 0x1a, 0x20, 0xef, 0x46,
0xa3, 0x3f, 0x88, 0x0d, 0x1c, 0x89, 0xa4, 0xed, 0xe5, 0x7e, 0xeb, 0x03,
0x5c, 0x75, 0x34, 0x6a, 0x5a, 0x7d, 0xf7, 0xcf, 0x96, 0x3d, 0x18, 0x8e,
0xd2, 0x09, 0xf2, 0x64, 0x37, 0x27, 0x20, 0x02, 0x28, 0x01, 0x32, 0x00,
0x3a, 0x00, 0x42, 0x12, 0x0a, 0x10, 0x6b, 0x63, 0x31, 0x36, 0x00, 0x01,
0x51, 0x80, 0x01, 0x63, 0xab, 0xd0, 0x80, 0x00, 0x00, 0x08, 0x62, 0x02,
0x53, 0x44, 0x20, 0xe4, 0xa4, 0xd9, 0x86, 0x06, 0x38, 0x00,
};
const uint8_t kSignature[] = {
0x34, 0x7e, 0xc1, 0xa9, 0x3e, 0x1d, 0x66, 0x77, 0x5d, 0xac, 0xe8,
0x8b, 0xc0, 0x37, 0x3e, 0x4c, 0x9b, 0xe5, 0x9c, 0x25, 0x04, 0xed,
0x3f, 0x66, 0x6e, 0x6c, 0x51, 0x42, 0x57, 0x7f, 0x6c, 0x53,
0x78, 0xfb, 0xe1, 0x05, 0xc8, 0x36, 0xe6, 0x12, 0x64, 0xbf, 0x26,
0x91, 0x46, 0x11, 0xa1, 0xe5, 0x3b, 0xf0, 0x39, 0x42, 0x34, 0x26,
0x0a, 0xbd, 0x54, 0xe8, 0x69, 0xeb, 0x78, 0x76, 0x4e, 0xab,
};
const uint8_t kSessionKey[] = {
0x21, 0xd8, 0x3b, 0x58, 0xda, 0xa9, 0x3a, 0x1c, 0xdb, 0xfb, 0x54, 0xff,
0x0d, 0x30, 0xcd, 0x00, 0xff, 0x52, 0xc4, 0xed, 0x5c, 0xf9, 0xc9, 0x1c,
0x7b, 0x41, 0x48, 0xc0, 0x98, 0xa9, 0x74, 0x99, 0x79, 0xa0, 0x75, 0xc3,
0x50, 0xf0, 0xac, 0xfa, 0xec, 0xc4, 0xc0, 0x34, 0x06, 0x5b, 0xb9, 0xaa,
0x6d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b9, 0xdc, 0x1d, 0x81, 0x92, 0x13, 0xfe,
0x85, 0x50, 0x53, 0x4a, 0x0a, 0xa2, 0x24, 0x52, 0x26, 0x9a, 0x65, 0x28,
0x13, 0x26, 0xae, 0xf3,
0x90, 0xce, 0xab, 0x08, 0x31, 0xfa, 0x7c, 0xc4, 0x9c, 0xf4, 0x03, 0xe8,
0x6f, 0xa8, 0x81, 0xd0, 0x60, 0xa1, 0xd5, 0x90, 0x86, 0x04, 0x86, 0xbb,
0x32, 0xea, 0x44, 0xff, 0xba, 0x88, 0x34, 0x10, 0xef, 0x0f, 0x1a, 0xe2,
0x80, 0xa9, 0xf6, 0x26, 0x17, 0x56, 0xe5, 0x1c, 0xd2, 0x92, 0xb7, 0x2d,
0xb5, 0x8c, 0x6b, 0x11, 0x5b, 0x67, 0xe6, 0x1a, 0xa2, 0x58, 0x2b, 0x3d,
0xc1, 0x76, 0x4b, 0xf8, 0x4e, 0x71, 0x69, 0xab, 0xdb, 0x3b, 0xdf, 0xca,
0x62, 0xe0, 0x95, 0x91, 0x2d, 0x4f, 0x52, 0x7e, 0xd6, 0x42, 0xb7, 0xd1,
0xd5, 0x5b, 0x1b, 0xc5, 0xde, 0x23, 0x45, 0xa3, 0xd6, 0x3f, 0x2c, 0x69,
0xcb, 0xb6, 0xfd, 0x38, 0xdd, 0xa4, 0xb8, 0x53, 0xff, 0xa8, 0x06, 0x80,
0x31, 0x7c, 0x16, 0x26, 0xd1, 0x20, 0x4b, 0x96, 0x57, 0xdd, 0x96, 0xf5,
0x04, 0x80, 0x9b, 0x1e, 0x7a, 0xca, 0x8d, 0xb2,
};
const uint8_t kLicenseRequest[] = {
0x0a, 0x88, 0x0b, 0x08, 0x01, 0x12, 0xed, 0x09, 0x0a, 0xb0, 0x02, 0x08,
0x02, 0x12, 0x10, 0x0c, 0x36, 0x48, 0x86, 0x75, 0xa1, 0x84, 0x53, 0x4d,
0xbc, 0x55, 0x96, 0xc9, 0xf4, 0xaf, 0x0a, 0x18,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 0x65, 0x1a, 0x17, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x09, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65,
0x43, 0x44, 0x4d, 0x1a, 0x16, 0x0a, 0x0d, 0x70, 0x6c, 0x61, 0x74, 0x66,
0x6f, 0x72, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x05, 0x4c, 0x69,
0x6e, 0x75, 0x78, 0x1a, 0x24, 0x0a, 0x14, 0x77, 0x69, 0x64, 0x65, 0x76,
0x69, 0x6e, 0x65, 0x5f, 0x63, 0x64, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x34, 0x2e, 0x31, 0x30, 0x2e, 0x31, 0x36,
0x38, 0x36, 0x2e, 0x39, 0x36, 0x32, 0x08, 0x08, 0x00, 0x10, 0x00, 0x18,
0x01, 0x20, 0x00, 0x12, 0x3f, 0x0a, 0x3d, 0x0a, 0x27, 0x08, 0x01, 0x12,
0x01, 0x30, 0x1a, 0x0d, 0x77, 0x69, 0x64, 0x65, 0x76, 0x69, 0x6e, 0x65,
0x5f, 0x74, 0x65, 0x73, 0x74, 0x22, 0x0a, 0x32, 0x30, 0x31, 0x35, 0x5f,
0x74, 0x65, 0x61, 0x72, 0x73, 0x2a, 0x05, 0x41, 0x55, 0x44, 0x49, 0x4f,
0x10, 0x01, 0x1a, 0x10, 0x53, 0xbc, 0x88, 0x54, 0x04, 0xfc, 0x85, 0xbd,
0x75, 0xce, 0x15, 0x2a, 0x06, 0xb5, 0x1f, 0xc5, 0x18, 0x01, 0x20, 0xb2,
0x88, 0xc6, 0xfa, 0x05, 0x30, 0x15,
0x0a, 0x9f, 0x0b, 0x08, 0x01, 0x12, 0x83, 0x0a, 0x0a, 0xc3, 0x02, 0x08,
0x02, 0x12, 0x10, 0xa6, 0x06, 0x35, 0x4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0x16, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x5f,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x06, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x1a, 0x17, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x09, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65, 0x43, 0x44,
0x4d, 0x1a, 0x16, 0x0a, 0x0d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72,
0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x05, 0x4c, 0x69, 0x6e, 0x75,
0x78, 0x1a, 0x23, 0x0a, 0x14, 0x77, 0x69, 0x64, 0x65, 0x76, 0x69, 0x6e,
0x65, 0x5f, 0x63, 0x64, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x12, 0x0b, 0x34, 0x2e, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x32, 0x30,
0x32, 0x30, 0x32, 0x0a, 0x08, 0x01, 0x10, 0x00, 0x18, 0x01, 0x20, 0x00,
0x28, 0x10, 0x12, 0x3c, 0x0a, 0x3a, 0x0a, 0x24, 0x08, 0x01, 0x12, 0x01,
0x35, 0x1a, 0x0d, 0x77, 0x69, 0x64, 0x65, 0x76, 0x69, 0x6e, 0x65, 0x5f,
0x74, 0x65, 0x73, 0x74, 0x22, 0x0a, 0x32, 0x30, 0x31, 0x35, 0x5f, 0x74,
0x65, 0x61, 0x72, 0x73, 0x2a, 0x02, 0x53, 0x44, 0x10, 0x01, 0x1a, 0x10,
0x0b, 0x66, 0x84, 0x0b, 0x99, 0x6a, 0x03, 0xac, 0xdc, 0x64, 0x29, 0x5f,
0xb4, 0xbf, 0xbc, 0x3b, 0x18, 0x01, 0x20, 0xe4, 0xa4, 0xd9, 0x86, 0x06,
0x30, 0x15, 0x38, 0xd0, 0xd7, 0x8e, 0x0b,
};
const uint8_t kCoreMessage[] = {
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0xc8, 0x00, 0x05, 0x00, 0x10,
0x01, 0x63, 0xab, 0xd0, 0x82, 0x87, 0xf6, 0xac, 0x00, 0x00, 0x00, 0x57,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x50,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x51, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x51, 0x80, 0x00, 0x00, 0x00, 0x00,
0x01, 0xe1, 0x33, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbf,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x01, 0x27, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x39,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x4b, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x8f, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x01, 0xa1, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0xb3,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0xfa,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x02, 0x1e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x02, 0x62, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0x74,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0x86, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0xca, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x02, 0xdc, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0xee,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x03, 0x32,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x03, 0x44, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x03, 0x56, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x03, 0x9a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x03, 0xac,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x03, 0xbe, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f,
0x00, 0x00, 0x00, 0x10, 0x1a, 0xe1, 0x53, 0x83, 0x05, 0x9f, 0x0d, 0xe1,
0x9c, 0x7c, 0x45, 0xd3, 0xf0, 0x2c, 0x2b, 0xe2, 0xca, 0xdf, 0x22, 0x34,
0x38, 0xea, 0x2d, 0xf4, 0x35, 0x6a, 0x96, 0xac, 0x90, 0x57, 0x05, 0xb7,
};
const size_t kMessageSize = sizeof(kMessage);
const size_t kLicenseRequestSize = sizeof(kLicenseRequest);
const size_t kSignatureSize = sizeof(kSignature);
const size_t kSessionKeySize = sizeof(kSessionKey);
// The pointer for core message must be non-null, but the length needs to be
// zero.
const uint8_t kCoreMessage[] = {0};
const size_t kCoreMessageSize = 0;
const size_t kCoreMessageSize = sizeof(kCoreMessage);
const uint8_t kPlaintext[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@@ -29,7 +29,8 @@ class LicenseWhiteboxVerifyBenchmark : public LicenseWhiteboxBenchmark {
ASSERT_EQ(WB_License_Create(&whitebox_), WB_RESULT_OK);
const auto license = CreateLicense(WB_LICENSE_KEY_MODE_DUAL_KEY);
const auto license = CreateLicense(WB_LICENSE_KEY_MODE_DUAL_KEY, 1,
SecurityLevel::kSoftwareSecureCrypto);
ASSERT_EQ(WB_License_ProcessLicenseResponse(
whitebox_, WB_LICENSE_KEY_MODE_DUAL_KEY,
license.core_message.data(), license.core_message.size(),
@@ -49,7 +50,7 @@ class LicenseWhiteboxVerifyBenchmark : public LicenseWhiteboxBenchmark {
};
TEST_F(LicenseWhiteboxVerifyBenchmark, VerifyRenewalResponse) {
constexpr size_t kIterations = 100;
constexpr size_t kIterations = 10;
Timer timer;
Sampler sampler;

View File

@@ -32,7 +32,7 @@ class LicenseWhiteboxVerifyRenewalResponseTest
builder.SetSettings(settings);
builder.AddSigningKey(signing_key);
builder.AddStubbedContentKey();
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
auto server = TestServer::CreateDualKey();
@@ -229,7 +229,7 @@ TEST_F(LicenseWhiteboxVerifyRenewalResponseTest,
// Create a license with no signing key and one content key (every license
// must have a content key).
widevine::TestLicenseBuilder builder;
builder.AddStubbedContentKey();
builder.AddContentKey(golden_data_.CBCContent().software_crypto_key);
auto server = TestServer::CreateDualKey();

View File

@@ -116,25 +116,27 @@ class RemoteAttestationAndVerificationTest
mode_ = DisableOverride(key, mode_);
}
content_ = golden_data_.CBCContent();
switch (key) {
case Key::kCrypto:
key_ = golden_data_.CBCCryptoKey();
key_ = content_.software_crypto_key;
break;
case Key::kDecode:
key_ = golden_data_.CBCDecodeKey();
key_ = content_.software_decode_key;
break;
case Key::kHardware:
key_ = golden_data_.CBCHardwareKey();
key_ = content_.hardware_key;
break;
}
}
WB_Result LoadLicense(const GoldenData::Key& key,
WB_Result LoadLicense(const ContentKeyData& key,
RemoteAttestation remote_attestation,
VerificationStatus verification_status,
Padding padding) {
TestLicenseBuilder builder;
builder.AddContentKey(key.level, key.id, key.content->key);
builder.AddContentKey(key);
builder.GetSettings().remote_attestation = remote_attestation;
builder.GetSettings().verification_status = verification_status;
builder.GetSettings().padding = padding;
@@ -153,30 +155,30 @@ class RemoteAttestationAndVerificationTest
license.request.size());
}
WB_Result Decrypt(const GoldenData::Key& key) {
size_t plaintext_size = key.content->ciphertext.size();
WB_Result Decrypt(const GoldenData::Content& content,
const ContentKeyData& key) {
size_t plaintext_size = content.ciphertext.size();
plaintext_.resize(plaintext_size);
auto result = WB_License_Decrypt(
whitebox_, WB_CIPHER_MODE_CBC, key.id.data(), key.id.size(),
key.content->ciphertext.data(), key.content->ciphertext.size(),
key.content->iv.data(), key.content->iv.size(), plaintext_.data(),
&plaintext_size);
content.ciphertext.data(), content.ciphertext.size(), content.iv.data(),
content.iv.size(), plaintext_.data(), &plaintext_size);
plaintext_.resize(plaintext_size);
return result;
}
WB_Result MaskedDecrypt(const GoldenData::Key& key) {
size_t masked_text_size = key.content->ciphertext.size();
WB_Result MaskedDecrypt(const GoldenData::Content& content,
const ContentKeyData& key) {
size_t masked_text_size = content.ciphertext.size();
std::vector<uint8_t> masked_text(masked_text_size);
auto result = WB_License_MaskedDecrypt(
whitebox_, WB_CIPHER_MODE_CBC, key.id.data(), key.id.size(),
key.content->ciphertext.data(), key.content->ciphertext.size(),
key.content->iv.data(), key.content->iv.size(), masked_text.data(),
&masked_text_size);
content.ciphertext.data(), content.ciphertext.size(), content.iv.data(),
content.iv.size(), masked_text.data(), &masked_text_size);
masked_text.resize(masked_text_size);
@@ -210,11 +212,13 @@ class RemoteAttestationAndVerificationTest
}
Padding padding_;
GoldenData::Key key_;
RemoteAttestation ra_;
VerificationStatus vmp_;
Mode mode_;
GoldenData::Content content_;
ContentKeyData key_;
// This is the buffer used to store the output of each decrypt and unmask
// call.
std::vector<uint8_t> plaintext_;
@@ -225,21 +229,21 @@ TEST_P(RemoteAttestationAndVerificationTest, Decrypt) {
switch (mode_) {
case Mode::kDecryptPass:
ASSERT_EQ(Decrypt(key_), WB_RESULT_OK);
ASSERT_EQ(plaintext_, key_.content->plaintext);
ASSERT_EQ(Decrypt(content_, key_), WB_RESULT_OK);
ASSERT_EQ(plaintext_, content_.plaintext);
break;
case Mode::kDecryptFail:
ASSERT_NE(Decrypt(key_), WB_RESULT_OK);
ASSERT_NE(Decrypt(content_, key_), WB_RESULT_OK);
break;
case Mode::kMaskedDecryptPass:
ASSERT_EQ(MaskedDecrypt(key_), WB_RESULT_OK);
ASSERT_EQ(plaintext_, key_.content->plaintext);
ASSERT_EQ(MaskedDecrypt(content_, key_), WB_RESULT_OK);
ASSERT_EQ(plaintext_, content_.plaintext);
break;
case Mode::kMaskedDecryptFail:
ASSERT_NE(MaskedDecrypt(key_), WB_RESULT_OK);
ASSERT_NE(MaskedDecrypt(content_, key_), WB_RESULT_OK);
break;
}
}

View File

@@ -30,6 +30,14 @@ enum class SecurityLevel {
kUndefined,
};
struct ContentKeyData {
// The unique key id for this key. Any instance with this id should contain
// the same level and key as this.
KeyId id;
SecurityLevel level;
AesKey key;
};
} // namespace widevine
#endif // WHITEBOX_API_TEST_KEY_TYPES_H_

View File

@@ -236,7 +236,7 @@ std::vector<uint8_t> GetPadding(TestLicenseBuilder::Padding padding) {
return {};
}
void AddContentKeyToContainer(const TestLicenseBuilder::ContentKey& key_data,
void AddContentKeyToContainer(const ContentKeyData& key_data,
const TestLicenseBuilder::Settings& settings,
const std::string& container_key,
video_widevine::License_KeyContainer* container) {
@@ -414,22 +414,8 @@ void TestLicenseBuilder::AddSigningKey(const SigningKey& key) {
signing_keys_.push_back(key);
}
void TestLicenseBuilder::AddStubbedContentKey() {
content_keys_.emplace_back();
auto& key_data = content_keys_.back();
key_data.level = SecurityLevel::kSoftwareSecureCrypto;
key_data.id = {0, 0, 0, 0};
key_data.key = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
}
void TestLicenseBuilder::AddContentKey(SecurityLevel level,
const KeyId& id,
const AesKey& key) {
content_keys_.emplace_back();
auto& key_data = content_keys_.back();
key_data.level = level;
key_data.id = id;
key_data.key = key;
void TestLicenseBuilder::AddContentKey(const ContentKeyData& key) {
content_keys_.push_back(key);
}
void TestLicenseBuilder::AddOperatorSessionKey(const KeyId& id) {

View File

@@ -9,7 +9,7 @@
#include "api/test_key_types.h"
#include "api/test_server.h"
#include "cdm/protos/license_protocol.pb.h"
#include "license_protocol.pb.h"
namespace widevine {
@@ -28,21 +28,6 @@ struct License {
class TestLicenseBuilder {
public:
struct ContentKey {
KeyId id;
AesKey key;
// Default to the security level being undefined in the key container. When
// undefined, the key should be treated as if it is "software secure
// crypto".
//
// However, when we use the key control block, the security level in the key
// container does not matter as the key control block will always have the
// security level.
SecurityLevel level = SecurityLevel::kUndefined;
};
// Signing keys must be 512 bits (64 bytes).
using SigningKey = std::array<uint8_t, 64>;
@@ -125,11 +110,7 @@ class TestLicenseBuilder {
void AddSigningKey(const SigningKey& key);
// Add a content key so that there is some key in the license. This should not
// be used with AddContentKey().
void AddStubbedContentKey();
void AddContentKey(SecurityLevel level, const KeyId& id, const AesKey& key);
void AddContentKey(const ContentKeyData& key);
// The key id will matter as we will need to reference it, but the key won't
// matter since we are only using it as a means to verify that a non-content
@@ -156,7 +137,7 @@ class TestLicenseBuilder {
Settings settings_;
std::vector<ContentKey> content_keys_;
std::vector<ContentKeyData> content_keys_;
std::vector<SigningKey> signing_keys_;
std::vector<KeyId> operator_session_keys_;
};

View File

@@ -2,164 +2,166 @@
#include "api/test_license_whitebox_keys.h"
// When the license response was collected for the UAT tests, the license server
// only supported a single key. In order for the UAT tests to work, the
// encryption and signing keys must be the same key.
namespace widevine {
namespace {
constexpr uint8_t kDevicePublicKey[] = {
0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xae, 0xa6, 0xa8,
0xea, 0xdd, 0xac, 0x6f, 0xb4, 0x41, 0x47, 0xcb, 0x18, 0x81, 0xeb, 0xdf,
0x4f, 0x17, 0xf7, 0x17, 0xc0, 0xab, 0x6f, 0x47, 0x50, 0xbf, 0xe4, 0x8c,
0xc9, 0x45, 0x24, 0x5e, 0x1c, 0x2e, 0x86, 0x9f, 0xcb, 0x47, 0x05, 0xf9,
0xfe, 0x91, 0x90, 0xaf, 0xbd, 0x22, 0x14, 0x47, 0xa7, 0x34, 0x39, 0x79,
0x44, 0xe9, 0x92, 0x83, 0x4a, 0x80, 0xa8, 0x2a, 0xe6, 0x9f, 0x2b, 0xb7,
0xda, 0x2a, 0xd2, 0xae, 0x57, 0x5b, 0xfa, 0xb6, 0xdf, 0xca, 0x3e, 0xb1,
0xb8, 0x42, 0x0b, 0xde, 0x46, 0x36, 0xdb, 0x42, 0x33, 0x8b, 0xda, 0x5c,
0x60, 0x44, 0x7c, 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b3, 0x2f, 0x66,
0xe3, 0xd2, 0xb8, 0xee, 0x22, 0xa0, 0x3c, 0x76, 0x06, 0x67, 0xd8, 0xc1,
0xbc, 0xe6, 0xbe, 0x6f, 0xb3, 0x93, 0xee, 0xd4, 0xe6, 0xcb, 0x11, 0x00,
0xb5, 0x16, 0x49, 0xe1, 0x8e, 0xcc, 0xea, 0xbe, 0xc6, 0x45, 0x34, 0xfc,
0x13, 0xed, 0x0a, 0x90, 0x22, 0xe0, 0x6d, 0x6f, 0xaf, 0x64, 0xa8, 0xc2,
0x05, 0xf9, 0x2c, 0x51, 0x52, 0xd4, 0x42, 0x47, 0xfe, 0x03, 0x99, 0xf1,
0x03, 0x7e, 0x09, 0x08, 0x65, 0x50, 0xb9, 0x36, 0x8f, 0x62, 0xc5, 0x1a,
0x18, 0x27, 0xb8, 0xf3, 0x89, 0x53, 0x5a, 0x9d, 0xfb, 0xe4, 0x9b, 0xb4,
0xea, 0x48, 0x7c, 0x0f, 0x30, 0x02, 0x82, 0x6c, 0xf7, 0xb6, 0xf7, 0x82,
0x1f, 0xbb, 0x0b, 0x87, 0x95, 0xd0, 0xda, 0x7e, 0xb9, 0x0e, 0x58, 0xa3,
0x6d, 0xde, 0x50, 0x4d, 0xa0, 0x21, 0x1b, 0x72, 0xf3, 0x97, 0xbf, 0x98,
0xab, 0xb1, 0x5b, 0x02, 0x03, 0x01, 0x00, 0x01,
};
constexpr uint8_t kDevicePrivateKey[] = {
0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
0xae, 0xa6, 0xa8, 0xea, 0xdd, 0xac, 0x6f, 0xb4, 0x41, 0x47, 0xcb, 0x18,
0x81, 0xeb, 0xdf, 0x4f, 0x17, 0xf7, 0x17, 0xc0, 0xab, 0x6f, 0x47, 0x50,
0xbf, 0xe4, 0x8c, 0xc9, 0x45, 0x24, 0x5e, 0x1c, 0x2e, 0x86, 0x9f, 0xcb,
0x47, 0x05, 0x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 0xba, 0xa5, 0xe3, 0xfe, 0xce, 0x8e, 0x67, 0xc5,
0x54, 0x41, 0x8c, 0x44, 0xc5, 0x50, 0x55, 0x7a, 0x7c, 0x91, 0xc9, 0x2e,
0x9e, 0x32, 0x63, 0x37, 0x42, 0x68, 0x29, 0x76, 0x41, 0xdb, 0x77, 0xfd,
0xcb, 0x6a, 0x73, 0x10,
constexpr uint8_t kEncryptionPublicKey[] = {
0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xb5, 0xdf, 0x28, 0x81, 0xfc,
0x29, 0x80, 0xe4, 0xe6, 0x49, 0x6e, 0x62, 0xe5, 0xf3, 0x23, 0x99, 0x59,
0x54, 0x84, 0x1b, 0xf1, 0xde, 0x27, 0x8b, 0xe6, 0x22, 0xec, 0x02, 0x68,
0x58, 0x6e, 0x5b, 0x11, 0x90, 0x7a, 0xb3, 0xb3, 0x35, 0xab, 0x02, 0xb7,
0xf6, 0xd8, 0x74, 0xef, 0x90, 0xd8, 0xab, 0xb1, 0x44, 0x04, 0x7e, 0x15,
0x02, 0xac, 0x9d, 0x1e, 0x4e, 0xef, 0x9c, 0xdf, 0x31, 0xdb, 0x7a, 0x03,
0xd6, 0xa9, 0xfe, 0x6e, 0xd6, 0x4e, 0x5d, 0xaf, 0xdd, 0x63, 0x62, 0x5e,
0xa9, 0x56, 0x82, 0x2c, 0x09, 0x26, 0xc5, 0x61, 0x58, 0xf2, 0x04, 0xd5,
0x0a, 0x40, 0x22, 0xb7, 0x9a, 0x46, 0x4d, 0x88, 0x2c, 0x75, 0x8f, 0xc1,
0x18, 0x6a, 0xf8, 0xf6, 0x5d, 0xb1, 0x77, 0x24, 0xcb, 0x0e, 0x0f, 0x99,
0x38, 0x7c, 0x0a, 0x4a, 0xd1, 0xda, 0xef, 0x35, 0x80, 0x60, 0x56, 0xbc,
0xe9, 0x16, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01,
};
constexpr uint8_t kSigningPrivateKey[] = {
0x30, 0x82,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x56, 0xa9, 0x17, 0xd1, 0x08, 0x44,
0x29, 0x10, 0x6d, 0x0d, 0x50, 0x2c, 0x49, 0x1d, 0x6b, 0x3f, 0x84, 0x5c,
0xe8, 0x69, 0x1f, 0x83, 0xa8, 0xc2, 0x59, 0x88, 0x6a, 0x18, 0x02, 0x42,
0xfb, 0xf2, 0x85, 0x64, 0x2b, 0x42, 0xc5, 0xc4, 0x8d, 0xc4, 0x28, 0x13,
0x95, 0x3c, 0x96, 0x61, 0x21, 0x61, 0x01, 0x9b,
};
constexpr uint8_t kEncryptionPrivateKey[] = {
0x30, 0x82, 0x02, 0x5e, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xb5,
0xdf, 0x28, 0x81, 0xfc, 0x29, 0x80, 0xe4, 0xe6, 0x49, 0x6e, 0x62, 0xe5,
0xf3, 0x23, 0x99, 0x59, 0x54, 0x84, 0x1b, 0xf1, 0xde, 0x27, 0x8b, 0xe6,
0x22, 0xec, 0x02, 0x68, 0x58, 0x6e, 0x5b, 0x11, 0x90, 0x7a, 0xb3, 0xb3,
0x35, 0xab, 0x02, 0xb7, 0xf6, 0xd8, 0x74, 0xef, 0x90, 0xd8, 0xab, 0xb1,
0x44, 0x04, 0x7e, 0x15, 0x02, 0xac, 0x9d, 0x1e, 0x4e, 0xef, 0x9c, 0xdf,
0x31, 0xdb, 0x7a, 0x03, 0xd6, 0xa9, 0xfe, 0x6e, 0xd6, 0x4e, 0x5d, 0xaf,
0xdd, 0x63, 0x62, 0x5e, 0xa9, 0x56, 0x82, 0x2c, 0x09, 0x26, 0xc5, 0x61,
0x58, 0xf2, 0x04, 0xd5, 0x0a, 0x40, 0x22, 0xb7, 0x9a, 0x46, 0x4d, 0x88,
0x2c, 0x75, 0x8f, 0xc1, 0x18, 0x6a, 0xf8, 0xf6, 0x5d, 0xb1, 0x77, 0x24,
0xcb, 0x0e, 0x0f, 0x99, 0x38, 0x7c, 0x0a, 0x4a, 0xd1, 0xda, 0xef, 0x35,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 0x3d, 0xd6, 0x78, 0x67, 0xd4,
0x19, 0xcf, 0x6c, 0x27, 0x5e, 0xea, 0x28, 0x81, 0x7b, 0xf8, 0xfd, 0x25,
0xa5, 0x35, 0x15, 0x63, 0x94, 0x47, 0x02, 0x41, 0x00, 0xc5, 0x16, 0xa5,
0x1b, 0x0d, 0xeb, 0x48, 0xce, 0x2b, 0x55, 0xef, 0xd1, 0x69, 0xa2, 0x78,
0x12, 0x32, 0x72, 0x89, 0xa8, 0x3b, 0xbb, 0x07, 0x1d, 0x89, 0x36, 0x5b,
0x7d, 0x41, 0xc0, 0xcf, 0xef, 0xad, 0x29, 0xda, 0x3e, 0x11, 0x80, 0xe7,
0x97, 0xac, 0x7f, 0x18, 0xa9, 0xb5, 0x76, 0x60, 0xf3, 0x42, 0x01, 0xa4,
0xa3, 0xf2, 0x05, 0x91, 0x58, 0x90, 0x83, 0x53, 0xa1, 0x74, 0x7c, 0x2f,
0xd1, 0x02, 0x41, 0x00, 0xb2, 0xf4, 0x3f, 0x73, 0xc2, 0x1f, 0x2d, 0x1a,
0x33, 0xef, 0x7f, 0xa8, 0xb6, 0x24, 0x8f, 0x20, 0xa1, 0xd3, 0x73, 0x2a,
0x23, 0x95, 0xc9, 0xe5, 0x29, 0xf3, 0xae, 0x2b, 0x52, 0xb9, 0xc3, 0x26,
0x69, 0x8e, 0xb9, 0x67, 0x46, 0x43, 0x35, 0xe9, 0x7d, 0x06, 0xe3, 0x27,
0x47, 0x10, 0x27, 0x95, 0x37, 0xcb, 0x03, 0x5d, 0xc2, 0xdd, 0x83, 0xfa,
0x74, 0x5a, 0x46, 0x32, 0x56, 0x47, 0x9f, 0x15, 0x02, 0x41, 0x00, 0x97,
0x0b, 0x3d, 0xc9, 0xb8, 0x27, 0x23, 0x8a, 0xed, 0xe7, 0x54, 0x7d, 0xd7,
0x49, 0x2e, 0x60, 0x33, 0xcd, 0x57, 0xf6, 0x58, 0xa0, 0x83, 0x59, 0x7d,
0x78, 0xed, 0x30, 0xd7, 0x9d, 0x9f, 0x3e, 0x7e, 0x25, 0x5f, 0x1e, 0xc6,
0x67, 0x56, 0x16, 0x05, 0x9a, 0xfa, 0x19, 0xc5, 0xfa, 0x4d, 0x5e, 0xe0,
0xad, 0x45, 0xb2, 0x67, 0x9f, 0x20, 0xbf, 0x11, 0x31, 0xb4, 0x7c, 0x3e,
0x3b, 0x96, 0xa1, 0x02, 0x41, 0x00, 0x94, 0x82, 0x10, 0x66, 0xfe, 0xed,
0x68, 0x3b, 0x7f, 0xfb, 0x50, 0x3d, 0x35, 0xa0, 0x34, 0x0b, 0xc7, 0xbf,
0x5c, 0x7e, 0x01, 0x59, 0x77, 0xbb, 0xb2, 0xdf, 0x21, 0xbf, 0x1f, 0x67,
0x82, 0xd5, 0xca, 0x81, 0x8c, 0x99, 0xbf, 0x0c, 0x0f, 0xe6, 0x86, 0xd7,
0x32, 0x25, 0xa0, 0x63, 0x31, 0xa3, 0x2f, 0xd0, 0x89, 0x12, 0x2f, 0x2b,
0x95, 0x82, 0x28, 0xe3, 0x70, 0x3e, 0x7f, 0x04, 0xaa, 0x99,
};
std::vector<uint8_t> AsVector(const uint8_t* data, size_t length) {
return std::vector<uint8_t>(data, data + length);
}
// Since we are going to return the same key for encryption and signing, create
// a common function for them to both call.
WhiteboxKey GetKey() {
WhiteboxKey key;
key.private_key = AsVector(kDevicePrivateKey, sizeof(kDevicePrivateKey));
key.public_key = AsVector(kDevicePublicKey, sizeof(kDevicePublicKey));
return key;
}
} // namespace
WhiteboxKey GetEncryptionKey() {
return GetKey();
WhiteboxKey key;
key.private_key =
AsVector(kEncryptionPrivateKey, sizeof(kEncryptionPrivateKey));
key.public_key = AsVector(kEncryptionPublicKey, sizeof(kEncryptionPublicKey));
return key;
}
WhiteboxKey GetSigningKey() {
return GetKey();
WhiteboxKey key;
key.private_key = AsVector(kSigningPrivateKey, sizeof(kSigningPrivateKey));
key.public_key = AsVector(kSigningPublicKey, sizeof(kSigningPublicKey));
return key;
}
} // namespace widevine

View File

@@ -68,10 +68,10 @@ void PrettyPrint(const std::string& title,
LOG(INFO) << title;
LOG(INFO) << " Sample Size: " << samples.SampleSize() << " ("
<< per_sample_size << " bytes)";
LOG(INFO) << " Min (0%): " << percentiles.Get(0).count() << " us";
LOG(INFO) << " Min (1%): " << percentiles.Get(1).count() << " us";
LOG(INFO) << " 25%: " << percentiles.Get(25).count() << " us";
LOG(INFO) << " Median (50%): " << percentiles.Get(50).count() << " us";
LOG(INFO) << " 75%: " << percentiles.Get(75).count() << " us";
LOG(INFO) << " 75%: " << percentiles.Get(75).count() << " us";
LOG(INFO) << " Max (100%): " << percentiles.Get(100).count() << " us";
}

View File

@@ -5,7 +5,7 @@
cc_library(
name = "license_protocol_proto",
hdrs = ["license_protocol.pb.h"],
strip_include_prefix = "//chromium_deps",
strip_include_prefix = "//chromium_deps/cdm/protos",
visibility = ["//visibility:public"],
deps = [
"//chromium_deps/cdm/protos/defs:license_protocol_proto",

View File

@@ -14,6 +14,8 @@ namespace {
constexpr size_t kAesBlockSize = 16;
} // namespace
AesCbcDecryptor::~AesCbcDecryptor() {}
bool AesCbcDecryptor::SetKey(const uint8_t* key, size_t key_size) {
DCHECK(key);

View File

@@ -12,6 +12,8 @@ namespace widevine {
class AesCbcDecryptor {
public:
virtual ~AesCbcDecryptor();
// Prepares the encryptor with the key.
virtual bool SetKey(const uint8_t* key, size_t key_size);

View File

@@ -14,6 +14,8 @@ namespace {
constexpr size_t kAesBlockSize = 16;
} // namespace
AesCbcEncryptor::~AesCbcEncryptor() {}
bool AesCbcEncryptor::SetKey(const uint8_t* key, size_t key_size) {
DCHECK(key);

View File

@@ -12,6 +12,8 @@ namespace widevine {
class AesCbcEncryptor {
public:
virtual ~AesCbcEncryptor();
// Prepares the encryptor with the key.
virtual bool SetKey(const uint8_t* key, size_t key_size);

View File

@@ -26,6 +26,8 @@ bool Increment64(uint8_t* counter) {
} // namespace
AesCtrEncryptor::~AesCtrEncryptor() {}
bool AesCtrEncryptor::SetKey(const uint8_t* key, size_t key_size) {
DCHECK(key);

View File

@@ -12,6 +12,8 @@ namespace widevine {
class AesCtrEncryptor {
public:
virtual ~AesCtrEncryptor();
// Prepares the encryptor with the key.
virtual bool SetKey(const uint8_t* key, size_t key_size);

View File

@@ -8,7 +8,7 @@
#include <string>
#include "api/license_whitebox.h"
#include "cdm/protos/license_protocol.pb.h"
#include "license_protocol.pb.h"
namespace widevine {
@@ -40,4 +40,4 @@ ContentKey CreateContentKey(
} // namespace widevine
#endif // WHITEBOX_REFERENCE_IMPL_CONTENT_KEY_H_
#endif // WHITEBOX_REFERENCE_IMPL_CONTENT_KEY_H_

View File

@@ -5,7 +5,7 @@
#include <map>
#include <string>
#include "cdm/protos/license_protocol.pb.h"
#include "license_protocol.pb.h"
#include "reference/impl/content_key.h"
#include "reference/impl/odk.h"
#include "reference/impl/renewal_key.h"

View File

@@ -12,11 +12,11 @@
#include "base/check.h"
#include "base/check_op.h"
#include "base/logging.h"
#include "cdm/protos/license_protocol.pb.h"
#include "crypto_utils/aes_cbc_decryptor.h"
#include "crypto_utils/aes_ctr_encryptor.h"
#include "crypto_utils/crypto_util.h"
#include "crypto_utils/rsa_key.h"
#include "license_protocol.pb.h"
#include "oemcrypto/odk/include/odk.h"
#include "oemcrypto/odk/include/odk_message.h"
#include "oemcrypto/odk/include/odk_structs.h"
@@ -81,6 +81,16 @@ uint8_t InverseMaskingFunction1(uint8_t input) {
return mapping[input];
}
bool CheckAndUpdateSize(size_t min_size, size_t* out_size) {
const bool good = *out_size >= min_size;
if (!good) {
DVLOG(1) << "Buffer too small: needs " << min_size << ", but was "
<< *out_size << ".";
}
*out_size = min_size;
return good;
}
} // namespace
// The white-box type can't be in the namespace as it is declared in the header.
@@ -148,7 +158,7 @@ WB_Result DecryptBuffer(WB_CipherMode mode,
size_t iv_size,
uint8_t* output_data,
size_t* output_data_size) {
if (!input_data || !iv || !output_data || !output_data_size) {
if (!input_data || !iv || !output_data_size) {
DVLOG(1) << "Invalid parameter: null pointer.";
return WB_RESULT_INVALID_PARAMETER;
}
@@ -158,6 +168,16 @@ WB_Result DecryptBuffer(WB_CipherMode mode,
return WB_RESULT_INVALID_PARAMETER;
}
// There is no padding, so the output will be the same length as the input.
if (!CheckAndUpdateSize(input_data_size, output_data_size)) {
return WB_RESULT_BUFFER_TOO_SMALL;
}
if (!output_data) {
DVLOG(1) << "Invalid parameter: null pointer.";
return WB_RESULT_INVALID_PARAMETER;
}
// Data must be "block aligned" for CBC. CTR does not have this requirement.
if (mode == WB_CIPHER_MODE_CBC && input_data_size % AES_BLOCK_SIZE != 0) {
DVLOG(1) << "Invalid parameter: bad block size.";
@@ -171,14 +191,6 @@ WB_Result DecryptBuffer(WB_CipherMode mode,
return WB_RESULT_INVALID_PARAMETER;
}
// There is no padding, so the output will be the same length as the input.
if (*output_data_size < input_data_size) {
DVLOG(1) << "Buffer too small: needs " << input_data_size << " but got "
<< *output_data_size << ".";
*output_data_size = input_data_size;
return WB_RESULT_BUFFER_TOO_SMALL;
}
// If we passed a key to this function, it should be the correct size. If it
// wasn't, we should not have saved the content key.
CHECK(key) << "Missing key data";
@@ -191,15 +203,13 @@ WB_Result DecryptBuffer(WB_CipherMode mode,
AesCbcDecryptor decryptor;
CHECK(decryptor.SetKey(key, key_size));
*output_data_size = input_data_size;
CHECK(decryptor.Decrypt(iv, iv_size, input_data, input_data_size,
output_data));
} else if (mode == WB_CIPHER_MODE_CTR) {
AesCtrDecryptor decryptor;
CHECK(decryptor.SetKey(key, key_size));
// Encrypt and Decrypt for CBC use the same interface.
*output_data_size = input_data_size;
// Encrypt and Decrypt for CTR use the same interface.
CHECK(decryptor.Encrypt(iv, iv_size, input_data, input_data_size,
output_data));
} else {
@@ -249,15 +259,26 @@ WB_Result WB_License_SignLicenseRequest(const WB_License_Whitebox* whitebox,
size_t license_request_size,
uint8_t* signature,
size_t* signature_size) {
if (!whitebox || !license_request || !signature || !signature_size) {
if (!whitebox || !signature_size) {
DVLOG(1) << "Invalid parameter: null pointer.";
return WB_RESULT_INVALID_PARAMETER;
}
const size_t real_sign_size = whitebox->signing_key->KeySize();
if (!CheckAndUpdateSize(real_sign_size, signature_size)) {
return WB_RESULT_BUFFER_TOO_SMALL;
}
// Only check after checking for short buffer so callers can query the size
// without a buffer.
if (license_request_size == 0) {
DVLOG(1) << "Invalid parameter: array size 0.";
return WB_RESULT_INVALID_PARAMETER;
}
if (!license_request || !signature) {
DVLOG(1) << "Invalid parameter: null pointer.";
return WB_RESULT_INVALID_PARAMETER;
}
std::string result;
@@ -267,14 +288,8 @@ WB_Result WB_License_SignLicenseRequest(const WB_License_Whitebox* whitebox,
std::string(license_request, license_request + license_request_size),
&result));
if (!widevine::MemCopy(result.data(), result.size(), signature,
*signature_size)) {
DVLOG(1) << "Buffer too small: signature needs " << result.size() << ".";
*signature_size = result.size();
return WB_RESULT_BUFFER_TOO_SMALL;
}
*signature_size = result.size();
CHECK(widevine::MemCopy(result.data(), result.size(), signature,
*signature_size));
return WB_RESULT_OK;
}
@@ -501,7 +516,16 @@ WB_Result WB_License_SignRenewalRequest(const WB_License_Whitebox* whitebox,
size_t message_size,
uint8_t* signature,
size_t* signature_size) {
if (!whitebox || !message || !signature || !signature_size) {
if (!whitebox || !message || !signature_size) {
DVLOG(1) << "Invalid parameter: null pointer.";
return WB_RESULT_INVALID_PARAMETER;
}
if (!CheckAndUpdateSize(SHA256_DIGEST_LENGTH, signature_size)) {
return WB_RESULT_BUFFER_TOO_SMALL;
}
if (!signature) {
DVLOG(1) << "Invalid parameter: null pointer.";
return WB_RESULT_INVALID_PARAMETER;
}
@@ -532,15 +556,8 @@ WB_Result WB_License_SignRenewalRequest(const WB_License_Whitebox* whitebox,
whitebox->renewal_key->client.end()),
std::string(message, message + message_size));
if (!widevine::MemCopy(computed_signature.data(), computed_signature.size(),
signature, *signature_size)) {
DVLOG(1) << "Buffer too small: signature needs "
<< computed_signature.size() << ".";
*signature_size = computed_signature.size();
return WB_RESULT_BUFFER_TOO_SMALL;
}
*signature_size = computed_signature.size();
CHECK(widevine::MemCopy(computed_signature.data(), computed_signature.size(),
signature, *signature_size));
return WB_RESULT_OK;
}
@@ -600,7 +617,7 @@ WB_Result WB_License_GetSecretString(const WB_License_Whitebox* whitebox,
size_t key_id_size,
uint8_t* secret_string,
size_t* secret_string_size) {
if (!whitebox || !key_id || !secret_string || !secret_string_size) {
if (!whitebox || !key_id || !secret_string_size) {
DVLOG(1) << "Invalid parameter: null pointer.";
return WB_RESULT_INVALID_PARAMETER;
}
@@ -615,6 +632,16 @@ WB_Result WB_License_GetSecretString(const WB_License_Whitebox* whitebox,
return WB_RESULT_INVALID_PARAMETER;
}
const auto secret_pattern = GetSecretStringFor(mode);
if (!CheckAndUpdateSize(secret_pattern.size(), secret_string_size)) {
return WB_RESULT_BUFFER_TOO_SMALL;
}
if (!secret_string) {
DVLOG(1) << "Invalid parameter: null pointer.";
return WB_RESULT_INVALID_PARAMETER;
}
if (key_id_size == 0) {
DVLOG(1) << "Invalid parameter: array size 0.";
return WB_RESULT_INVALID_PARAMETER;
@@ -640,15 +667,8 @@ WB_Result WB_License_GetSecretString(const WB_License_Whitebox* whitebox,
return WB_RESULT_INSUFFICIENT_SECURITY_LEVEL;
}
const auto secret_pattern = GetSecretStringFor(mode);
if (!widevine::MemCopy(secret_pattern.data(), secret_pattern.size(),
secret_string, *secret_string_size)) {
DVLOG(1) << "Buffer too small: needs " << secret_pattern.size() << ".";
*secret_string_size = secret_pattern.size();
return WB_RESULT_BUFFER_TOO_SMALL;
}
*secret_string_size = secret_pattern.size();
CHECK(widevine::MemCopy(secret_pattern.data(), secret_pattern.size(),
secret_string, *secret_string_size));
return WB_RESULT_OK;
}

View File

@@ -28,22 +28,22 @@ WB_Result GetODKContext(const std::string& combined_message,
ODK_Message_Create(mutable_message.data(), mutable_message.size());
ODK_Message_SetSize(&msg, core_message_size);
const ODK_MessageStatus message_status = ODK_Message_GetStatus(&msg);
if (message_status != MESSAGE_STATUS_OK) {
DVLOG(1) << "Invalid core message status: " << message_status;
return WB_RESULT_INVALID_SIGNATURE;
}
ODK_LicenseResponse license_response{{{0, 0, {}}}, NULL, {0}};
license_response.parsed_license = &(context->license);
Unpack_ODK_LicenseResponse(&msg, &license_response);
const ODK_MessageStatus message_status = ODK_Message_GetStatus(&msg);
if (message_status != MESSAGE_STATUS_OK) {
DVLOG(1) << "Invalid core message status: 0x" << std::hex << message_status;
return WB_RESULT_INVALID_PARAMETER;
}
const auto& core_message = license_response.request.core_message;
if (core_message.message_type != ODK_License_Response_Type) {
DVLOG(1) << "Failed core message type: " << core_message.message_type;
return WB_RESULT_INVALID_SIGNATURE;
return WB_RESULT_INVALID_PARAMETER;
}
context->major_version = core_message.nonce_values.api_major_version;

View File

@@ -3,7 +3,7 @@
#ifndef WHITEBOX_REFERENCE_IMPL_PROTOBUF_LICENSE_PARSER_H_
#define WHITEBOX_REFERENCE_IMPL_PROTOBUF_LICENSE_PARSER_H_
#include "cdm/protos/license_protocol.pb.h"
#include "license_protocol.pb.h"
#include "reference/impl/content_key.h"
#include "reference/impl/license_parser.h"