fix for: https://issues.apache.org/jira/browse/AMQNET-311


Project: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/commit/419f24f8
Tree: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/tree/419f24f8
Diff: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/diff/419f24f8

Branch: refs/heads/1.5.x
Commit: 419f24f8a19b608b8ec011546cc829f9a6414575
Parents: 836e216
Author: Timothy A. Bish <tab...@apache.org>
Authored: Mon Jan 24 15:03:00 2011 +0000
Committer: Timothy A. Bish <tab...@apache.org>
Committed: Mon Jan 24 15:03:00 2011 +0000

----------------------------------------------------------------------
 src/main/csharp/Transport/Tcp/SslTransport.cs | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/blob/419f24f8/src/main/csharp/Transport/Tcp/SslTransport.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Transport/Tcp/SslTransport.cs 
b/src/main/csharp/Transport/Tcp/SslTransport.cs
index f5a39b6..d1fcf51 100644
--- a/src/main/csharp/Transport/Tcp/SslTransport.cs
+++ b/src/main/csharp/Transport/Tcp/SslTransport.cs
@@ -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

Reply via email to