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  TsiFrameProtector.Consumer<T>
      A mirror of java.util.function.Consumer without the Java 8 dependency.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void destroy()
      Must be called to release all associated resources (instance cannot be used afterwards).
      void protectFlush​(java.util.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, java.util.List<java.lang.Object> out, io.netty.buffer.ByteBufAllocator alloc)
      Unprotects the buffers by removing the framing and decrypting/checking MACs.
    • Method Detail

      • protectFlush

        void protectFlush​(java.util.List<io.netty.buffer.ByteBuf> unprotectedBufs,
                          TsiFrameProtector.Consumer<io.netty.buffer.ByteBuf> ctxWrite,
                          io.netty.buffer.ByteBufAllocator alloc)
                   throws java.security.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:
        java.security.GeneralSecurityException
      • unprotect

        void unprotect​(io.netty.buffer.ByteBuf in,
                       java.util.List<java.lang.Object> out,
                       io.netty.buffer.ByteBufAllocator alloc)
                throws java.security.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:
        java.security.GeneralSecurityException
      • destroy

        void destroy()
        Must be called to release all associated resources (instance cannot be used afterwards).