private async Task <(byte[] CipherKey, byte[] MacKey)> ExpandKeysAsync(CancellationToken cancellationToken) { var key = await _keyProvider.GetKeyAsync(cancellationToken); var hkdf = new Hkdf(HashAlgorithmName.SHA256); var cipherKey = hkdf.Expand(key, KeyContext.Cipher, 32); var macKey = hkdf.Expand(key, KeyContext.Mac, 32); return(cipherKey, macKey); }
private async Task <(byte[] CipherKey, byte[] MacKey)> ExpandKeysAsync(CancellationToken cancellationToken) { var key = await _keyProvider.GetKeyAsync(cancellationToken); using (var hkdf = new Hkdf <HMACSHA256>()) { var cipherKey = hkdf.Expand(key, KeyContext.Cipher, 32); var macKey = hkdf.Expand(key, KeyContext.Mac, 32); return(cipherKey, macKey); } }