Exemplo n.º 1
0
        public static Certificate Deserialise(Stream stream, TCertificateType certificateType)
        {
            Certificate result = new Certificate();
            int         certificateChainLength = NetworkByteOrderConverter.ToInt24(stream);

            if (certificateChainLength > 0)
            {
                result._CertificateType = certificateType;
                if (certificateType == TCertificateType.X509)
                {
                    result._CertChain = new List <byte[]>();
                    while (certificateChainLength > 0)
                    {
                        int    certificateLength = NetworkByteOrderConverter.ToInt24(stream);
                        byte[] certificate       = new byte[certificateLength];
                        stream.Read(certificate, 0, certificateLength);
                        result._CertChain.Add(certificate);
                        certificateChainLength = certificateChainLength - certificateLength - 3;
                    }
                }
                else
                {
                }
            }
            return(result);
        }
Exemplo n.º 2
0
		public static Certificate Deserialise(Stream stream, TCertificateType certificateType)
		{
			Certificate result = new Certificate();
			int certificateChainLength = NetworkByteOrderConverter.ToInt24(stream);
			if (certificateChainLength > 0)
			{
				result._CertificateType = certificateType;
				if (certificateType == TCertificateType.X509)
				{
					result._CertChain = new List<byte[]>();
					while (certificateChainLength > 0)
					{
						int certificateLength = NetworkByteOrderConverter.ToInt24(stream);
						byte[] certificate = new byte[certificateLength];
						stream.Read(certificate, 0, certificateLength);
						result._CertChain.Add(certificate);
						certificateChainLength = certificateChainLength - certificateLength - 3;
					}
				}
				else
				{
					
				}
			}
			return result;
		}
Exemplo n.º 3
0
        public static Certificate Deserialise(Stream stream, TCertificateType certificateType)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            var result = new Certificate();
            var certificateChainLength = NetworkByteOrderConverter.ToInt24(stream);

            if (certificateChainLength > 0)
            {
                result.CertificateType = certificateType;
                if (certificateType == TCertificateType.X509)
                {
                    result.CertChain = new List <byte[]>();
                    while (certificateChainLength > 0)
                    {
                        var certificateLength = NetworkByteOrderConverter.ToInt24(stream);
                        var certificate       = new byte[certificateLength];
                        stream.Read(certificate, 0, certificateLength);
                        result.CertChain.Add(certificate);
                        certificateChainLength = certificateChainLength - certificateLength - 3;
                    }

                    if (result.CertChain.Any())
                    {
                        result.Cert = result.CertChain[0];
                    }
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            return(result);
        }
		public ClientCertificateTypeExtension(TCertificateType certificateType)
		{
			_CertificateTypes = new byte[1];
			_CertificateTypes[0] = (byte)certificateType;
		}
Exemplo n.º 5
0
 public ServerCertificateTypeExtension(TCertificateType certificateType) => this.CertificateType = (byte)certificateType;
 public ClientCertificateTypeExtension(TCertificateType certificateType)
 {
     this.CertificateTypes    = new byte[1];
     this.CertificateTypes[0] = (byte)certificateType;
 }
		public ServerCertificateTypeExtension(TCertificateType certificateType)
		{
			_CertificateType= (byte)certificateType;
		}
 public ServerCertificateTypeExtension(TCertificateType certificateType)
 {
     _CertificateType = (byte)certificateType;
 }