default ByteBuf encrypt(ByteBuf toEncrypt, T key) throws GeneralSecurityException {
    return Utils.applyByteBufferFunctionToByteBuf(toEncrypt, buffer -> encrypt(buffer, key));
  }
Encrypts the {@code toEncrypt} with the given key. The {@code toEncrypt} is a netty {@link ByteBuf}. This is used
for encrypting data chunks.
@param toEncrypt {@link ByteBuf} that needs to be encrypted
@param key the secret key (of type T) to use to encrypt
@return the {@link ByteBuf} containing the encrypted content. Ensure the result has all
the information lik the IV along with the encrypted content, in order to decrypt the content with a given key
@throws {@link GeneralSecurityException} on any exception with encryption
ambry-api/src/main/java/com/github/ambry/router/CryptoService.java