Skip to content
Permalink
Browse files
  • Loading branch information
Timothy A. Bish committed Jan 24, 2011
1 parent ebab899 commit 50fd5f46396f9eb0f9338b3e2ba36422825f3d9b
Showing 1 changed file with 12 additions and 12 deletions.
@@ -35,7 +35,7 @@ public class SslTransport : TcpTransport
private string keyStoreName;
private string keyStoreLocation;
private bool acceptInvalidBrokerCert = false;

private SslStream sslStream;

public SslTransport(Uri location, Socket socket, IWireFormat wireFormat) :
@@ -84,7 +84,7 @@ public string ClientCertPassword
get { return this.clientCertPassword; }
set { this.clientCertPassword = value; }
}

/// <summary>
/// Indicates if the SslTransport should ignore any errors in the supplied Broker
/// certificate and connect anyway, this is useful in testing with a default AMQ
@@ -116,7 +116,7 @@ protected override Stream CreateSocketStream()
}

this.sslStream = new SslStream(
new NetworkStream(this.socket),
new NetworkStream(this.socket),
false,
new RemoteCertificateValidationCallback(ValidateServerCertificate),
new LocalCertificateSelectionCallback(SelectLocalCertificate) );
@@ -128,7 +128,7 @@ protected override Stream CreateSocketStream()
Tracer.Debug("Authorizing as Client for Server: " + remoteCertName);
sslStream.AuthenticateAsClient(remoteCertName, LoadCertificates(), SslProtocols.Default, false);
Tracer.Debug("Server is Authenticated = " + sslStream.IsAuthenticated);
Tracer.Debug("Server is Encrypted = " + sslStream.IsEncrypted);
Tracer.Debug("Server is Encrypted = " + sslStream.IsEncrypted);
}
catch(Exception e)
{
@@ -178,13 +178,13 @@ protected override Stream CreateSocketStream()
// Configuration may or may not allow us to connect with an invliad broker cert.
return AcceptInvalidBrokerCert;
}

private X509Certificate SelectLocalCertificate(object sender,
string targetHost,
X509CertificateCollection localCertificates,
X509Certificate remoteCertificate,
string targetHost,
X509CertificateCollection localCertificates,
X509Certificate remoteCertificate,
string[] acceptableIssuers)
{
{
Tracer.DebugFormat("Client is selecting a local certificate from {0} possibilities.", localCertificates.Count);

if(localCertificates.Count == 1)
@@ -244,14 +244,14 @@ private X509Certificate2Collection LoadCertificates()
}

X509Store store = new X509Store(name, location);

collection = store.Certificates;
store.Close();
}

return collection;
}

}
}

#endif
#endif

0 comments on commit 50fd5f4

Please sign in to comment.