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(); }
public override byte[] GetMasterSecret(PseudoRandomFunction prf, byte[] seed) { // TODO: Add more PRF IDs and their respective master secrets byte[] prfID = prf.CreateDeriveBytes(new byte[0], new byte[0]).GetBytes(48); if (CompareArrays(prfID, SSLv3ID)) { return GetSSLv3MasterSecret(seed); } else if (CompareArrays(prfID, TLSv1ID)) { return GetTLSv1MasterSecret(seed); } else { throw new Exception("Unidentified PRF while getting ECDHE master secret"); } }
public override byte[] GetMasterSecret(PseudoRandomFunction prf, byte[] seed) { throw new Exception("Master secret requested for null key exchange"); }
// Returns the resulting master secret, either GetClientKeys or // ProcessClientKeys needs to be called before calling this method public abstract byte[] GetMasterSecret(PseudoRandomFunction prf, byte[] seed);
public override byte[] GetMasterSecret(PseudoRandomFunction prf, byte[] seed) { if (_preMasterSecret == null) throw new CryptographicException("Premaster secret not defined"); return prf.CreateDeriveBytes(_preMasterSecret, "master secret", seed).GetBytes(48); }