java.lang.Object
org.glassfish.grizzly.websockets.SecKey

public class SecKey extends Object
Class represents WebSocket's security key, used during the handshake phase.
Author:
Alexey Stashok
  • Field Details

  • Constructor Details

    • SecKey

      public SecKey()
    • SecKey

      public SecKey(String base64)
  • Method Details

    • generateServerKey

      public static SecKey generateServerKey(SecKey clientKey) throws HandshakeException
      Generate server-side security key, which gets passed to the client during the handshake phase as part of message payload.
      Parameters:
      clientKey - client's Sec-WebSocket-Key
      Returns:
      server key.
      Throws:
      HandshakeException
    • getSecKey

      public String getSecKey()
      Gets security key string representation, which includes chars and spaces.
      Returns:
      Security key string representation, which includes chars and spaces.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getBytes

      public byte[] getBytes()
    • validateServerKey

      public void validateServerKey(String serverKey)