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 16:03:01 UTC

svn commit: r1062818 - /activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Transport/Tcp/SslTransport.cs

Author: tabish
Date: Mon Jan 24 15:03:00 2011
New Revision: 1062818

URL: http://svn.apache.org/viewvc?rev=1062818&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQNET-311

Modified:
    activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Transport/Tcp/SslTransport.cs

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Transport/Tcp/SslTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Transport/Tcp/SslTransport.cs?rev=1062818&r1=1062817&r2=1062818&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Transport/Tcp/SslTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Transport/Tcp/SslTransport.cs Mon Jan 24 15:03:00 2011
@@ -35,7 +35,7 @@ namespace Apache.NMS.Stomp.Transport.Tcp
         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 @@ namespace Apache.NMS.Stomp.Transport.Tcp
             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 @@ namespace Apache.NMS.Stomp.Transport.Tcp
             }
 
             this.sslStream = new SslStream(
-                new NetworkStream(this.socket), 
+                new NetworkStream(this.socket),
                 false,
                 new RemoteCertificateValidationCallback(ValidateServerCertificate),
                 new LocalCertificateSelectionCallback(SelectLocalCertificate) );
@@ -128,7 +128,7 @@ namespace Apache.NMS.Stomp.Transport.Tcp
                 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 @@ namespace Apache.NMS.Stomp.Transport.Tcp
             // 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 @@ namespace Apache.NMS.Stomp.Transport.Tcp
                 }
 
                 X509Store store = new X509Store(name, location);
-
                 collection = store.Certificates;
+                store.Close();
             }
 
             return collection;
         }
-        
+
     }
 }
 
-#endif
\ No newline at end of file
+#endif