protected override void DecodeDataBytes(ProtocolVersion version, byte[] data)
{
CertificateList.Clear();
MemoryStream memStream = new MemoryStream(data);
HandshakeStream stream = new HandshakeStream(memStream);
int certsLength = (int)stream.ReadUInt24();
int readBytes = 0;
while (readBytes < certsLength)
{
int certLength = (int)stream.ReadUInt24();
byte[] certBytes = stream.ReadBytes(certLength);
readBytes += 3 + certLength;
CertificateList.Add(new X509Certificate(certBytes));
}
if (readBytes != certsLength)
{
throw new AlertException(AlertDescription.IllegalParameter,
"Certificate total length doesn't match contents");
}
stream.ConfirmEndOfStream();
}