def test_owns_data_key_not_owned_asymmetric_checking_symmetric(self): self.mock_wrapping_key.wrapping_algorithm = WrappingAlgorithm.RSA_OAEP_SHA1_MGF1 test_master_key = RawMasterKey( key_id=VALUES['wrapped_keys']['raw']['key_info'], provider_id=VALUES['provider_id'], wrapping_key=self.mock_wrapping_key) assert not test_master_key.owns_data_key( data_key=DataKey(key_provider=MasterKeyInfo( provider_id=VALUES['provider_id'], key_info=VALUES['wrapped_keys']['serialized']['key_info']), encrypted_data_key=VALUES['encrypted_data_key'], data_key=VALUES['data_key']))
def test_owns_data_key_owned_symmetric(self, mock_prefix): self.mock_wrapping_key.wrapping_algorithm = WrappingAlgorithm.AES_256_GCM_IV12_TAG16_NO_PADDING test_master_key = RawMasterKey( key_id=VALUES['wrapped_keys']['raw']['key_info'], provider_id=VALUES['provider_id'], wrapping_key=self.mock_wrapping_key) assert test_master_key.owns_data_key( data_key=DataKey(key_provider=MasterKeyInfo( provider_id=VALUES['provider_id'], key_info=VALUES['wrapped_keys']['serialized']['key_info']), encrypted_data_key=VALUES['encrypted_data_key'], data_key=VALUES['data_key']))
def test_owns_data_key_not_owned_asymmetric_checking_symmetric(self): self.mock_wrapping_key.wrapping_algorithm = WrappingAlgorithm.RSA_OAEP_SHA1_MGF1 test_master_key = RawMasterKey( key_id=VALUES["wrapped_keys"]["raw"]["key_info"], provider_id=VALUES["provider_id"], wrapping_key=self.mock_wrapping_key, ) assert not test_master_key.owns_data_key(data_key=DataKey( key_provider=MasterKeyInfo(provider_id=VALUES["provider_id"], key_info=VALUES["wrapped_keys"] ["serialized"]["key_info"]), encrypted_data_key=VALUES["encrypted_data_key"], data_key=VALUES["data_key"], ))
def test_owns_data_key_owned_symmetric(self, mock_prefix): self.mock_wrapping_key.wrapping_algorithm = WrappingAlgorithm.AES_256_GCM_IV12_TAG16_NO_PADDING test_master_key = RawMasterKey( key_id=VALUES["wrapped_keys"]["raw"]["key_info"], provider_id=VALUES["provider_id"], wrapping_key=self.mock_wrapping_key, ) assert test_master_key.owns_data_key(data_key=DataKey( key_provider=MasterKeyInfo(provider_id=VALUES["provider_id"], key_info=VALUES["wrapped_keys"] ["serialized"]["key_info"]), encrypted_data_key=VALUES["encrypted_data_key"], data_key=VALUES["data_key"], ))