Package org.red5.server.net.rtmp
Class InboundHandshake
java.lang.Object
org.red5.server.net.rtmp.RTMPHandshake
org.red5.server.net.rtmp.InboundHandshake
- All Implemented Interfaces:
IHandshake
Performs handshaking for server connections.
- Author:
- Paul Gregoire
-
Field Summary
Modifier and TypeFieldDescriptionprivate byte[]
private int
private byte[]
private boolean
Fields inherited from class org.red5.server.net.rtmp.RTMPHandshake
algorithm, BLOWFISH_KEYS, buffer, cipherIn, cipherOut, DH_BASE, DH_MODULUS, DH_MODULUS_BYTES, DIGEST_LENGTH, fp9Handshake, GENUINE_FMS_KEY, GENUINE_FP_KEY, HANDSHAKE_TYPES, handshakeBytes, handshakeType, incomingPublicKey, KEY_LENGTH, keyAgreement, log, outgoingPublicKey, random, swfSize, swfVerificationBytes, XTEA_KEYS
-
Constructor Summary
ConstructorDescriptionInboundHandshake
(byte handshakeType) InboundHandshake
(byte handshakeType, int algorithm) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Creates the servers handshake bytesorg.apache.mina.core.buffer.IoBuffer
decodeClientRequest1
(org.apache.mina.core.buffer.IoBuffer in) Decodes the first client request (C1) and returns a server response (S0S1).boolean
decodeClientRequest2
(org.apache.mina.core.buffer.IoBuffer in) Decodes the second client request (C2) and returns a server response (S2).org.apache.mina.core.buffer.IoBuffer
doHandshake
(org.apache.mina.core.buffer.IoBuffer in) Generates response for versioned connections.private org.apache.mina.core.buffer.IoBuffer
generateUnversionedHandshake
(byte[] input) Generates response for non-versioned connections, such as those before FP9.byte[]
void
setHandshakeBytes
(byte[] handshake) void
setUnvalidatedConnectionAllowed
(boolean unvalidatedConnectionAllowed) boolean
validate
(byte[] handshake) Determines the validation scheme for given input.private boolean
validateScheme
(byte[] handshake, int scheme) Methods inherited from class org.red5.server.net.rtmp.RTMPHandshake
addBuffer, addBuffer, calculateDigest, calculateHMAC_SHA256, calculateSwfVerification, generateKeyPair, getBlowfishSignature, getBuffer, getBufferAsIoBuffer, getBufferSize, getCipherIn, getCipherOut, getDHOffset, getDHOffset1, getDHOffset2, getDigestOffset, getDigestOffset1, getDigestOffset2, getHandshakeType, getPublicKey, getSharedSecret, getSwfVerificationBytes, getXteaSignature, initRC4Encryption, setHandshakeType, useEncryption, validHandshakeType, verifyDigest
-
Field Details
-
s1
private byte[] s1 -
c1
private byte[] c1 -
digestPosServer
private int digestPosServer -
unvalidatedConnectionAllowed
private boolean unvalidatedConnectionAllowed
-
-
Constructor Details
-
InboundHandshake
public InboundHandshake() -
InboundHandshake
public InboundHandshake(byte handshakeType) -
InboundHandshake
public InboundHandshake(byte handshakeType, int algorithm)
-
-
Method Details
-
doHandshake
public org.apache.mina.core.buffer.IoBuffer doHandshake(org.apache.mina.core.buffer.IoBuffer in) Generates response for versioned connections.- Parameters:
in
- incoming RTMP handshake bytes- Returns:
- outgoing handshake
-
decodeClientRequest1
public org.apache.mina.core.buffer.IoBuffer decodeClientRequest1(org.apache.mina.core.buffer.IoBuffer in) Decodes the first client request (C1) and returns a server response (S0S1).C1 = 1536 bytes from the client S0 = 0x03 (server handshake type - 0x03, 0x06, 0x08, or 0x09) S1 = 1536 bytes from server
- Parameters:
in
- incoming handshake C1- Returns:
- server response S0+S1
-
decodeClientRequest2
public boolean decodeClientRequest2(org.apache.mina.core.buffer.IoBuffer in) Decodes the second client request (C2) and returns a server response (S2).C2 = Copy of S1 bytes S2 = Copy of C1 bytes
- Parameters:
in
- incoming handshake C2- Returns:
- true if C2 was processed successfully and false otherwise
-
generateUnversionedHandshake
private org.apache.mina.core.buffer.IoBuffer generateUnversionedHandshake(byte[] input) Generates response for non-versioned connections, such as those before FP9.- Parameters:
input
- incoming RTMP bytes- Returns:
- outgoing handshake
-
createHandshakeBytes
protected void createHandshakeBytes()Creates the servers handshake bytes- Specified by:
createHandshakeBytes
in classRTMPHandshake
-
validate
public boolean validate(byte[] handshake) Determines the validation scheme for given input.- Specified by:
validate
in interfaceIHandshake
- Specified by:
validate
in classRTMPHandshake
- Parameters:
handshake
- handshake bytes from the client- Returns:
- true if client used a supported validation scheme, false if unsupported
-
validateScheme
private boolean validateScheme(byte[] handshake, int scheme) -
setHandshakeBytes
public void setHandshakeBytes(byte[] handshake) -
getHandshakeBytes
public byte[] getHandshakeBytes() -
setUnvalidatedConnectionAllowed
public void setUnvalidatedConnectionAllowed(boolean unvalidatedConnectionAllowed)
-