public CipherSuite(ProtocolVersion version) { ProtocolVersion = version; CipherSuiteID = 0x0000; CipherSuiteName = "TLS_NULL_WITH_NULL_NULL"; _keyExchangeAlgorithm = new KeyExchangeAlgorithmNull(); _signatureAlgorithm = new SignatureAlgorithmNull(); _pseudoRandomFunction = null; _bulkCipherAlgorithm = new BulkCipherAlgorithmNull(); _macAlgorithm = new MACAlgorithmNull(); }
protected HashAlgorithm GetSignatureHashAlgorithm(SignatureAlgorithm signatureAlgorithm, byte hashAlgorithmType) { if (!signatureAlgorithm.SupportsHashAlgorithmType(hashAlgorithmType)) { throw new AlertException(AlertDescription.IllegalParameter, "Illegal hash algorithm type"); } HashAlgorithm hashAlgorithm; switch (hashAlgorithmType) { case 1: hashAlgorithm = new MD5CryptoServiceProvider(); break; case 2: hashAlgorithm = new SHA1CryptoServiceProvider(); break; case 4: hashAlgorithm = new SHA256Managed(); break; case 5: hashAlgorithm = new SHA384Managed(); break; case 6: hashAlgorithm = new SHA512Managed(); break; default: throw new AlertException(AlertDescription.InternalError, "Unsupported hash algorithm type: " + hashAlgorithmType); } return hashAlgorithm; }