Top Description Fields Constructors Methods
org.glassfish.grizzly.websockets

public Class SecKey

extends Object
Class Inheritance
Imports
java.security.MessageDigest, .NoSuchAlgorithmException, .SecureRandom, java.util.Base64, .Random, org.glassfish.grizzly.utils.Charsets

Class represents WebSocket's security key, used during the handshake phase.
Author
Alexey Stashok

Field Summary

Modifier and TypeField and Description
private byte[]
public static final int
private static final Random
private final String
secKey

Security key string representation, which includes chars and spaces.

Constructor Summary

AccessConstructor and Description
public
public
SecKey(String base64)

Method Summary

Modifier and TypeMethod and Description
private String
public static SecKey

Returns:

server key.
generateServerKey
(SecKey
client's Sec-WebSocket-Key
clientKey
)

Generate server-side security key, which gets passed to the client during the handshake phase as part of message payload.

public byte[]
public String

Returns:

Security key string representation, which includes chars and spaces.
getSecKey
()

Gets security key string representation, which includes chars and spaces.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bytesback to summary
private byte[] bytes
KEY_SIZEback to summary
public static final int KEY_SIZE
randomback to summary
private static final Random random
secKeyback to summary
private final String secKey

Security key string representation, which includes chars and spaces.

Constructor Detail

SecKeyback to summary
public SecKey()
SecKeyback to summary
public SecKey(String base64)

Method Detail

createback to summary
private String create()
generateServerKeyback to summary
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:SecKey

client's Sec-WebSocket-Key

Returns:SecKey

server key.

getBytesback to summary
public byte[] getBytes()
getSecKeyback to summary
public String getSecKey()

Gets security key string representation, which includes chars and spaces.

Returns:String

Security key string representation, which includes chars and spaces.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
validateServerKeyback to summary
public void validateServerKey(String serverKey)