/// <summary> /// /// </summary> /// <param name="algorithm"></param> /// <param name="encryptedKey"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public virtual Response <UnwrapResult> UnwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, CancellationToken cancellationToken = default) { var parameters = new KeyWrapParameters() { Algorithm = algorithm.GetName(), Key = encryptedKey }; return(SendRequest(UnwrapOperation, parameters, () => new UnwrapResult() { Algorithm = algorithm }, cancellationToken)); }
/// <summary> /// /// </summary> /// <param name="algorithm"></param> /// <param name="encryptedKey"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public virtual async Task <Response <UnwrapResult> > UnwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, CancellationToken cancellationToken = default) { var parameters = new KeyWrapParameters() { Algorithm = algorithm.GetName(), Key = encryptedKey }; return(await SendRequestAsync(UnwrapOperation, parameters, () => new UnwrapResult() { Algorithm = algorithm }, cancellationToken).ConfigureAwait(false)); }
public async Task <Response <UnwrapResult> > UnwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, CancellationToken cancellationToken = default) { var parameters = new KeyWrapParameters() { Algorithm = algorithm.GetName(), Key = encryptedKey }; using DiagnosticScope scope = Pipeline.CreateScope("Azure.Security.KeyVault.Keys.Cryptography.RemoteCryptographyClient.UnwrapKey"); scope.AddAttribute("key", _keyId); scope.Start(); try { return(await Pipeline.SendRequestAsync(RequestMethod.Post, parameters, () => new UnwrapResult { Algorithm = algorithm }, cancellationToken, "/unwrapKey").ConfigureAwait(false)); } catch (Exception e) { scope.Failed(e); throw; } }
public Response <WrapResult> WrapKey(KeyWrapAlgorithm algorithm, byte[] key, CancellationToken cancellationToken = default) { var parameters = new KeyWrapParameters() { Algorithm = algorithm.GetName(), Key = key }; using DiagnosticScope scope = Pipeline.CreateScope("Azure.Security.KeyVault.Keys.Cryptography.RemoteCryptographyClient.WrapKey"); scope.AddAttribute("key", _keyId); scope.Start(); try { return(Pipeline.SendRequest(RequestMethod.Post, parameters, () => new WrapResult { Algorithm = algorithm }, cancellationToken, "/wrapKey")); } catch (Exception e) { scope.Failed(e); throw; } }