docs: function () {
          var that = this;
  
  
          CryptoLib.getRandomBytes(Handshake.SESSION_BYTES, function (ex, buf) {
              that.sessionKey = buf;
  
  
              //Server RSA encrypts this 40-byte message using the Core's public key to create a 128-byte ciphertext.
              var ciphertext = CryptoLib.encrypt(that.corePublicKey, that.sessionKey);
  
              //Server creates a 20-byte HMAC of the ciphertext using SHA1 and the 40 bytes generated in the previous step as the HMAC key.
              var hash = CryptoLib.createHmacDigest(ciphertext, that.sessionKey);
  
              //Server signs the HMAC with its RSA private key generating a 256-byte signature.
              var signedhmac = CryptoLib.sign(null, hash);
  
              //Server sends ~384 bytes to Core: the ciphertext then the signature.
              //logger.log("server: ciphertext was :", ciphertext.toString('hex'));
              //console.log("signature block was: " + signedhmac.toString('hex'));
  
              var msg = Buffer.concat([ciphertext, signedhmac], ciphertext.length + signedhmac.length);
              that.socket.write(msg);
              //logger.log('Handshake: sent encrypted sessionKey');
  
              that.secureIn = CryptoLib.CreateAESDecipherStream(that.sessionKey);
              that.secureOut = CryptoLib.CreateAESCipherStream(that.sessionKey);
  
  
              if (that.useChunkingStream) {
  
                  that.chunkingIn = new ChunkingStream({outgoing: false });
                  that.chunkingOut = new ChunkingStream({outgoing: true });
  
                  //what I receive gets broken into message chunks, and goes into the decrypter
                  that.socket.pipe(that.chunkingIn);
                  that.chunkingIn.pipe(that.secureIn);
  
                  //what I send goes into the encrypter, and then gets broken into message chunks
                  that.secureOut.pipe(that.chunkingOut);
                  that.chunkingOut.pipe(that.socket);
              }
              else {
                  that.socket.pipe(that.secureIn);
                  that.secureOut.pipe(that.socket);
              }
  
              that.secureIn.on('readable', function () {
                  var chunk = that.secureIn.read();
                  if (that.stage > Handshake.stages.DONE) {
                      that.routeToClient(chunk);
                  }
                  else if (that.stage >= Handshake.stages.SEND_HELLO) {
                      that.queueEarlyData(that.stage, chunk);
                  }
                  else {
                      that.nextStep(chunk);
                  }
              });
  
              //a good start
              that.stage++;
              that.nextStep();
          });
      }