public LegacyTlsClient(Uri targetUri, ICertificateVerifyer verifyer, IClientCredentialsProvider prov, System.Collections.Generic.List<string> hostNames) { this.TargetUri = targetUri; this.verifyer = verifyer; this.credProvider = prov; this.HostNames = hostNames; }
internal TlsDHKeyExchange(TlsProtocolHandler handler, ICertificateVerifyer verifyer, TlsKeyExchangeAlgorithm keyExchange) { switch (keyExchange) { case TlsKeyExchangeAlgorithm.KE_DH_RSA: case TlsKeyExchangeAlgorithm.KE_DH_DSS: this.tlsSigner = null; break; case TlsKeyExchangeAlgorithm.KE_DHE_RSA: this.tlsSigner = new TlsRsaSigner(); break; case TlsKeyExchangeAlgorithm.KE_DHE_DSS: this.tlsSigner = new TlsDssSigner(); break; default: throw new ArgumentException("unsupported key exchange algorithm", "keyExchange"); } this.handler = handler; this.verifyer = verifyer; this.keyExchange = keyExchange; }
public LegacyTlsClient(Uri targetUri, ICertificateVerifyer verifyer, IClientCredentialsProvider prov, List <string> hostNames) { TargetUri = targetUri; this.verifyer = verifyer; credProvider = prov; HostNames = hostNames; }
public LegacyTlsClient(Uri targetUri, ICertificateVerifyer verifyer, IClientCredentialsProvider prov, System.Collections.Generic.List <string> hostNames) { this.TargetUri = targetUri; this.verifyer = verifyer; this.credProvider = prov; //this.HostNames = hostNames; }
public LegacyTlsClient(Uri targetUri, ICertificateVerifyer verifyer, IClientCredentialsProvider prov, System.Collections.Generic.List <string> hostNames, System.Collections.Generic.List <string> clientSupportedProtocols) : base() { this.TargetUri = targetUri; this.verifyer = verifyer; this.credProvider = prov; base.HostNames = hostNames; base.ClientSupportedProtocols = clientSupportedProtocols; }
internal TlsSrpKeyExchange(TlsProtocolHandler handler, ICertificateVerifyer verifyer, TlsKeyExchangeAlgorithm keyExchange) { switch (keyExchange) { case TlsKeyExchangeAlgorithm.KE_SRP: this.tlsSigner = null; break; case TlsKeyExchangeAlgorithm.KE_SRP_RSA: this.tlsSigner = new TlsRsaSigner(); break; case TlsKeyExchangeAlgorithm.KE_SRP_DSS: this.tlsSigner = new TlsDssSigner(); break; default: throw new ArgumentException("unsupported key exchange algorithm", "keyExchange"); } this.handler = handler; this.verifyer = verifyer; this.keyExchange = keyExchange; }
public LegacyTlsClient(ICertificateVerifyer verifyer, IClientCredentialsProvider prov, List <string> hostNames) { this.verifyer = verifyer; this.credProvider = prov; this.HostNames = hostNames; }
public LegacyTlsAuthentication(ICertificateVerifyer verifyer) { this.verifyer = verifyer; }
internal DefaultTlsClient(ICertificateVerifyer verifyer) { this.verifyer = verifyer; }
public LegacyTlsClient(ICertificateVerifyer verifyer) { this.verifyer = verifyer; }
public LegacyTlsAuthentication(Uri targetUri, ICertificateVerifyer verifyer, IClientCredentialsProvider prov) { this.TargetUri = targetUri; this.verifyer = verifyer; this.credProvider = prov; }
/// <summary>Connects to the remote system.</summary> /// <param name="verifyer">Will be used when a certificate is received to verify /// that this certificate is accepted by the client.</param> /// <exception cref="IOException">If handshake was not successful</exception> public virtual void Connect( ICertificateVerifyer verifyer) { this.verifyer = verifyer; /* * Send Client hello * * First, generate some random data. */ this.clientRandom = new byte[32]; /* * TLS 1.0 requires a unix-timestamp in the first 4 bytes */ int t = (int)(DateTimeUtilities.CurrentUnixMs() / 1000L); this.clientRandom[0] = (byte)(t >> 24); this.clientRandom[1] = (byte)(t >> 16); this.clientRandom[2] = (byte)(t >> 8); this.clientRandom[3] = (byte)t; random.NextBytes(this.clientRandom, 4, 28); MemoryStream outStr = new MemoryStream(); TlsUtilities.WriteVersion(outStr); outStr.Write(this.clientRandom, 0, this.clientRandom.Length); /* * Length of Session id */ TlsUtilities.WriteUint8((short)0, outStr); /* * Cipher suites */ TlsCipherSuiteManager.WriteCipherSuites(outStr); /* * Compression methods, just the null method. */ byte[] compressionMethods = new byte[] { 0x00 }; TlsUtilities.WriteUint8((short)compressionMethods.Length, outStr); outStr.Write(compressionMethods, 0, compressionMethods.Length); MemoryStream bos = new MemoryStream(); TlsUtilities.WriteUint8(HP_CLIENT_HELLO, bos); TlsUtilities.WriteUint24((int)outStr.Length, bos); byte[] outBytes = outStr.ToArray(); bos.Write(outBytes, 0, outBytes.Length); byte[] message = bos.ToArray(); rs.WriteMessage(RL_HANDSHAKE, message, 0, message.Length); connection_state = CS_CLIENT_HELLO_SEND; /* * We will now read data, until we have completed the handshake. */ while (connection_state != CS_DONE) { rs.ReadData(); } this.tlsInputStream = new TlsInputStream(this); this.tlsOutputStream = new TlsOuputStream(this); }
internal DefaultTlsClient(ICertificateVerifyer verifyer) { this.verifyer = verifyer; }
public LegacyTlsAuthentication(Uri targetUri, ICertificateVerifyer verifyer, IClientCredentialsProvider prov) { this.TargetUri = targetUri; this.verifyer = verifyer; this.credProvider = prov; }
public virtual void Connect( ICertificateVerifyer verifyer) { this.Connect(new LegacyTlsClient(verifyer)); }
public LegacyTlsAuthentication(ICertificateVerifyer verifyer) { this.verifyer = verifyer; }
/// <summary>Connects to the remote system.</summary> /// <param name="verifyer">Will be used when a certificate is received to verify /// that this certificate is accepted by the client.</param> /// <exception cref="IOException">If handshake was not successful</exception> public virtual void Connect( ICertificateVerifyer verifyer) { this.verifyer = verifyer; /* * Send Client hello * * First, generate some random data. */ this.clientRandom = new byte[32]; /* * TLS 1.0 requires a unix-timestamp in the first 4 bytes */ int t = (int)(DateTimeUtilities.CurrentUnixMs() / 1000L); this.clientRandom[0] = (byte)(t >> 24); this.clientRandom[1] = (byte)(t >> 16); this.clientRandom[2] = (byte)(t >> 8); this.clientRandom[3] = (byte)t; random.NextBytes(this.clientRandom, 4, 28); MemoryStream outStr = new MemoryStream(); TlsUtilities.WriteVersion(outStr); outStr.Write(this.clientRandom, 0, this.clientRandom.Length); /* * Length of Session id */ TlsUtilities.WriteUint8((short)0, outStr); /* * Cipher suites */ TlsCipherSuiteManager.WriteCipherSuites(outStr); /* * Compression methods, just the null method. */ byte[] compressionMethods = new byte[]{0x00}; TlsUtilities.WriteOpaque8(compressionMethods, outStr); /* * Extensions */ // TODO Collect extensions from client // Int32 -> byte[] Hashtable clientExtensions = new Hashtable(); // TODO[SRP] // { // MemoryStream srpData = new MemoryStream(); // TlsUtilities.WriteOpaque8(SRP_identity, srpData); // // // TODO[SRP] RFC5054 2.8.1: ExtensionType.srp = 12 // clientExtensions[12] = srpData.ToArray(); // } this.extendedClientHello = (clientExtensions.Count > 0); if (extendedClientHello) { MemoryStream ext = new MemoryStream(); foreach (int extType in clientExtensions.Keys) { byte[] extValue = (byte[])clientExtensions[extType]; TlsUtilities.WriteUint16(extType, ext); TlsUtilities.WriteOpaque16(extValue, ext); } TlsUtilities.WriteOpaque16(ext.ToArray(), outStr); } MemoryStream bos = new MemoryStream(); TlsUtilities.WriteUint8(HP_CLIENT_HELLO, bos); TlsUtilities.WriteUint24((int) outStr.Length, bos); byte[] outBytes = outStr.ToArray(); bos.Write(outBytes, 0, outBytes.Length); byte[] message = bos.ToArray(); rs.WriteMessage(RL_HANDSHAKE, message, 0, message.Length); connection_state = CS_CLIENT_HELLO_SEND; /* * We will now read data, until we have completed the handshake. */ while (connection_state != CS_DONE) { rs.ReadData(); } this.tlsInputStream = new TlsInputStream(this); this.tlsOutputStream = new TlsOuputStream(this); }
public LegacyTlsClient(ICertificateVerifyer verifyer) { this.verifyer = verifyer; }
/// <summary>Connects to the remote system.</summary> /// <param name="verifyer">Will be used when a certificate is received to verify /// that this certificate is accepted by the client.</param> /// <exception cref="IOException">If handshake was not successful</exception> public void Connect( ICertificateVerifyer verifyer) { this.verifyer = verifyer; /* * Send Client hello * * First, generate some random data. */ this.clientRandom = new byte[32]; /* * TLS 1.0 requires a unix-timestamp in the first 4 bytes */ int t = (int)(DateTimeUtilities.CurrentUnixMs() / 1000L); this.clientRandom[0] = (byte)(t >> 24); this.clientRandom[1] = (byte)(t >> 16); this.clientRandom[2] = (byte)(t >> 8); this.clientRandom[3] = (byte)t; random.NextBytes(this.clientRandom, 4, 28); MemoryStream outStr = new MemoryStream(); TlsUtilities.WriteVersion(outStr); outStr.Write(this.clientRandom, 0, this.clientRandom.Length); /* * Length of Session id */ TlsUtilities.WriteUint8((short)0, outStr); /* * Cipher suites */ TlsCipherSuiteManager.WriteCipherSuites(outStr); /* * Compression methods, just the null method. */ byte[] compressionMethods = new byte[]{0x00}; TlsUtilities.WriteUint8((short)compressionMethods.Length, outStr); outStr.Write(compressionMethods,0, compressionMethods.Length); MemoryStream bos = new MemoryStream(); TlsUtilities.WriteUint8(HP_CLIENT_HELLO, bos); TlsUtilities.WriteUint24((int) outStr.Length, bos); byte[] outBytes = outStr.ToArray(); bos.Write(outBytes, 0, outBytes.Length); byte[] message = bos.ToArray(); rs.WriteMessage(RL_HANDSHAKE, message, 0, message.Length); connection_state = CS_CLIENT_HELLO_SEND; /* * We will now read data, until we have completed the handshake. */ while (connection_state != CS_DONE) { rs.ReadData(); } this.tlsInputStream = new TlsInputStream(this); this.tlsOutputStream = new TlsOuputStream(this); }
public virtual void Connect( ICertificateVerifyer verifyer) { this.Connect(new LegacyTlsClient(verifyer)); }
internal TlsRsaKeyExchange(TlsProtocolHandler handler, ICertificateVerifyer verifyer) { this.handler = handler; this.verifyer = verifyer; }