简体   繁体   English

Delphi 7 和 Indy 9.0 连接 SSL 时出错

[英]Delphi 7 and Indy 9.0 Error Connecting SSL

I'm using TIdHTTP component to execute GET command, resulting in above error message:我正在使用TIdHTTP组件执行GET命令,导致上述错误消息:

Request.ContentType := 'text/html';
Request.CustomHeader.Values['Authorization'] := 'Basic '+ TIdEncoderMIME.EncodeString(SPIAKey)+':'TIdEncoderMIME.EncodeString(SAPISecret);

TIdSSLIOHHandlerSocket TIdSSLIOHHandlerSocket

Method - sslvSSLv2方法 - sslvSSLv2

Can someone help me on this?有人可以帮我吗?

NOBODY uses SSL v2.0 or SSL v3.0 anymore, as they are no longer secure. NOBODY不再使用 SSL v2.0 或 SSL v3.0,因为它们不再安全。 You need to use TLS v1.0 at a minimum 1 .至少需要使用 TLS v1.0 1 Indy 9's TIdSSLIOHandlerSocket component supports up to TLS v1.0 max . Indy 9 的TIdSSLIOHandlerSocket组件最高支持 TLS v1.0 max Set the SSLOptions.Method property to sslvTLSv1 for that.为此,将SSLOptions.Method属性设置为sslvTLSv1

1: be aware that websites have slowly been dropping support for TLS v1.0, and major webbrowser vendors are dropping support for TLS v1.0 and v1.1 later this year. 1:请注意,网站已经慢慢放弃对 TLS v1.0 的支持,主要的网络浏览器供应商将在今年晚些时候放弃对 TLS v1.0 和 v1.1 的支持。

To use TLS v1.1 and higher, you need to upgrade to Indy 10, where TIdSSLIOHandlerSocket has been renamed to TIdSSLIOHandlerSocketOpenSSL , and its SSLOptions.Method property has been deprecated in favor of a new SSLOptions.SSLVersions property, which will allow you to enable TLS v1.0, v1.1, and v1.2 at the same time.要使用 TLS v1.1 及更高版本,您需要升级到 Indy 10,其中TIdSSLIOHandlerSocket已重命名为TIdSSLIOHandlerSocketOpenSSL ,并且其SSLOptions.Method属性已被弃用以支持新的SSLOptions.SSLVersions属性,这将允许您启用同时支持 TLS v1.0、v1.1 和 v1.2。


On a side note, you do not need to use the TIdHTTP.Request.CustomHeader property to use Basic authentication.附带说明一下,您不需要使用TIdHTTP.Request.CustomHeader属性来使用Basic身份验证。 TIdHTTP has built-in support for Basic . TIdHTTP内置了对Basic支持。 Simply set the TIdHTTP.Request.BasicAuthentication property to True and then use the TIdHTTP.Request.Username and TIdHTTP.Request.Password properties:只需将TIdHTTP.Request.BasicAuthentication属性设置为 True,然后使用TIdHTTP.Request.UsernameTIdHTTP.Request.Password属性:

Request.ContentType := 'text/html';
Request.BasicAuthentication := True;
Request.Username := SPIAKey;
Request.Password := SAPISecret;

This works in both Indy 9 and 10.这适用于 Indy 9 和 10。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM