public async Task <byte[]> Unwrap(KeyVaultAlgorithm algorithm, byte[] wrappedKey) { if (!algorithm.CanCryptOrWrap()) { throw new InvalidOperationException("Cannot unwrap with this algorithm type."); } return((await Client.UnwrapKeyAsync(Identifier.Identifier, algorithm.GetConfigurationString(), wrappedKey)).Result); }
public async Task <byte[]> Encrypt(KeyVaultAlgorithm algorithm, byte[] plainText) { if (!algorithm.CanCryptOrWrap()) { throw new InvalidOperationException("Cannot encrypt with this algorithm type."); } return((await Client.EncryptAsync(Identifier.Identifier, algorithm.GetConfigurationString(), plainText)).Result); }