Class InsecureQuicTokenHandler

  • All Implemented Interfaces:
    QuicTokenHandler

    public final class InsecureQuicTokenHandler
    extends java.lang.Object
    implements QuicTokenHandler
    Insecure QuicTokenHandler which only does basic token generation / validation without any crypto. This shouldn't be used in production.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int maxTokenLength()
      Return the maximal token length.
      int validateToken​(ByteBuf token, java.net.InetSocketAddress address)
      Validate the token and return the offset, -1 is returned if the token is not valid.
      boolean writeToken​(ByteBuf out, ByteBuf dcid, java.net.InetSocketAddress address)
      Generate a new token for the given destination connection id and address.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • writeToken

        public boolean writeToken​(ByteBuf out,
                                  ByteBuf dcid,
                                  java.net.InetSocketAddress address)
        Description copied from interface: QuicTokenHandler
        Generate a new token for the given destination connection id and address. This token is written to out. If no token should be generated and so no token validation should take place at all this method should return false.
        Specified by:
        writeToken in interface QuicTokenHandler
        Parameters:
        out - ByteBuf into which the token will be written.
        dcid - the destination connection id. The ByteBuf.readableBytes() will be at most Quic.MAX_CONN_ID_LEN.
        address - the InetSocketAddress of the sender.
        Returns:
        true if a token was written and so validation should happen, false otherwise.
      • validateToken

        public int validateToken​(ByteBuf token,
                                 java.net.InetSocketAddress address)
        Description copied from interface: QuicTokenHandler
        Validate the token and return the offset, -1 is returned if the token is not valid.
        Specified by:
        validateToken in interface QuicTokenHandler
        Parameters:
        token - the ByteBuf that contains the token. The ownership is not transferred.
        address - the InetSocketAddress of the sender.
        Returns:
        the start index after the token or -1 if the token was not valid.
      • maxTokenLength

        public int maxTokenLength()
        Description copied from interface: QuicTokenHandler
        Return the maximal token length.
        Specified by:
        maxTokenLength in interface QuicTokenHandler
        Returns:
        the maximal supported token length.