Browse Source

send ChangeCipherSpecs

pull/163/head
orignal 10 years ago
parent
commit
68a03c2134
  1. 14
      Reseed.cpp

14
Reseed.cpp

@ -536,6 +536,14 @@ namespace data
// 256 RSA encrypted 48 bytes ( 2 bytes version + 46 random bytes) // 256 RSA encrypted 48 bytes ( 2 bytes version + 46 random bytes)
}; };
static uint8_t changeCipherSpecs[] =
{
0x14, // change chiper specs
0x03, 0x03, // version (TSL 1.2)
0x00, 0x01, // length
0x01 // type
};
static uint8_t finished[] = static uint8_t finished[] =
{ {
0x16, // handshake 0x16, // handshake
@ -629,6 +637,9 @@ namespace data
uint8_t masterSecret[48], random[64]; uint8_t masterSecret[48], random[64];
memcpy (random, clientHello + 11, 32); memcpy (random, clientHello + 11, 32);
memcpy (random + 32, serverRandom, 32); memcpy (random + 32, serverRandom, 32);
// send ChangeCipherSpecs
site.write ((char *)changeCipherSpecs, sizeof (changeCipherSpecs));
finishedHash.Update (changeCipherSpecs, sizeof (changeCipherSpecs));
// calculate master secret // calculate master secret
PRF (secret, "master secret", random, 64, 48, masterSecret); PRF (secret, "master secret", random, 64, 48, masterSecret);
@ -638,6 +649,9 @@ namespace data
PRF (masterSecret, "client finished", finishedHashDigest, 32, 12, verifyData); PRF (masterSecret, "client finished", finishedHashDigest, 32, 12, verifyData);
site.write ((char *)finished, sizeof (finished)); site.write ((char *)finished, sizeof (finished));
site.write ((char *)finishedHashDigest, 12); site.write ((char *)finishedHashDigest, 12);
// read ChangeCipherSpecs
uint8_t changeCipherSpecs1[6];
site.read ((char *)changeCipherSpecs1, 6);
// read finished // read finished
site.read ((char *)&type, 1); site.read ((char *)&type, 1);
site.read ((char *)&version, 2); site.read ((char *)&version, 2);

Loading…
Cancel
Save