/// <summary> /// The VPN is two-way established. /// <para>Note that SessionEstablished event is used, it is expected that processing will continue externally. /// In this case the post-exchange symmetric cipher instances are not initialized internally, /// and the Send and Receive methods will throw an error, i.e. you can use either the event or the internal processors.</para> /// </summary> /// /// <param name="PacketStream">A Stream containing the raw packet data</param> private void ProcessEstablish(MemoryStream PacketStream) { // clear the auth processors _srvSymProcessor.Dispose(); _cltSymProcessor.Dispose(); // initialize the Send/Receive encryption ciphers _srvSymProcessor = SymmetricInit(_srvIdentity.Session, _srvKeyParams); _cltSymProcessor = SymmetricInit(_cltIdentity.Session, _cltKeyParams); // one or the other if (SessionEstablished != null) { // app can continue processing out of class; must set the DestroyEngine flag to false in the constructor if this class is to be disposed DtmEstablishedEventArgs args = new DtmEstablishedEventArgs(_clientSocket.Client, _srvSymProcessor, _cltSymProcessor, 0); SessionEstablished(this, args); } _isEstablished = true; }
/// <summary> /// Fired when the session is fully established, the args contain the forward and return symmetric session keys /// </summary> private void OnSessionEstablished(object owner, DtmEstablishedEventArgs args) { Console.WriteLine(CON_TITLE + "The Server VPN state is UP"); }