Ejemplo n.º 1
0
        public RecordLayer(byte[] protocolVersion)
        {
            m_protocolVersion = protocolVersion;

            SecurityParameters = new SecurityParameters();
            SecurityParameters.BulkCipherAlgorithm = BulkCipherAlgorithm.Null;
            SecurityParameters.MACAlgorithm = MACAlgorithm.Null;

            PRF = new SHA256PRF();
        }
Ejemplo n.º 2
0
        public HandshakeLayer(SecureChannel secureChannel, ConnectionEnd connectionEnd)
        {
            m_secureChannel = secureChannel;
            SecurityParameters = new SecurityParameters();
              SecurityParameters.Entity = connectionEnd;
              SecurityParameters.CompressionAlgorithm = CompressionMethod.Null;
              SecurityParameters.PRFAlgorithm = PRFAlgorithm.SHA256;
              SecurityParameters.CipherType = CipherType.Block;

              AllowedCipherSuites = new CipherSuite[]
            {
              CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA256,
              CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA,
              CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA256,
              CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA,
            };

              VerifyCertificate = c => c.Verify();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new HandshakeLayer object given a SecureChannel and which end of the connection it is to be.
        /// </summary>
        /// <param name="secureChannel">the SecureChannel that comprises the secure functionality of this layer</param>
        /// <param name="connectionEnd">this specifies which end of the connection - Server or Client</param>
        public HandshakeLayer(SecureChannel secureChannel, ConnectionEnd connectionEnd)
        {
            // SHA256 is a class that computes the SHA-256 (SHA stands for Standard Hashing Algorithm) of it's input.
            m_localHash  = SHA256.Create();
            m_remoteHash = SHA256.Create();

            m_secureChannel           = secureChannel;
            SecurityParameters        = new SecurityParameters();
            SecurityParameters.Entity = connectionEnd;
            SecurityParameters.CompressionAlgorithm = CompressionMethod.Null;
            SecurityParameters.PRFAlgorithm         = PRFAlgorithm.SHA256;
            SecurityParameters.CipherType           = CipherType.Block;

            AllowedCipherSuites = new[]
            {
                CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA256,
                CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA,
                CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA256,
                CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA
            };

            VerifyCertificate = c => c.Verify();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a new HandshakeLayer object given a SecureChannel and which end of the connection it is to be.
        /// </summary>
        /// <param name="secureChannel">the SecureChannel that comprises the secure functionality of this layer</param>
        /// <param name="connectionEnd">this specifies which end of the connection - Server or Client</param>
        public HandshakeLayer(SecureChannel secureChannel, ConnectionEnd connectionEnd)
        {
            // SHA256 is a class that computes the SHA-256 (SHA stands for Standard Hashing Algorithm) of it's input.
            m_localHash = SHA256.Create();
            m_remoteHash = SHA256.Create();

            m_secureChannel = secureChannel;
            SecurityParameters = new SecurityParameters();
            SecurityParameters.Entity = connectionEnd;
            SecurityParameters.CompressionAlgorithm = CompressionMethod.Null;
            SecurityParameters.PRFAlgorithm = PRFAlgorithm.SHA256;
            SecurityParameters.CipherType = CipherType.Block;

            AllowedCipherSuites = new[]
            {
                CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA256,
                CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA,
                CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA256,
                CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA
            };

            VerifyCertificate = c => c.Verify();
        }