public virtual void Encode(Stream output) { TlsUtilities.WriteUint8(mStatusType, output); byte b = mStatusType; if (b == 1) { byte[] encoded = ((OcspResponse)mResponse).GetEncoded("DER"); TlsUtilities.WriteOpaque24(encoded, output); return; } throw new TlsFatalAlert(80); }
protected internal static void WriteSupplementalData(Stream output, IList supplementalData) { MemoryStream memoryStream = new MemoryStream(); foreach (SupplementalDataEntry supplementalDatum in supplementalData) { int dataType = supplementalDatum.DataType; TlsUtilities.CheckUint16(dataType); TlsUtilities.WriteUint16(dataType, memoryStream); TlsUtilities.WriteOpaque16(supplementalDatum.Data, memoryStream); } byte[] buf = memoryStream.ToArray(); TlsUtilities.WriteOpaque24(buf, output); }
/** * Encode this {@link CertificateStatus} to a {@link Stream}. * * @param output * the {@link Stream} to encode to. * @throws IOException */ public virtual void Encode(Stream output) { TlsUtilities.WriteUint8(mStatusType, output); switch (mStatusType) { case CertificateStatusType.ocsp: byte[] derEncoding = ((OcspResponse)mResponse).GetEncoded(Asn1Encodable.Der); TlsUtilities.WriteOpaque24(derEncoding, output); break; default: throw new TlsFatalAlert(AlertDescription.internal_error); } }
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); } }