Error connecting with ssl eof was observed that violates the protocol

My platform is this OS X Yosemite 10.10.5 newest Indy (10.6.2.0, download 2016 March 13 - Indy10_5346.zip) Lazarus 1.4.4 Concerning OpenSSL versions I have tried: HomeBrew OpenSSL installed lik...

My platform is this

  • OS X Yosemite 10.10.5
  • newest Indy (10.6.2.0, download 2016 March 13 — Indy10_5346.zip)
  • Lazarus 1.4.4

Concerning OpenSSL versions I have tried:

  • HomeBrew OpenSSL installed like this: «brew install openssl
    —universal»
  • Built-in (0.9.8) OS X supplied in /usr/lib/

I am getting error:

EIdOSSLConnecError Error connecting with SSL — EOF was observed that
violates the protocol

In file Protocols/IdSSLOpenSSLHeaders.pas at line 19418

However, as I am using newest of everything — why am I be getting this error?

(Happens in call to OpenEncodedConnection)

Here’s how I setup my Indy HTTP client OpenSSL handler:

FIOHandlerOpenSSL := TIdSSLIOHandlerSocketOpenSSL.Create;
FIOHandlerOpenSSL.SSLOptions.SSLVersions := [sslvSSLv23,sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2]
FIOHandlerOpenSSL.Mode := sslmClient;
FIOHandlerOpenSSL.VerifyMode := [];
FIOHandlerOpenSSL.VerifyDepth := 0;

asked Mar 14, 2016 at 12:23

Tom's user avatar

TomTom

3,5659 gold badges69 silver badges122 bronze badges

10

EOF means the connection was closed unexpectedly, in this case during the handshake. You are enabling multiple SSLVersions, which means Indy will use SSLv23 internally to connect. That will only work if the server is using SSLv23 to listen, thus allowing the client and server to negotiate a compatible SSL/TLS version. If the server is using a specific SSL/TLS version instead of SSLv23, SSLv23 will not work on the client side. You would have to use the same specific SSL/TLS version on the client side to match.

answered Mar 14, 2016 at 16:02

Remy Lebeau's user avatar

Remy LebeauRemy Lebeau

536k30 gold badges444 silver badges750 bronze badges

9

Another cause of this problem can be a timeout.

After analysis it was finally identified the problem was due to a timeout in milliseconds, rather than seconds. Once fixed, the problem resolved itself.

answered Mar 5, 2020 at 5:29

Jeremy Thompson's user avatar

Jeremy ThompsonJeremy Thompson

59.8k32 gold badges184 silver badges308 bronze badges

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Open

jfgreco opened this issue

May 2, 2018

· 2 comments

Comments

@jfgreco

raised exception class EIdOSSLConnectError with message ‘Error connecting with SSL. EOF was observed that violates the protocol’.

My application is raising the above error. I can’t seem to find what exactly is causing it. We are using Indy to make the connection.

@rpottsoh

Are you using Windows 7? I have come across similar symptoms when dealing with REST and GitHub. Please review this comment that I posted in exercism/windows-installer#33. For me, the upshot was that Windows is trying to use an older version of TLS (likely 1.0) and the REST server doesn’t support that version. My comment contains instructions from Microsoft on how to update settings in the registry to allow Windows to support newer versions of TLS.

Disclaimer: I am not using any code from this REPO. My experience stems from using the REST Client libraries provided by Delphi 10.2.x.

I hope there is some value for you in this, I just re-read your original comment, your error message is different than what I dealt with recently…

@cypherpunks03

0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 51

1

19.07.2016, 14:19. Показов 5452. Ответов 14


Драститя ребята, мне нужна помощь.
Написал код который конеектится к сайту https и парсит его страницу, страницу гугла он парсит, а вот страницу этого сайта https://www.csgozone.net/ — нет. Файлы libeay32.dll и ssleay32.dll в папке с проектом. В synapse не пишет ничего, а вот в Indy пишет вот это «Socket Error # 10054 Connection reset by peer.» либо вот это «Error connecting with SSL. EOF was observed that violates the protocol».
Как можно сделать так, что бы он кооннектился не к ip сайта, а к самому сайту www.csgozone.net:443?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

19.07.2016, 14:19

14

31 / 30 / 16

Регистрация: 08.07.2015

Сообщений: 137

20.07.2016, 17:50

2

Код в студию.



0



Nekich

0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 51

20.07.2016, 21:59

 [ТС]

3

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
unit Unit1;
 
interface
 
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, IdIOHandler,
  IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL, IdBaseComponent,
  IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, IdException;
 
type
  TForm1 = class(TForm)
    IdHTTP1: TIdHTTP;
    IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.Button1Click(Sender: TObject);
