public async Task <byte[]> EncryptAsync( byte[] plaintext, IEnumerable <KeyValuePair <string, string> >?aad = null) { var request = new EncryptRequest(keyId, plaintext, GetEncryptionContext(aad)); var result = await client.EncryptAsync(request).ConfigureAwait(false); return(result.CiphertextBlob); }
public async Task <byte[]> EncryptAsync(byte[] data, IDictionary <string, string> context = null) { #region Preconditions if (data == null) { throw new ArgumentNullException(nameof(data)); } if (data.Length > 1024 * 4) { throw new ArgumentException("Must be less than 4KB", nameof(data)); } #endregion var request = new EncryptRequest(keyId, data, context != null ? new JsonObject(context) : null); var result = await client.EncryptAsync(request).ConfigureAwait(false); return(result.CiphertextBlob); }
public async Task <byte[]> EncryptAsync( byte[] plaintext, IEnumerable <KeyValuePair <string, string> > aad = null) { #region Preconditions if (plaintext == null) { throw new ArgumentNullException(nameof(plaintext)); } if (plaintext.Length > 1024 * 4) { throw new ArgumentException("Must be less than 4KB", nameof(plaintext)); } #endregion var request = new EncryptRequest(keyId, plaintext, GetEncryptionContext(aad)); var result = await client.EncryptAsync(request).ConfigureAwait(false); return(result.CiphertextBlob); }
public Task <EncryptResponse> EncryptAsync(EncryptRequest request) { return(SendAsync <EncryptResponse>("Encrypt", request)); }
public Task <EncryptResponse> EncryptAsync(EncryptRequest request) => SendAsync <EncryptResponse>("Encrypt", request);