/* * Copyright 2018 The gRPC Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.grpc.alts.internal; import io.netty.buffer.ByteBuf; import java.security.GeneralSecurityException; import java.util.List; /** * A @{code ChannelCrypterNetty} performs stateful encryption and decryption of independent input * and output streams. Both decrypt and encrypt gather their input from a list of Netty @{link * ByteBuf} instances. * *
Note that we provide implementations of this interface that provide integrity only and
* implementations that provide privacy and integrity. All methods should be thread-compatible.
*/
public interface ChannelCrypterNetty {
/**
* Encrypt plaintext into output buffer.
*
* @param out the protected input will be written into this buffer. The buffer must be direct and
* have enough space to hold all input buffers and the tag. Encrypt does not take ownership of
* this buffer.
* @param plain the input buffers that should be protected. Encrypt does not modify or take
* ownership of these buffers.
*/
void encrypt(ByteBuf out, List