You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/01/24 15:58:09 UTC
svn commit: r1062815 -
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
Author: tabish
Date: Mon Jan 24 14:58:09 2011
New Revision: 1062815
URL: http://svn.apache.org/viewvc?rev=1062815&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQNET-311
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs?rev=1062815&r1=1062814&r2=1062815&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs Mon Jan 24 14:58:09 2011
@@ -33,7 +33,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
private string keyStoreName;
private string keyStoreLocation;
private bool acceptInvalidBrokerCert = false;
-
+
private SslStream sslStream;
public SslTransport(Uri location, Socket socket, IWireFormat wireFormat) :
@@ -82,7 +82,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
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
@@ -114,7 +114,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
}
this.sslStream = new SslStream(
- new NetworkStream(this.socket),
+ new NetworkStream(this.socket),
false,
new RemoteCertificateValidationCallback(ValidateServerCertificate),
new LocalCertificateSelectionCallback(SelectLocalCertificate) );
@@ -126,7 +126,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
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)
{
@@ -176,13 +176,13 @@ namespace Apache.NMS.ActiveMQ.Transport.
// 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)
@@ -242,12 +242,12 @@ namespace Apache.NMS.ActiveMQ.Transport.
}
X509Store store = new X509Store(name, location);
-
collection = store.Certificates;
+ store.Close();
}
return collection;
}
-
+
}
}