class OutboundNTCP2State extends Object implements EstablishState
Modifier and Type | Field and Description |
---|---|
static int |
IV_SIZE |
static int |
KEY_SIZE |
static int |
MAC_SIZE |
static long |
MAX_SKEW
in SECONDS
|
static int |
MSG1_SIZE
64
|
static int |
MSG2_SIZE |
static int |
MSG3P1_SIZE
48
|
static int |
OPTIONS1_SIZE |
static int |
OPTIONS2_SIZE |
static int |
TOTAL1_MAX
one less than 288 byte NTCP1 msg 1
|
static byte[] |
ZEROKEY |
Constructor and Description |
---|
OutboundNTCP2State(RouterContext ctx,
NTCPTransport transport,
NTCPConnection con) |
Modifier and Type | Method and Description |
---|---|
void |
close(String reason,
Exception e)
Release resources on timeout.
|
protected void |
fail(String reason) |
protected void |
fail(String reason,
Exception e) |
protected void |
fail(String reason,
Exception e,
boolean bySkew) |
(package private) static byte[][] |
generateSipHashKeys(RouterContext ctx,
HandshakeState state)
KDF for SipHash
|
int |
getVersion()
Get the NTCP version
|
boolean |
isComplete()
Don't synchronize this, deadlocks all over.
|
boolean |
isCorrupt()
did the handshake fail for some reason?
|
void |
prepareOutbound()
We are Alice.
|
void |
receive(ByteBuffer src)
Parse the contents of the buffer as part of the handshake.
|
String |
toString() |
public static final int KEY_SIZE
public static final int MAC_SIZE
public static final int IV_SIZE
public static final int OPTIONS1_SIZE
public static final int MSG1_SIZE
public static final int TOTAL1_MAX
public static final int OPTIONS2_SIZE
public static final int MSG2_SIZE
public static final int MSG3P1_SIZE
public static final long MAX_SKEW
public static final byte[] ZEROKEY
public OutboundNTCP2State(RouterContext ctx, NTCPTransport transport, NTCPConnection con)
IllegalArgumentException
- on bad address in the conpublic void receive(ByteBuffer src)
receive
in interface EstablishState
public boolean isCorrupt()
isCorrupt
in interface EstablishState
public boolean isComplete()
isComplete
in interface EstablishState
public int getVersion()
getVersion
in interface EstablishState
public void prepareOutbound()
prepareOutbound
in interface EstablishState
IllegalStateException
static byte[][] generateSipHashKeys(RouterContext ctx, HandshakeState state)
public void close(String reason, Exception e)
close
in interface EstablishState
e
- may be nullprotected void fail(String reason)