public static ServerCertificateTypeExtension Deserialise(Stream stream, bool client) { ServerCertificateTypeExtension result = new ServerCertificateTypeExtension(); int certificateType = stream.ReadByte(); if (certificateType >= 0) { result._CertificateType = (byte)certificateType; } return result; }
public static ServerCertificateTypeExtension Deserialise(Stream stream, bool client) { ServerCertificateTypeExtension result = new ServerCertificateTypeExtension(); int certificateType = stream.ReadByte(); if (certificateType >= 0) { result._CertificateType = (byte)certificateType; } return(result); }
public static Extension Deserialise(Stream stream, bool client) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } Extension result = null; if (stream.Position < stream.Length) { result = new Extension { ExtensionType = (TExtensionType)NetworkByteOrderConverter.ToUInt16(stream) }; var length = NetworkByteOrderConverter.ToUInt16(stream); if (length > 0) { if (result.ExtensionType == TExtensionType.EllipticCurves) { result.SpecificExtension = EllipticCurvesExtension.Deserialise(stream); } else if (result.ExtensionType == TExtensionType.ClientCertificateType) { result.SpecificExtension = ClientCertificateTypeExtension.Deserialise(stream, client); } else if (result.ExtensionType == TExtensionType.ServerCertificateType) { result.SpecificExtension = ServerCertificateTypeExtension.Deserialise(stream, client); } else if (result.ExtensionType == TExtensionType.SignatureAlgorithms) { result.SpecificExtension = SignatureAlgorithmsExtension.Deserialise(stream); } else { result.Data = new byte[length]; stream.Read(result.Data, 0, length); } } } return(result); }
public static Extension Deserialise(Stream stream, bool client) { Extension result = null; if (stream.Position < stream.Length) { result = new Extension(); result._ExtensionType = (TExtensionType)NetworkByteOrderConverter.ToUInt16(stream); ushort length = NetworkByteOrderConverter.ToUInt16(stream); if (length > 0) { if (result._ExtensionType == TExtensionType.EllipticCurves) { result._SpecifcExtension = EllipticCurvesExtension.Deserialise(stream); } else if (result._ExtensionType == TExtensionType.ClientCertificateType) { result._SpecifcExtension = ClientCertificateTypeExtension.Deserialise(stream, client); } else if (result._ExtensionType == TExtensionType.ServerCertificateType) { result._SpecifcExtension = ServerCertificateTypeExtension.Deserialise(stream, client); } else if (result._ExtensionType == TExtensionType.SignatureAlgorithms) { result._SpecifcExtension = SignatureAlgorithmsExtension.Deserialise(stream); } else { result._Data = new byte[length]; stream.Read(result._Data, 0, length); } } } return(result); }