def test_new_key_data(self):
        # AES GCM HKDF
        key_template = streaming_aead.streaming_aead_key_templates.AES128_GCM_HKDF_4KB
        key_data = self.key_manager_gcm.new_key_data(key_template)
        self.assertEqual(key_data.type_url, self.key_manager_gcm.key_type())
        self.assertEqual(key_data.key_material_type,
                         tink_pb2.KeyData.SYMMETRIC)
        key = aes_gcm_hkdf_streaming_pb2.AesGcmHkdfStreamingKey()
        key.ParseFromString(key_data.value)
        self.assertEqual(key.version, 0)
        self.assertLen(key.key_value, 16)
        self.assertEqual(key.params.hkdf_hash_type, common_pb2.HashType.SHA256)
        self.assertEqual(key.params.derived_key_size, 16)
        self.assertEqual(key.params.ciphertext_segment_size, 4096)

        # AES CTR HMAC
        key_template = streaming_aead.streaming_aead_key_templates.AES128_CTR_HMAC_SHA256_4KB
        key_data = self.key_manager_ctr.new_key_data(key_template)
        self.assertEqual(key_data.type_url, self.key_manager_ctr.key_type())
        self.assertEqual(key_data.key_material_type,
                         tink_pb2.KeyData.SYMMETRIC)
        key = aes_ctr_hmac_streaming_pb2.AesCtrHmacStreamingKey()
        key.ParseFromString(key_data.value)
        self.assertEqual(key.version, 0)
        self.assertLen(key.key_value, 16)
        self.assertEqual(key.params.hkdf_hash_type, common_pb2.HashType.SHA256)
        self.assertEqual(key.params.derived_key_size, 16)
        self.assertEqual(key.params.hmac_params.hash,
                         common_pb2.HashType.SHA256)
        self.assertEqual(key.params.hmac_params.tag_size, 32)
        self.assertEqual(key.params.ciphertext_segment_size, 4096)
 def test_new_aes_gcm_hkdf_key_data(self):
   key_template = (
       streaming_aead.streaming_aead_key_templates.AES128_GCM_HKDF_4KB)
   key_data = core.Registry.new_key_data(key_template)
   self.assertEqual(key_data.type_url, key_template.type_url)
   self.assertEqual(key_data.key_material_type, tink_pb2.KeyData.SYMMETRIC)
   key = aes_gcm_hkdf_streaming_pb2.AesGcmHkdfStreamingKey()
   key.ParseFromString(key_data.value)
   self.assertEqual(key.version, 0)
   self.assertLen(key.key_value, 16)
   self.assertEqual(key.params.hkdf_hash_type, common_pb2.HashType.SHA256)
   self.assertEqual(key.params.derived_key_size, 16)
   self.assertEqual(key.params.ciphertext_segment_size, 4096)