Package io.grpc.alts.internal
Interface TsiFrameProtector
- All Known Implementing Classes:
AltsTsiFrameProtector
public interface TsiFrameProtector
This object protects and unprotects netty buffers once the handshake is done.
Implementations of this object must be thread compatible.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A mirror of java.util.function.Consumer without the Java 8 dependency. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Must be called to release all associated resources (instance cannot be used afterwards).void
protectFlush
(List<io.netty.buffer.ByteBuf> unprotectedBufs, TsiFrameProtector.Consumer<io.netty.buffer.ByteBuf> ctxWrite, io.netty.buffer.ByteBufAllocator alloc) Protects the buffers by performing framing and encrypting/appending MACs.void
Unprotects the buffers by removing the framing and decrypting/checking MACs.
-
Method Details
-
protectFlush
void protectFlush(List<io.netty.buffer.ByteBuf> unprotectedBufs, TsiFrameProtector.Consumer<io.netty.buffer.ByteBuf> ctxWrite, io.netty.buffer.ByteBufAllocator alloc) throws GeneralSecurityException Protects the buffers by performing framing and encrypting/appending MACs.- Parameters:
unprotectedBufs
- contain the payload that will be protectedctxWrite
- is called with buffers containing protected frames and must release the given buffersalloc
- is used to allocate new buffers for the protected frames- Throws:
GeneralSecurityException
-
unprotect
void unprotect(io.netty.buffer.ByteBuf in, List<Object> out, io.netty.buffer.ByteBufAllocator alloc) throws GeneralSecurityException Unprotects the buffers by removing the framing and decrypting/checking MACs.- Parameters:
in
- contains (partial) protected framesout
- is only used to append unprotected payload buffersalloc
- is used to allocate new buffers for the unprotected frames- Throws:
GeneralSecurityException
-
destroy
void destroy()Must be called to release all associated resources (instance cannot be used afterwards).
-