Exemple #1
0
    public void AddEncryptedEndpoint(uint protocolVersion, IPEndPoint endPoint, string userId, string userName, byte[] preMasterSecret, byte[] serverRandom, byte[] clientRandom, bool isClient)
    {
        PacketEncryptionLayer.EncryptionState encryptionState = new PacketEncryptionLayer.EncryptionState(protocolVersion, preMasterSecret, serverRandom, clientRandom, isClient);
        encryptionState.SetIdentity(userId, userName);
        Dictionary <IPEndPoint, PacketEncryptionLayer.EncryptionState> encryptionStates = this._encryptionStates;

        lock (encryptionStates)
        {
            this._encryptionStates[endPoint] = encryptionState;
        }
    }
Exemple #2
0
    public void AddPendingEncryptedEndpoint(uint protocolVersion, IPEndPoint endPoint, string userId, string userName, byte[] preMasterSecret, byte[] serverRandom, byte[] clientRandom, bool isClient)
    {
        PacketEncryptionLayer.EncryptionState encryptionState = new PacketEncryptionLayer.EncryptionState(protocolVersion, preMasterSecret, serverRandom, clientRandom, isClient);
        encryptionState.SetIdentity(userId, userName);
        Dictionary <IPEndPoint, PacketEncryptionLayer.EncryptionState> encryptionStates = this._encryptionStates;

        lock (encryptionStates)
        {
            Dictionary <int, PacketEncryptionLayer.EncryptionState> dictionary;
            if (!this._pendingEncryptionStates.TryGetValue(endPoint.Address, out dictionary))
            {
                dictionary = new Dictionary <int, PacketEncryptionLayer.EncryptionState>();
                this._pendingEncryptionStates[endPoint.Address] = dictionary;
            }
            dictionary[endPoint.Port] = encryptionState;
        }
    }