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