tls12 tls the securityprotocoltype have common and algorithms c# asp.net ssl iis-7.5 poodle-attack

c# - tls - the client and the server have no common algorithms



El cliente y el servidor no pueden comunicarse, porque no poseen un algoritmo comĂșn (7)

Tengo un problema con un C # PayTrace Gateway. El código de abajo estaba funcionando bien hasta ayer, cuando creo que apagaron SSL3 debido a la Explotación de Poodle. Cuando ejecutamos el siguiente código recibimos el siguiente mensaje. El servidor remoto ha cerrado forzosamente la conexión. Después de investigar un poco sobre el problema, determinamos que debido a que nuestro IIS Server 7.5 estaba configurado para seguir usando SSL3, C # usaba por defecto SSL3, lo que PayTrace cerraría la conexión por la fuerza. Luego eliminamos SSL3 del servidor. Que luego conducen al siguiente error:

El cliente y el servidor no pueden comunicarse, porque no poseen un algoritmo común.

Supongo que hay un algoritmo SSL adicional que necesitamos instalar en el servidor ahora que se ha eliminado SSL 3. Nuestro personal de TI afirma que TLS 1.1 y TLS 1.2 están funcionando y que ASP.NET debería estar ahora en su defecto. Pero siento que todavía debe haber algo más que debemos instalar en el servidor, no tengo conocimiento de los algoritmos SSL, así que no tengo idea de por dónde empezar.

var postUrl = new StringBuilder(); //Initialize url with configuration and parameter values... postUrl.AppendFormat("UN~{0}|", this.MerchantLoginID); postUrl.AppendFormat("PSWD~{0}|", this.MerchantTransactionKey); postUrl.Append("TERMS~Y|METHOD~ProcessTranx|TRANXTYPE~Sale|"); postUrl.AppendFormat("CC~{0}|", cardNumber); postUrl.AppendFormat("EXPMNTH~{0}|", expirationMonth.PadLeft(2, ''0'')); postUrl.AppendFormat("EXPYR~{0}|", expirationYear); postUrl.AppendFormat("AMOUNT~{0}|", transactionAmount); postUrl.AppendFormat("BADDRESS~{0}|", this.AddressLine1); postUrl.AppendFormat("BADDRESS2~{0}|", this.AddressLine2); postUrl.AppendFormat("BCITY~{0}|", this.City); postUrl.AppendFormat("BSTATE~{0}|", this.State); postUrl.AppendFormat("BZIP~{0}|", this.Zip); postUrl.AppendFormat("SADDRESS~{0}|", this.AddressLine1); postUrl.AppendFormat("SADDRESS2~{0}|", this.AddressLine2); postUrl.AppendFormat("SCITY~{0}|", this.City); postUrl.AppendFormat("SSTATE~{0}|", this.State); postUrl.AppendFormat("SZIP~{0}|", this.Zip); if (!String.IsNullOrEmpty(this.Country)) { postUrl.AppendFormat("BCOUNTRY~{0}|", this.Country); } if (!String.IsNullOrEmpty(this.Description)) { postUrl.AppendFormat("DESCRIPTION~{0}|", this.Description); } if (!String.IsNullOrEmpty(this.InvoiceNumber)) { postUrl.AppendFormat("INVOICE~{0}|", this.InvoiceNumber); } if (this.IsTestMode) { postUrl.AppendFormat("TEST~Y|"); } //postUrl.Append(); WebClient wClient = new WebClient(); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; String sRequest = "PARMLIST=" + Url.Encode(postUrl.ToString()); wClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); string sResponse = ""; sResponse = wClient.UploadString(PayTraceUrl, sRequest);

Además, solo un FYI, este problema también está ocurriendo cuando nos conectamos a la puerta de enlace First Data E4, por lo que no es solo una cuestión de PayTrace. Mi conjetura es que a medida que más pasarelas desactiven el acceso a SSL3, seguiremos teniendo problemas con otras pasarelas hasta que esto se pueda resolver en el servidor. Además, encontré algunas sugerencias en línea, algunas sugerían colocar el siguiente código justo antes de realizar la solicitud de salida:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

Lamentablemente eso tampoco funcionó, mismo error. Por eso creo que es necesario instalar algo adicional en el servidor IIS7.5. Simplemente no estoy seguro de qué.


Después de jugar con esto durante días, mi solución final para nuestros problemas requería dos cosas;

1) Agregamos esta línea de código a todas nuestras bibliotecas .Net que realizan llamadas de API vinculadas a otros proveedores que también deshabilitaron su SSL v3.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; // (.Net 4 and below)

2) Estos son los cambios finales y COMPLETOS del registro que necesitará cuando esté ejecutando sitios ASP.Net 4.0 y deberá modificarse ligeramente después de actualizar a ASP.Net 4.5.

Después de reiniciar los servidores, todos los problemas desaparecieron después de esto.

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 2.0/Client] "DisabledByDefault"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 2.0/Client] "Enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 2.0/Server] "DisabledByDefault"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 2.0/Server] "Enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 3.0/Client] "DisabledByDefault"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 3.0/Client] "Enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 3.0/Server] "DisabledByDefault"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 3.0/Server] "Enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.0/Client] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.0/Client] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.0/Server] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.0/Server] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.1/Client] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.1/Client] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.1/Server] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.1/Server] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.2/Client] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.2/Client] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.2/Server] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.2/Server] "DisabledByDefault"=dword:00000000


En las respuestas anteriores se omiten algunas claves de registro que podrían no existir. Son SchUseStrongCrypto que deben existir para permitir que los protocolos TLS funcionen correctamente.

Después de que las claves de registro se hayan importado al registro, no se debe requerir que realice cambios en el código como

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

A continuación, encontrará todas las claves de registro y los valores necesarios para el sistema operativo Windows x64. Si tiene un sistema operativo de 32 bits (x86) simplemente elimine las últimas 2 líneas. TLS 1.0 será deshabilitado por el script de registro. Se requiere reiniciar el sistema operativo.

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols] [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 2.0] [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 2.0/Client] "DisabledByDefault"=dword:00000001 "enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 2.0/server] "disabledbydefault"=dword:00000001 "enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/ssl 3.0] [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/ssl 3.0/client] "disabledbydefault"=dword:00000001 "enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/ssl 3.0/server] "disabledbydefault"=dword:00000001 "enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/tls 1.0] [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/tls 1.0/client] "disabledbydefault"=dword:00000001 "enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/tls 1.0/server] "disabledbydefault"=dword:00000001 "enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/tls 1.1] [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/tls 1.1/client] "disabledbydefault"=dword:00000000 "enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/tls 1.1/server] "disabledbydefault"=dword:00000000 "enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/tls 1.2] [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/tls 1.2/client] "disabledbydefault"=dword:00000000 "enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/tls 1.2/server] "disabledbydefault"=dword:00000000 "enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/v4.0.30319] "SchUseStrongCrypto"=dword:00000001 [HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/.NETFramework/v4.0.30319] "SchUseStrongCrypto"=dword:00000001


En mi caso, a pesar de que Target Framework of Project era 4.7.1, aún recibía el mismo error, ¡la solución era cambiar httpRuntime en web.config bajo system.web a 4.7.1!


En una respuesta anterior, se sugirió usar esta línea de código para .Net 4.5:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // .NET 4.5

Lo alentaría a O a ese valor en cualquiera de los valores existentes:

ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; // .NET 4.5

Si miras la lista de valores, observas que son una potencia de dos. De esta manera, en el futuro, cuando las cosas cambien a TLS 2.0, por ejemplo, su código seguirá funcionando.


Esto fue resuelto. Resulta que nuestro personal de TI estaba en lo correcto. Tanto TLS 1.1 como TLS 1.2 se instalaron en el servidor. Sin embargo, el problema fue que nuestros sitios se ejecutan como ASP.NET 4.0 y usted tiene que tener ASP.NET 4.5 para ejecutar TLS 1.1 o TLS 1.2. Entonces, para resolver el problema, nuestro personal de TI tuvo que volver a habilitar TLS 1.0 para permitir una conexión con PayTrace.

Entonces, en resumen, el mensaje de error, "el cliente y el servidor no pueden comunicarse, porque no poseen un algoritmo común", se debió a que no había un protocolo SSL disponible en el servidor para comunicarse con los servidores de PayTrace.


Hay varias otras publicaciones sobre esto ahora y todas apuntan a habilitar TLS 1.2. Cualquier cosa menos es inseguro.

Puedes hacer esto en .NET 3.5 con un parche.
Puede hacer esto en .NET 4.0 y 4.5 con una sola línea de código

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // .NET 4.5 ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; // .NET 4.0

En .NET 4.6, utiliza automáticamente TLS 1.2.

Vea aquí para más detalles: Soporte de .NET para TLS


La habilitación de TLS 1.0 también solucionó nuestros problemas (después de deshabilitar SSL v3). (Servidor 2012 R2 con sitio web ASP.net 4.0 que procesa contra servicios de pago PPI). Este es el script RegEdit que usé para configurar todo lo que quería. Solo deshabilitamos SSL v3 para el Cliente y no el servidor, ya que esto rompió otras cosas con las que aún no estábamos preparados. Luego de actualizar el sitio a .Net 4.5.2, deshabilitaremos TLS 1.0 nuevamente.

Este script habilita todos los protocolos, Servidor y Cliente, excepto SSL v3 para el Cliente.

-Eric Niemiec

(Asegúrese de hacer una copia de seguridad de su registro!)

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 3.0/Client] "Enabled"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/SSL 3.0/Server] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.0/Client] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.0/Client] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.0/Server] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.0/Server] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.1/Client] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.1/Client] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.1/Server] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.1/Server] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.2/Client] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.2/Client] "DisabledByDefault"=dword:00000000 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.2/Server] "Enabled"=dword:00000001 [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.2/Server] "DisabledByDefault"=dword:00000000