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 Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A mirror of java.util.function.Consumer without the Java 8 dependency.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    unprotect(io.netty.buffer.ByteBuf in, List<Object> out, io.netty.buffer.ByteBufAllocator alloc)
    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 protected
      ctxWrite - is called with buffers containing protected frames and must release the given buffers
      alloc - 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 frames
      out - is only used to append unprotected payload buffers
      alloc - 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).