begin
//idHTTP1 := TIdHTTP.Create(nil);
idHttp1.Request.UserAgent:='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36';
idHTTP1.Request.Connection:='keep-alive';
idHTTP1.Request.CustomHeaders.Add('Upgrade-Insecure-Requests: 1');
idHTTP1.Request.Accept:='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
idHTTP1.Request.CustomHeaders.Add('DNT: 1');
idHTTP1.Request.Host:='www.csgozone.net';
idHTTP1.Request.Referer:='https://www.csgozone.net/';
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method := sslvSSLv23;
 
try
 Memo1.Text:=idHTTP1.GET('https://www.csgozone.net/');
except on E:Exception do
begin
 memo1.Lines.Add(E.message);
end;
end;
 
end;
 
end.

Добавлено через 40 секунд
IdSSLIOHandlerSocketOpenSSL1 подключен в idHTTP1



0



31 / 30 / 16

Регистрация: 08.07.2015

Сообщений: 137

21.07.2016, 00:04

4

Используй Synapse, там все проще.



0



AllFree

Заблокирован

21.07.2016, 13:56

5

У меня Ваш код работает совершенно корректно, никаких ошибок. Попробуйте обновить библиотеки libeay.dll и ssleay32.dll, а по возможности, и всю Indy. Скачивать отсюда: https://indy.fulgan.com

Добавлено через 1 минуту

Цитата
Сообщение от Develop_WS
Посмотреть сообщение

Используй Synapse, там все проще.

Ни фига не проще. Редиректы нужно обрабатывать ручками, заголовки выставлять вручную, всё вручную.



0



0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 51

21.07.2016, 16:29

 [ТС]

6

AllFree, Поставил новые dll, выдает ошибку «Error connecting with SSL.
EOF was observed that violates the protocol», Indy версия 10.6.2.5311



0



AllFree

Заблокирован

21.07.2016, 18:54

7

Не знаю, друг мой, не знаю. У меня те же параметры и версия Indy, но всё работает.
Очевидно, проблема не в Indy.



0



31 / 30 / 16

Регистрация: 08.07.2015

Сообщений: 137

21.07.2016, 20:07

8

В httpsend есть встроенный модуль для работы с редеректами.



0



0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 51

21.07.2016, 21:27

 [ТС]

9

AllFree, А скинь свой проект с dll



0



AllFree

Заблокирован

21.07.2016, 21:56

10

Пожалуйста.



1



0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 51

21.07.2016, 22:15

 [ТС]

11

AllFree, Хмм, пишет ошибку «Socket Error # 10054
Connection reset by peer.», скорее всего дело в версиях delphi, у тебя стоит 7, а у меня RAD Studio 10 Seattle

Добавлено через 4 минуты
Главное выдает только эту ошибку, другую не выдает, как раньше



0



AllFree

Заблокирован

21.07.2016, 22:41

12

Дело вовсе не в делфях. Возможно, какие-то косяки с сетью.
А скомпилированный пример работает?



0



0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 51

21.07.2016, 22:59

 [ТС]

13

AllFree, Брандмауэр отключал, я еще твою программу не запускал, потом запущу



0



AllFree

Заблокирован

21.07.2016, 23:01

14

Цитата
Сообщение от Nekich
Посмотреть сообщение

потом запущу

Ок, всё понятно.



0



0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 51

21.07.2016, 23:11

 [ТС]

15

AllFree, Запустил, вижу, спарсило страницу, эхх, жалко что у меня не работает

Добавлено через 1 минуту
AllFree, Не на тот ip отправляет, щас исправлю и потестю

Добавлено через 1 минуту
Отправляет почему то на этот ip 209.85.233.214, а должно на этот 173.194.222.214

Добавлено через 1 минуту
Даже не знаю как подменить ip



0



8 hours ago, david_navigator said:

If you mean the version numbers of libeay32.dll & ssleay32.dll, then they’re 1.0.1.3 (1.0.1c) — dated 27/01/2014 !!!

Yes, I do, and that is a VERY old version of OpenSSL, you need to upgrade.  Indy currently supports up to 1.0.2u dated 21/12/2019, which you can find at https://github.com/IndySockets/OpenSSL-Binaries/  Work on supporting 1.1.x is in progress: https://github.com/IndySockets/Indy/pull/299

8 hours ago, david_navigator said:

SSLOptions.Method := sslvTLSv1;

The Method property is deprecated, you should be using the SSLVersions property instead.

TLS 1.0 has been (almost) completely phased out of modern servers.  Most modern servers support, if not require, TLS 1.2, so that really should be your minimum going forward nowadays.  You should also have TLS 1.1 enabled as a fallback, just in case, but even that is being phased out as well.

To enable multiple TLS versions with the Method property, you would have to set it to sslvSSLv23, which will set the SSLVersions property to all SSL/TLS versions supported by Indy (including SSL 2.0, SSL 3.0, and TLS 1.x), but it is better to use the SSLVersions property directly (ie, don’t enable SSL 2.0 and 3.0 anymore), eg:

SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];

Having multiple TLS versions enabled at a time will allow OpenSSL to negotiate the highest version that both client and server support.

