Esempio n. 1
0
        /// <inheritdoc />
        public OutgoingWoltkToVanillaCryptoService([NotNull] SRP6SessionKeyStore keyStore)
        {
            KeyStore = keyStore ?? throw new ArgumentNullException(nameof(keyStore));

            LazyEncryptionService = new Lazy <ICryptoServiceProvider>(() => new SessionXORPacketCryptoService(true, KeyStore.SessionKey));
            LazyDecryptionService = new Lazy <ICryptoServiceProvider>(() => new SessionXORPacketCryptoService(false, KeyStore.SessionKey), true);
        }
Esempio n. 2
0
        /// <inheritdoc />
        protected override IManagedNetworkClient <GamePacketPayload, GamePacketPayload> BuildOutgoingSessionManagedClient(NetworkClientBase clientBase, INetworkSerializationService serializeService)
        {
            SRP6SessionKeyStore keyStore = ServiceContainer.Resolve <SRP6SessionKeyStore>();
            ICombinedSessionPacketCryptoService cryptoService = BuildOutgoingPacketCryptoService(keyStore);

            var wowClientReadServerWrite = new WoWClientWriteServerReadProxyPacketPayloadReaderWriterDecorator <NetworkClientBase, GamePacketPayload, GamePacketPayload, IGamePacketPayload>(clientBase, serializeService, cryptoService);

            return(new ManagedNetworkServerClient <WoWClientWriteServerReadProxyPacketPayloadReaderWriterDecorator <NetworkClientBase, GamePacketPayload, GamePacketPayload, IGamePacketPayload>, GamePacketPayload, GamePacketPayload>(wowClientReadServerWrite, Logger));
        }
Esempio n. 3
0
        /// <inheritdoc />
        protected override IManagedNetworkServerClient <GamePacketPayload, GamePacketPayload> BuildIncomingSessionManagedClient(NetworkClientBase clientBase, INetworkSerializationService serializeService)
        {
            //TODO: Are any details actually valuable here?
            if (Logger.IsInfoEnabled)
            {
                Logger.Info($"Client connected to proxy.");
            }

            SRP6SessionKeyStore keyStore = ServiceContainer.Resolve <SRP6SessionKeyStore>();
            ICombinedSessionPacketCryptoService cryptoService = BuildIncomingPacketCryptoService(keyStore);

            var wowClientReadServerWrite = new WoWClientReadServerWriteProxyPacketPayloadReaderWriterDecorator <NetworkClientBase, GamePacketPayload, GamePacketPayload, IGamePacketPayload>(clientBase, serializeService, cryptoService, Logger);

            return(new ManagedNetworkServerClient <WoWClientReadServerWriteProxyPacketPayloadReaderWriterDecorator <NetworkClientBase, GamePacketPayload, GamePacketPayload, IGamePacketPayload>, GamePacketPayload, GamePacketPayload>(wowClientReadServerWrite, Logger));
        }
Esempio n. 4
0
        /// <summary>
        /// Inheritors can override this to implement and return their own crypto strategy.
        /// </summary>
        /// <param name="keyStore"></param>
        /// <returns></returns>
        protected virtual ICombinedSessionPacketCryptoService BuildOutgoingPacketCryptoService([NotNull] SRP6SessionKeyStore keyStore)
        {
            if (keyStore == null)
            {
                throw new ArgumentNullException(nameof(keyStore));
            }

            return(new DefaultSessionPacketCryptoService(ServiceContainer.Resolve <SRP6SessionKeyStore>(), encryptionKey.ToArray(), decryptionKey.ToArray()));
        }
 //TODO: Redo this design so we can inject this somehow.
 /// <inheritdoc />
 protected override ICombinedSessionPacketCryptoService BuildOutgoingPacketCryptoService(SRP6SessionKeyStore keyStore)
 {
     return(new OutgoingWoltkToVanillaCryptoService(keyStore));
 }