Class AltsTsiFrameProtector
java.lang.Object
io.grpc.alts.internal.AltsTsiFrameProtector
- All Implemented Interfaces:
TsiFrameProtector
Frame protector that uses the ALTS framing.
-
Nested Class Summary
Nested classes/interfaces inherited from interface TsiFrameProtector
TsiFrameProtector.Consumer<T> -
Constructor Summary
ConstructorsConstructorDescriptionAltsTsiFrameProtector(int maxProtectedFrameBytes, ChannelCrypterNetty crypter, io.netty.buffer.ByteBufAllocator alloc) Create a new AltsTsiFrameProtector. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Must be called to release all associated resources (instance cannot be used afterwards).static intstatic intstatic intvoidprotectFlush(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.voidUnprotects the buffers by removing the framing and decrypting/checking MACs.
-
Constructor Details
-
AltsTsiFrameProtector
public AltsTsiFrameProtector(int maxProtectedFrameBytes, ChannelCrypterNetty crypter, io.netty.buffer.ByteBufAllocator alloc) Create a new AltsTsiFrameProtector.
-
-
Method Details
-
getHeaderBytes
public static int getHeaderBytes() -
getMinFrameSize
public static int getMinFrameSize() -
getMaxFrameSize
public static int getMaxFrameSize() -
protectFlush
public void protectFlush(List<io.netty.buffer.ByteBuf> unprotectedBufs, TsiFrameProtector.Consumer<io.netty.buffer.ByteBuf> ctxWrite, io.netty.buffer.ByteBufAllocator alloc) throws GeneralSecurityException Description copied from interface:TsiFrameProtectorProtects the buffers by performing framing and encrypting/appending MACs.- Specified by:
protectFlushin interfaceTsiFrameProtector- 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
public void unprotect(io.netty.buffer.ByteBuf in, List<Object> out, io.netty.buffer.ByteBufAllocator alloc) throws GeneralSecurityException Description copied from interface:TsiFrameProtectorUnprotects the buffers by removing the framing and decrypting/checking MACs.- Specified by:
unprotectin interfaceTsiFrameProtector- 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
public void destroy()Description copied from interface:TsiFrameProtectorMust be called to release all associated resources (instance cannot be used afterwards).- Specified by:
destroyin interfaceTsiFrameProtector
-