That being said, on a side note, you do not need to assign ANY of the following SSLIOHandler properties, as Indy handles them internally for you:

8 hours ago, david_navigator said:

      with IdSSLIOHandlerSocketOpenSSL1 do
      begin
        ...
        Destination := format('%s:%s', [EditServerHost.text, EditPort.text]); // 'imap.gmail.com:993';
        Host := EditServerHost.text;
        ...
        Port := strtoint(EditPort.text);
        DefaultPort := 0;
        ...
      end;

Setup the necessary Host/Port only in the client component, ie TIdIMAP4.  The Connect() method will then copy them into the IOHandler as needed.


Edited October 22, 2021 by Remy Lebeau

I’m trying to get data from the website. https://exergy.skmenergy.comHere’s my building code and the component.

FHttp := TIdHTTP.Create(nil);
  FSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  FSSLIOHandler.MaxLineAction := maException;
  FSSLIOHandler.SSLOptions.Method := sslvSSLv23;
  FSSLIOHandler.SSLOptions.Mode := sslmUnassigned;
  FSSLIOHandler.SSLOptions.SSLVersions := [sslvSSLv2, sslvSSLv3, sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];

FCookie := TIdCookieManager.Create(nil);

with FHttp do
begin
IOHandler := FSSLIOHandler;
CookieManager := FCookie;
AllowCookies := True;
HandleRedirects := True;
Request.BasicAuthentication := True;
if StrToBoolDef(FParam.Items['ProxyUse'], True) = True then
begin
ProxyParams.ProxyPort := StrToInt(FParam.Items['Port']);
ProxyParams.ProxyServer := FParam.Items['Server'];
ProxyParams.ProxyUsername := FParam.Items['Login'];
ProxyParams.ProxyPassword := FParam.Items['ProxyPassword'];
end;
ReadTimeout := 100000000;
end;

But after the call.

FHTTP.Get('https://exergy.skmenergy.com);

I’m making a mistake.
Error connecting with ssl. eof was observed that violates the protocol.What am I doing wrong?

Files libeay32.dll and ssleay32.dll We’re close. Their versions are quite new.1.1.0.4) Versions Embarcadero® RAD Studio 10.2 Version 25.0.29039.2004

Разобрался такая ошибка возникает из-за путаницы сертификатов!

APN сертификат на сайте конечно надо заводить от девелопера, но это у меня и так было.

А вот в чем траблы были.

В связке ключей валялись сертификаты пушей моих экспериментов, но только по дате их отличишь.

Поэтому на всякий случай удалил ВСЕ сертификаты PUSH, тут же все еще на маке зашел в сафари

и скачал APN сертификат *.cer с сайта developer.apple.

Кликаем мышкой на этом сертификате и он отображается в связке ключей.

Затем находим ветку PUSH, открываем ее, ОБЕ строчки выделяем и сохраняем в MyPush.p12, пароль не нужен.

Далее уже на винде, утилитой ссл генерим pem файл

openssl pkcs12 -in MyPush.p12 -out MyPush.pem -nodes

жмем энтер и никаких паролей.

Далее в проекте делфи в SSLHandler заполняем что и гонсалес показал и cer и key указываем MyPush.pem.

Я потратил много времени на файлы и версии опенссл libeay32.dll и ssleay32.dll…но это НЕ ТО !!!

По прежнему все просто ложите в папку проекта эти файлы и не выносите мозг никому Wow64 или System32…или 0.9.8m,d,k? и т.п. бредом.

Давно, но успешно раньше использовал отправку почты после бэкапов. Сейчас возвращаюсь к ПО последней версии Cobian11 проверяю работу отправки через яндекс:
ОС Win10Corp, антивиря нет, брандмауэр добавил правила на входящие для портов 465/587 и просто пытался вырубить, cmd telnet клиент читает нормально smtp.yandex.ru 465/587.
указаны общие адрес отправителя, smtp.yandex.ru, 465/587, получатель, аутентификация логин/пароль.
Далее SSL, в нем думаю и проблема:
первый вариант при настройках поддерживает TLS, SSLv3, SSL, без подписи, использовать прокси-сервер:
Идёт проверка…
ERR Невозможно отправить журналы: Error connecting with SSL.
EOF was observed that violates the protocol
ERR Операция завершена с ошибками

второй вариант при настройках рекомендует TLS, SSLv3, авто,двусторонний, не исп прокси:
Идёт проверка…
Подключено к SMTP-серверу smtp.yandex.ru: 465
Отключено от SMTP-сервера
ERR Невозможно отправить журналы: Read timed out.
ERR Операция завершена с ошибками

Еще пробовал играться с различными комбинациями, так и не смог заставить работать.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Error connecting with ssl delphi
  • Error connecting usbasp 3 ch341a
  • Error connecting to update server
  • Error connecting to tor tails что делать
  • Error connecting to the server pgadmin

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии