(1) Change wv_cas_ecm to allow 16 bytes of content_iv
(2) Remove "wrapping_iv" parameters from wv_cas_ecm (3) Internally derive "wrapping_iv"s and "key_id"s (4) Add an example binary for demo the usage of wv_cas_ecm ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=218209010
This commit is contained in:
@@ -198,6 +198,21 @@ TEST(CryptoUtilTest, DeriveIv) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(CryptoUtilTest, DeriveKeyId) {
|
||||
// First value in the pair is the context, second value is the expected id.
|
||||
std::pair<std::string, std::string> context_id_pairs[] = {
|
||||
{"1234567890123456", "a3c4a8c0d0e24e96f38f492254186a9d"},
|
||||
{"0987654321098765", "084fc6bece9688ccce6b1672d9b47e22"}};
|
||||
for (const auto& context_id_pair : context_id_pairs) {
|
||||
SCOPED_TRACE(absl::StrCat("test case:", context_id_pair.first));
|
||||
EXPECT_EQ(context_id_pair.second,
|
||||
absl::BytesToHexString(DeriveKeyId(context_id_pair.first)));
|
||||
// Repeat same call to verify derivied result is repeatable.
|
||||
EXPECT_EQ(context_id_pair.second,
|
||||
absl::BytesToHexString(DeriveKeyId(context_id_pair.first)));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(CryptoUtilTest, Verify4CCEncryptionIDFromBadString) {
|
||||
uint32_t cc_code;
|
||||
ASSERT_FALSE(FourCCEncryptionSchemeIDFromString("garbage", &cc_code));
|
||||
|
||||
Reference in New Issue
Block a user