activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r931561 - in /activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp: SslTransport.cs SslTransportFactory.cs
Date Wed, 07 Apr 2010 14:12:27 GMT
Author: tabish
Date: Wed Apr  7 14:12:26 2010
New Revision: 931561

URL: http://svn.apache.org/viewvc?rev=931561&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQNET-239

Adds URI options for setting which Store name and the Store Location to to load from when
attempting to get client certificates for dual authentication type.

Modified:
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs?rev=931561&r1=931560&r2=931561&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
Wed Apr  7 14:12:26 2010
@@ -33,7 +33,8 @@ namespace Apache.NMS.Stomp.Transport.Tcp
         private string clientCertSubject;
         private string clientCertFilename;
         private string clientCertPassword;
-        
+        private string keyStoreName;
+        private string keyStoreLocation;
         private bool acceptInvalidBrokerCert = false;
         
         private SslStream sslStream;
@@ -95,7 +96,19 @@ namespace Apache.NMS.Stomp.Transport.Tcp
             get { return this.acceptInvalidBrokerCert; }
             set { this.acceptInvalidBrokerCert = value; }
         }
-        
+
+        public string KeyStoreName
+        {
+            get { return this.keyStoreName; }
+            set { this.keyStoreName = value; }
+        }
+
+        public string KeyStoreLocation
+        {
+            get { return this.keyStoreLocation; }
+            set { this.keyStoreLocation = value; }
+        }
+
         protected override Stream CreateSocketStream()
         {
             if(this.sslStream != null)
@@ -211,7 +224,27 @@ namespace Apache.NMS.Stomp.Transport.Tcp
             }
             else
             {
-                X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
+                string name = String.IsNullOrEmpty(this.keyStoreName) ? StoreName.My.ToString()
: this.keyStoreName;
+
+                StoreLocation location = StoreLocation.CurrentUser;
+
+                if(!String.IsNullOrEmpty(this.keyStoreLocation))
+                {
+                    if(String.Compare(this.keyStoreLocation, "CurrentUser", true) == 0)
+                    {
+                        location = StoreLocation.CurrentUser;
+                    }
+                    else if(String.Compare(this.keyStoreLocation, "LocalMachine", true) ==
0)
+                    {
+                        location = StoreLocation.LocalMachine;
+                    }
+                    else
+                    {
+                        throw new NMSException("Invlalid StoreLocation given on URI");
+                    }
+                }
+
+                X509Store store = new X509Store(name, location);
 
                 collection = store.Certificates;
             }

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs?rev=931561&r1=931560&r2=931561&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
Wed Apr  7 14:12:26 2010
@@ -27,6 +27,8 @@ namespace Apache.NMS.Stomp.Transport.Tcp
         private string clientCertSubject;
         private string clientCertFilename;
         private string clientCertPassword;
+        private string keyStoreName;
+        private string keyStoreLocation;
         private bool acceptInvalidBrokerCert = false;
         
         public SslTransportFactory() : base()
@@ -62,7 +64,19 @@ namespace Apache.NMS.Stomp.Transport.Tcp
             get { return this.acceptInvalidBrokerCert; }
             set { this.acceptInvalidBrokerCert = value; }
         }
-        
+
+        public string KeyStoreName
+        {
+            get { return this.keyStoreName; }
+            set { this.keyStoreName = value; }
+        }
+
+        public string KeyStoreLocation
+        {
+            get { return this.keyStoreLocation; }
+            set { this.keyStoreLocation = value; }
+        }
+
 		protected override ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat
wireFormat )
 		{
             Tracer.Debug("Creating new instance of the SSL Transport.");
@@ -73,6 +87,8 @@ namespace Apache.NMS.Stomp.Transport.Tcp
             transport.ClientCertFilename = this.clientCertFilename;
             transport.ClientCertPassword = this.clientCertPassword;
             transport.ServerName = this.serverName;
+            transport.KeyStoreLocation = this.keyStoreLocation;
+            transport.KeyStoreName = this.keyStoreName;
             transport.AcceptInvalidBrokerCert = this.acceptInvalidBrokerCert;
             
             return transport;



Mime
View raw message