public abstract class RTMPHandshake extends Object implements IHandshake
Modifier and Type | Field and Description |
---|---|
protected Cipher |
cipherIn |
protected Cipher |
cipherOut |
protected static BigInteger |
DH_BASE |
protected static BigInteger |
DH_MODULUS |
protected static byte[] |
DH_MODULUS_BYTES
Modulus bytes from flazr
|
protected static int |
DIGEST_LENGTH |
protected static byte[] |
GENUINE_FMS_KEY |
protected static byte[] |
GENUINE_FP_KEY |
static byte[] |
HANDSHAKE_PAD_BYTES |
protected static int |
HANDSHAKE_SIZE_SERVER |
protected byte[] |
handshakeBytes |
protected byte |
handshakeType |
protected byte[] |
incomingPublicKey |
protected static int |
KEY_LENGTH |
protected KeyAgreement |
keyAgreement |
protected static org.slf4j.Logger |
log |
protected byte[] |
outgoingPublicKey |
protected static Random |
random |
protected byte[] |
swfVerificationBytes |
protected int |
validationScheme |
Constructor and Description |
---|
RTMPHandshake() |
Modifier and Type | Method and Description |
---|---|
byte[] |
calculateHMAC_SHA256(byte[] input,
byte[] key)
Calculates an HMAC SHA256 hash using a default key length.
|
byte[] |
calculateHMAC_SHA256(byte[] input,
byte[] key,
int length)
Calculates an HMAC SHA256 hash using a set key length.
|
protected abstract void |
createHandshakeBytes()
Create the initial bytes for a request / response.
|
protected KeyPair |
generateKeyPair()
Creates a Diffie-Hellman key pair.
|
Cipher |
getCipherIn()
Returns the contained handshake bytes.
|
Cipher |
getCipherOut()
Gets the DH offset in the handshake bytes array based on validation scheme
Generates DH keypair
Adds public key to handshake bytes
|
protected int |
getDHOffset(byte[] bytes)
Returns the DH offset from an array of bytes.
|
protected int |
getDHOffset0(byte[] bytes)
Returns the DH byte offset.
|
protected int |
getDHOffset1(byte[] bytes)
Returns the DH byte offset.
|
protected int |
getDigestOffset(byte[] pBuffer)
Returns the digest offset using current validation scheme.
|
protected int |
getDigestOffset0(byte[] pBuffer)
Returns a digest byte offset.
|
protected int |
getDigestOffset1(byte[] pBuffer)
Returns a digest byte offset.
|
byte[] |
getHandshakeBytes()
Creates the servers handshake bytes
|
byte |
getHandshakeType()
Returns the handshake type.
|
protected static byte[] |
getPublicKey(KeyPair keyPair)
Returns the public key for a given key pair.
|
protected static byte[] |
getSharedSecret(byte[] otherPublicKeyBytes,
KeyAgreement agreement)
Determines the validation scheme for given input.
|
byte[] |
getSwfVerificationBytes()
Returns the SWF verification bytes.
|
void |
setHandshakeType(byte handshakeType)
Sets the handshake type.
|
abstract boolean |
validate(org.apache.mina.core.buffer.IoBuffer input)
Determines the validation scheme for given input.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doHandshake
protected static org.slf4j.Logger log
public static byte[] HANDSHAKE_PAD_BYTES
protected static final byte[] GENUINE_FMS_KEY
protected static final byte[] GENUINE_FP_KEY
protected static final byte[] DH_MODULUS_BYTES
protected static final BigInteger DH_MODULUS
protected static final BigInteger DH_BASE
protected static final int HANDSHAKE_SIZE_SERVER
protected static final int DIGEST_LENGTH
protected static final int KEY_LENGTH
protected static final Random random
protected KeyAgreement keyAgreement
protected Cipher cipherOut
protected Cipher cipherIn
protected byte handshakeType
protected byte[] handshakeBytes
protected int validationScheme
protected byte[] incomingPublicKey
protected byte[] outgoingPublicKey
protected byte[] swfVerificationBytes
public byte[] calculateHMAC_SHA256(byte[] input, byte[] key)
input
- key
- public byte[] calculateHMAC_SHA256(byte[] input, byte[] key, int length)
input
- key
- length
- protected KeyPair generateKeyPair()
protected static byte[] getPublicKey(KeyPair keyPair)
keyPair
- protected static byte[] getSharedSecret(byte[] otherPublicKeyBytes, KeyAgreement agreement)
otherPublicKeyBytes
- agreement
- protected abstract void createHandshakeBytes()
public abstract boolean validate(org.apache.mina.core.buffer.IoBuffer input)
validate
in interface IHandshake
input
- protected int getDHOffset(byte[] bytes)
bytes
- protected int getDHOffset0(byte[] bytes)
protected int getDHOffset1(byte[] bytes)
protected int getDigestOffset(byte[] pBuffer)
pBuffer
- protected int getDigestOffset0(byte[] pBuffer)
pBuffer
- source for digest dataprotected int getDigestOffset1(byte[] pBuffer)
pBuffer
- source for digest datapublic byte[] getHandshakeBytes()
public void setHandshakeType(byte handshakeType)
handshakeType
- public byte getHandshakeType()
public Cipher getCipherOut()
public Cipher getCipherIn()
public byte[] getSwfVerificationBytes()
Copyright © 2006-2012 The Red5 Project