internal void WriteToRecordStream(TlsProtocol protocol) { long num = Length - 4; TlsUtilities.CheckUint24(num); Position = 1L; TlsUtilities.WriteUint24((int)num, this); byte[] buffer = GetBuffer(); int len = (int)Length; protocol.WriteHandshakeMessage(buffer, 0, len); Platform.Dispose(this); }
internal void SendMessage(byte msg_type, byte[] body) { TlsUtilities.CheckUint24(body.Length); if (!mSending) { CheckInboundFlight(); mSending = true; mOutboundFlight.Clear(); } Message message = new Message(mMessageSeq++, msg_type, body); mOutboundFlight.Add(message); WriteMessage(message); UpdateHandshakeMessagesDigest(message); }
public virtual void Encode(Stream output) { IList list = Platform.CreateArrayList(mCertificateList.Length); int num = 0; X509CertificateStructure[] array = mCertificateList; foreach (Asn1Encodable asn1Encodable in array) { byte[] encoded = asn1Encodable.GetEncoded("DER"); list.Add(encoded); num += encoded.Length + 3; } TlsUtilities.CheckUint24(num); TlsUtilities.WriteUint24(num, output); foreach (byte[] item in list) { TlsUtilities.WriteOpaque24(item, output); } }
/** * Encode this {@link Certificate} to a {@link Stream}. * * @param output the {@link Stream} to encode to. * @throws IOException */ public virtual void Encode(Stream output) { IList derEncodings = Platform.CreateArrayList(mCertificateList.Length); int totalLength = 0; foreach (Asn1Encodable asn1Cert in mCertificateList) { byte[] derEncoding = asn1Cert.GetEncoded(Asn1Encodable.Der); derEncodings.Add(derEncoding); totalLength += derEncoding.Length + 3; } TlsUtilities.CheckUint24(totalLength); TlsUtilities.WriteUint24(totalLength, output); foreach (byte[] derEncoding in derEncodings) { TlsUtilities.WriteOpaque24(derEncoding, output); } }