Class OutboundHandshake

  • All Implemented Interfaces:
    org.red5.server.net.IHandshake

    public class OutboundHandshake
    extends org.red5.server.net.rtmp.RTMPHandshake
    Performs handshaking for client connections.
    Author:
    Paul Gregoire
    • Field Summary

      • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void createHandshakeBytes()
      Creates the servers handshake bytes
      org.apache.mina.core.buffer.IoBuffer decodeServerResponse1​(org.apache.mina.core.buffer.IoBuffer in)
      Decodes the first server response (S1) and returns a client response (C2).
      boolean decodeServerResponse2​(org.apache.mina.core.buffer.IoBuffer in)
      Decodes the second server response (S2).
      org.apache.mina.core.buffer.IoBuffer doHandshake​(org.apache.mina.core.buffer.IoBuffer input)  
      org.apache.mina.core.buffer.IoBuffer generateClientRequest1()
      Create the first part of the outgoing connection request (C0 and C1).
      byte[] getHandshakeBytes()  
      void initSwfVerification​(String swfFilePath)
      Initialize SWF verification data.
      void setForceVerification​(boolean forceVerification)  
      boolean validate​(byte[] handshake)
      Determines the validation scheme for given input.
      • 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
    • Constructor Detail

      • OutboundHandshake

        public OutboundHandshake()
      • OutboundHandshake

        public OutboundHandshake​(byte handshakeType)
      • OutboundHandshake

        public OutboundHandshake​(byte handshakeType,
                                 int algorithm)
    • Method Detail

      • doHandshake

        public org.apache.mina.core.buffer.IoBuffer doHandshake​(org.apache.mina.core.buffer.IoBuffer input)
      • createHandshakeBytes

        protected void createHandshakeBytes()
        Creates the servers handshake bytes
        Specified by:
        createHandshakeBytes in class org.red5.server.net.rtmp.RTMPHandshake
      • generateClientRequest1

        public org.apache.mina.core.buffer.IoBuffer generateClientRequest1()
        Create the first part of the outgoing connection request (C0 and C1).
         C0 = 0x03 (client handshake type - 0x03, 0x06, 0x08, or 0x09)
         C1 = 1536 bytes from the client
         
        Returns:
        outgoing handshake C0+C1
      • decodeServerResponse1

        public org.apache.mina.core.buffer.IoBuffer decodeServerResponse1​(org.apache.mina.core.buffer.IoBuffer in)
        Decodes the first server response (S1) and returns a client response (C2).
         S1 = 1536 bytes from the server
         C2 = Copy of S1 bytes
         
        Parameters:
        in - incoming handshake S1
        Returns:
        client response C2
      • decodeServerResponse2

        public boolean decodeServerResponse2​(org.apache.mina.core.buffer.IoBuffer in)
        Decodes the second server response (S2).
         S2 = Copy of C1 bytes
         
        Parameters:
        in - incoming handshake S2
        Returns:
        true if validation passes and false otherwise
      • validate

        public boolean validate​(byte[] handshake)
        Determines the validation scheme for given input.
        Specified by:
        validate in interface org.red5.server.net.IHandshake
        Specified by:
        validate in class org.red5.server.net.rtmp.RTMPHandshake
        Parameters:
        handshake - the handshake bytes from the server
        Returns:
        true if server used a supported validation scheme, false if unsupported
      • initSwfVerification

        public void initSwfVerification​(String swfFilePath)
        Initialize SWF verification data.
        Parameters:
        swfFilePath - path to the swf file or null
      • getHandshakeBytes

        public byte[] getHandshakeBytes()
      • setForceVerification

        public void setForceVerification​(boolean forceVerification)