diff options
author | Jose <jose@zeroc.com> | 2016-07-15 14:04:43 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-07-15 14:04:43 +0200 |
commit | 8e9ce68dc2b350cb8daede0c9e8a50f4fbd6568c (patch) | |
tree | aff3a3c954c7305d65782f68c231b523dc975649 /csharp/src | |
parent | ICE-7088 - Fix exception default constructor (diff) | |
download | ice-8e9ce68dc2b350cb8daede0c9e8a50f4fbd6568c.tar.bz2 ice-8e9ce68dc2b350cb8daede0c9e8a50f4fbd6568c.tar.xz ice-8e9ce68dc2b350cb8daede0c9e8a50f4fbd6568c.zip |
Remove cshar IceSSL deprecated features
Diffstat (limited to 'csharp/src')
-rw-r--r-- | csharp/src/Ice/PropertyNames.cs | 5 | ||||
-rw-r--r-- | csharp/src/IceSSL/SSLEngine.cs | 219 |
2 files changed, 1 insertions, 223 deletions
diff --git a/csharp/src/Ice/PropertyNames.cs b/csharp/src/Ice/PropertyNames.cs index b063960feda..2d8fd136f50 100644 --- a/csharp/src/Ice/PropertyNames.cs +++ b/csharp/src/Ice/PropertyNames.cs @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ./config/PropertyNames.xml, Wed Jul 6 13:14:00 2016 +// Generated by makeprops.py from file ..\config\PropertyNames.xml, Fri Jul 15 14:02:34 2016 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -981,10 +981,8 @@ namespace IceInternal new Property(@"^IceSSL\.EntropyDaemon$", false, null), new Property(@"^IceSSL\.FindCert$", false, null), new Property(@"^IceSSL\.FindCert\.[^\s]+$", true, @"IceSSL.FindCert"), - new Property(@"^IceSSL\.ImportCert\.[^\s]+$", true, null), new Property(@"^IceSSL\.InitOpenSSL$", false, null), new Property(@"^IceSSL\.KeyFile$", true, null), - new Property(@"^IceSSL\.KeySet$", true, @"IceSSL.CertStoreLocation"), new Property(@"^IceSSL\.Keychain$", false, null), new Property(@"^IceSSL\.KeychainPassword$", false, null), new Property(@"^IceSSL\.Keystore$", false, null), @@ -993,7 +991,6 @@ namespace IceInternal new Property(@"^IceSSL\.Password$", false, null), new Property(@"^IceSSL\.PasswordCallback$", false, null), new Property(@"^IceSSL\.PasswordRetryMax$", false, null), - new Property(@"^IceSSL\.PersistKeySet$", true, null), new Property(@"^IceSSL\.Protocols$", false, null), new Property(@"^IceSSL\.ProtocolVersionMax$", false, null), new Property(@"^IceSSL\.ProtocolVersionMin$", false, null), diff --git a/csharp/src/IceSSL/SSLEngine.cs b/csharp/src/IceSSL/SSLEngine.cs index 6845b3143fe..d5a4df95649 100644 --- a/csharp/src/IceSSL/SSLEngine.cs +++ b/csharp/src/IceSSL/SSLEngine.cs @@ -75,56 +75,6 @@ namespace IceSSL storeLocation = StoreLocation.CurrentUser; } _useMachineContext = certStoreLocation == "LocalMachine"; - X509KeyStorageFlags keyStorageFlags; - if(_useMachineContext) - { - keyStorageFlags = X509KeyStorageFlags.MachineKeySet; - } - else - { - keyStorageFlags = X509KeyStorageFlags.UserKeySet; - } - - string keySet = properties.getProperty(prefix + "KeySet"); // Deprecated property - if(keySet.Length > 0) - { - if(keySet.Equals("DefaultKeySet")) - { - keyStorageFlags = X509KeyStorageFlags.DefaultKeySet; - } - else if(keySet.Equals("UserKeySet")) - { - keyStorageFlags = X509KeyStorageFlags.UserKeySet; - } - else if(keySet.Equals("MachineKeySet")) - { - keyStorageFlags = X509KeyStorageFlags.MachineKeySet; - } - else - { - _logger.warning("Invalid IceSSL.KeySet value `" + keySet + "' adjusted to `DefaultKeySet'"); - keyStorageFlags = X509KeyStorageFlags.DefaultKeySet; - } - } - - if(properties.getPropertyAsIntWithDefault(prefix + "PersistKeySet", 0) > 0) // Deprecated property - { - keyStorageFlags |= X509KeyStorageFlags.PersistKeySet; - } - - // - // Process IceSSL.ImportCert.* properties. - // - Dictionary<string, string> certs = properties.getPropertiesForPrefix(prefix + "ImportCert."); - foreach(KeyValuePair<string, string> entry in certs) - { - string name = entry.Key; - string val = entry.Value; - if(val.Length > 0) - { - importCertificate(name, val, keyStorageFlags); - } - } // // Protocols selects which protocols to enable, by default we only enable TLS1.0 @@ -872,175 +822,6 @@ namespace IceSSL return false; } - private void importCertificate(string propName, string propValue, X509KeyStorageFlags keyStorageFlags) - { - // - // Expecting a property of the following form: - // - // IceSSL.ImportCert.<location>.<name>=<file>[;password] - // - const string prefix = "IceSSL.ImportCert."; - StoreLocation loc = 0; - StoreName name = 0; - string sname = null; - parseStore(propName, propName.Substring(prefix.Length), ref loc, ref name, ref sname); - - // - // Extract the filename and password. Either or both can be quoted. - // - string[] arr = splitString(propValue, ';'); - if(arr == null) - { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); - e.reason = "IceSSL: unmatched quote in `" + propValue + "'"; - throw e; - } - if(arr.Length == 0) - { - return; - } - string file = arr[0]; - string passwordStr = null; - if(arr.Length > 1) - { - passwordStr = arr[1]; - } - - // - // Open the X509 certificate store. - // - X509Store store = null; - try - { - if(sname != null) - { - store = new X509Store(sname, loc); - } - else - { - store = new X509Store(name, loc); - } - store.Open(OpenFlags.ReadWrite); - } - catch(Exception ex) - { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(ex); - e.reason = "IceSSL: failure while opening store specified by " + propName; - throw e; - } - - if(!checkPath(ref file)) - { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); - e.reason = "IceSSL: certificate file not found:\n" + file; - throw e; - } - - SecureString password = null; - if(passwordStr != null) - { - password = createSecureString(passwordStr); - } - else if(_passwordCallback != null) - { - password = _passwordCallback.getImportPassword(file); - } - - // - // Add the certificate to the store. - // - try - { - X509Certificate2 cert; - if(password != null) - { - cert = new X509Certificate2(file, password, keyStorageFlags); - } - else - { - cert = new X509Certificate2(file, "", keyStorageFlags); - } - store.Add(cert); - } - catch(Exception ex) - { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(ex); - e.reason = "IceSSL: failure while adding certificate file:\n" + file; - throw e; - } - finally - { - store.Close(); - } - } - - // - // Split strings using a delimiter. Quotes are supported. - // Returns null for an unmatched quote. - // - private static string[] splitString(string str, char delim) - { - ArrayList l = new ArrayList(); - char[] arr = new char[str.Length]; - int pos = 0; - - while(pos < str.Length) - { - int n = 0; - char quoteChar = '\0'; - if(str[pos] == '"' || str[pos] == '\'') - { - quoteChar = str[pos]; - ++pos; - } - bool trim = true; - while(pos < str.Length) - { - if(quoteChar != '\0' && str[pos] == '\\' && pos + 1 < str.Length && str[pos + 1] == quoteChar) - { - ++pos; - } - else if(quoteChar != '\0' && str[pos] == quoteChar) - { - trim = false; - ++pos; - quoteChar = '\0'; - break; - } - else if(str[pos] == delim) - { - if(quoteChar == '\0') - { - ++pos; - break; - } - } - if(pos < str.Length) - { - arr[n++] = str[pos++]; - } - } - if(quoteChar != '\0') - { - return null; // Unmatched quote. - } - if(n > 0) - { - string s = new string(arr, 0, n); - if(trim) - { - s = s.Trim(); - } - if(s.Length > 0) - { - l.Add(s); - } - } - } - - return (string[])l.ToArray(typeof(string)); - } - private SslProtocols parseProtocols(string[] arr) { SslProtocols result = SslProtocols.Default; |