public void TLSv12Test()
{
byte[] finished2eb = new byte[] {
0x16, 0x03, 0x03, 0x00, 0x28, 0x77, 0xb7, 0x66,
0x18, 0x6f, 0x70, 0x52, 0x14, 0xc9, 0xa4, 0xbc,
0xbf, 0x26, 0x05, 0xf7, 0x99, 0x42, 0xb1, 0xc5,
0xc3, 0xcf, 0x3c, 0xb6, 0x48, 0x34, 0xfc, 0xd6,
0x35, 0x45, 0xf0, 0x12, 0xce, 0x1b, 0x0b, 0xff,
0x94, 0x15, 0x8f, 0x56, 0xda
};
byte[] finished1db = new byte[] {
0x16, 0x03, 0x03, 0x00, 0x10, 0x14, 0x00, 0x00,
0x0C, 0x01, 0xE4, 0xC1, 0xFF, 0x6B, 0x7E, 0x2F,
0x6F, 0x6B, 0xC5, 0x16, 0xE6
};
byte[] finished2db = new byte[] {
0x16, 0x03, 0x03, 0x00, 0x10, 0x14, 0x00, 0x00,
0x0C, 0x83, 0x51, 0x75, 0x4D, 0x01, 0x37, 0x51,
0xEE, 0x72, 0x2F, 0xAE, 0x90
};
byte[] crandom = new byte[] {
0x4e, 0x61, 0xfd, 0x0b, 0x16, 0x0e, 0x3c, 0x92,
0xa0, 0x15, 0x90, 0x61, 0xfb, 0x2e, 0x51, 0xb4,
0x8f, 0xb0, 0xf5, 0xf2, 0x67, 0x4e, 0x20, 0x7f,
0xc3, 0x0d, 0x8e, 0x85, 0xdb, 0xfb, 0x58, 0xac
};
byte[] srandom = new byte[] {
0x4e, 0x61, 0xfd, 0xe6, 0xf9, 0x06, 0x4d, 0x7c,
0x4c, 0x5b, 0x0b, 0x72, 0x6a, 0xba, 0x86, 0x76,
0xd9, 0x7d, 0xce, 0xcc, 0xd5, 0x24, 0x60, 0x6e,
0xaf, 0x16, 0x0f, 0x85, 0x52, 0x8d, 0xba, 0x86
};
byte[] master = new byte[] {
0xCA, 0xCB, 0xE5, 0x65, 0x39, 0x78, 0xFC, 0xCE,
0x18, 0xD8, 0x1C, 0xD8, 0xAD, 0x4E, 0x5E, 0x91,
0x18, 0x2B, 0x0E, 0xEF, 0x60, 0x13, 0xBB, 0xBF,
0xD8, 0x62, 0x77, 0x7F, 0xA3, 0xEF, 0x76, 0xAB,
0x7E, 0x3A, 0x26, 0xF2, 0xE1, 0xB8, 0x50, 0x46,
0x65, 0x85, 0x04, 0x23, 0xCC, 0x52, 0x2C, 0x87
};
Record finished1 = GetRecord(finished1db);
Record finished2 = GetRecord(finished2eb);
CipherSuitePluginManager pluginManager = GetPluginManager();
RecordHandler recordHandler = new RecordHandler(ProtocolVersion.SSL3_0, true);
// Check that GCM suite is not available in TLS 1.1
CipherSuite nullSuite = pluginManager.GetCipherSuite(ProtocolVersion.TLS1_1, 0x00a2);
Assert.IsNull(nullSuite);
// Check that GCM suite is available in TLS 1.2
CipherSuite cipherSuite = pluginManager.GetCipherSuite(ProtocolVersion.TLS1_2, 0x00a2);
Assert.IsNotNull(cipherSuite);
// Set correct cipher suite
ConnectionState connectionState = new ConnectionState(crandom, srandom, master);
recordHandler.SetCipherSuite(cipherSuite, connectionState);
// Test that initial state doesn't modify records
recordHandler.ProcessOutputRecord(finished1);
recordHandler.ProcessInputRecord(finished2);
Assert.AreEqual(finished1db, finished1.GetBytes());
Assert.AreEqual(finished2eb, finished2.GetBytes());
recordHandler.ChangeLocalState();
recordHandler.ProcessOutputRecord(finished1);
recordHandler.ChangeRemoteState();
recordHandler.ProcessInputRecord(finished2);
Assert.AreEqual(finished2db, finished2.GetBytes());
}