private void StartSession(IServerSession session) { var clientIv = _ivGenerator.GetNewIv(); var serverIv = _ivGenerator.GetNewIv(); var info = new ConfiguredHandshakeInfo(_serverConfiguration, clientIv, serverIv); var crypto = EndpointCrypto.Server(_ivFactory, clientIv, serverIv); session.Start(crypto, info); }
/// <inheritdoc /> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="endpointCrypto"/> or <paramref name="handshakeInfo"/> are <see langword="null"/>. /// </exception> public void Start(EndpointCrypto endpointCrypto, HandshakeInfo handshakeInfo) { if (endpointCrypto == null) { throw new ArgumentNullException(nameof(endpointCrypto)); } if (handshakeInfo == null) { throw new ArgumentNullException(nameof(handshakeInfo)); } ThrowIfNoPacketReceivedSubscriber(); Crypto = endpointCrypto; byte[] handshake = ConstructHandshakePacket(handshakeInfo); BaseSession.Start(); BaseSession.Write(handshake); }