nemiah / phpFinTS

PHP library to communicate with FinTS/HBCI servers
MIT License
131 stars 40 forks source link

SSL certificate error in CLI mode (Win 10) #372

Closed stevstrong closed 2 years ago

stevstrong commented 2 years ago

Hello,

I have tried to run use the lib in CLI-mode under Windows 10.

What I have done:

As a result, the lib got installed under: C:\Users\test\vendor\nemiah\php-fints

First I filled the options information in init.php, then I tried the example Samples\tanModeAndMediausing following line in a cmd window:

>php -d include_path='C:\Users\test\vendor\nemiah\php-fints\lib' tanModesAndMedia.php

As a result, I ran into this error:

But then I get this one:

SSL error.log

How can I get rid of this error?

Any answer is highly appreciated, thank you in advance.

Philipp91 commented 2 years ago

Side note: You can get rid of that autoload error by creating a project (rather than including from a global vendor directory). Basically you need to put a composer.json with nemiah/php-fints as a dependency in the same directory as tanModesAndMedia.php and then run composer install there, and it will create a vendor directory there.

Philipp91 commented 2 years ago

To make the SSL library in your PHP installation recognize that server's certificate, you need to install the certificate of the root CA that signed it. Most browsers come with a list of builtin root CAs (that's why that URL works in Chrome, for instance), but PHP does not. You can install the most common ones like this: https://stackoverflow.com/a/34883260

stevstrong commented 2 years ago

Thanks a lot for the hints. I managed to solve that, but now I get this one here:

>php tanModesAndMedia.php
debug: > HNHBK:1:3+000000000120+300+0+1'HKIDN:2:2+280:70150000+9999999999+0+0'HKVVB:3:3+0+0+0++1.0'HKTAN:4:6+4+HKIDN'HNHBS:5:1+1'
debug: < HNHBK:1:3+000000000164+300+0+1+0:1'HIRMG:2:2+9050::Die Nachricht enthlt Fehler.+9800::Dialog abgebrochen'HIRMS:3:2:3+9160:5:Pflichtfeld nicht gefunden'HNHBS:4:1+1'
PHP Fatal error:  Uncaught Fhp\Protocol\ServerException: FinTS errors:
9050 (global): Die Nachricht enthält Fehler.
9800 (global): Dialog abgebrochen
9160 (wrt seg 3): Pflichtfeld nicht gefunden (wrt DE 5)
Request segments:
HKVVB:3:3+0+0+0++1.0' in C:\Users\test\vendor\nemiah\php-fints\lib\Fhp\Protocol\ServerException.php:170
Stack trace:
#0 C:\Users\test\vendor\nemiah\php-fints\lib\Fhp\FinTs.php(963): Fhp\Protocol\ServerException::detectAndThrowErrors(Object(Fhp\Protocol\Message), Object(Fhp\Protocol\Message))
#1 C:\Users\test\vendor\nemiah\php-fints\lib\Fhp\FinTs.php(645): Fhp\FinTs->sendMessage(Object(Fhp\Protocol\Message))
#2 C:\Users\test\vendor\nemiah\php-fints\lib\Fhp\FinTs.php(673): Fhp\FinTs->ensureBpdAvailable()
#3 C:\Users\test\vendor\nemiah\php-fints\lib\Fhp\FinTs.php(532): Fhp\FinTs->ensureTanModesAvailable()
#4 C:\Users\test\vendor\nemiah\php-fints\lib\tanModesAndMedia.php(14): Fhp\FinTs->getTanModes()
#5 {main}
  thrown in C:\Users\test\vendor\nemiah\php-fints\lib\Fhp\Protocol\ServerException.php on line 170

What is wrong ?

EDIT

Comparing the stream with one from Jamaica/Hisicus log, I realized that I initially did not give any productName in init.php (and deactivated the corresponding error in validate() function). As soon as I entered a value for productName, the script went through and I could select a TAN mode and a TAN media.

lukas-staab commented 2 years ago

so the issue can be closed?

stevstrong commented 2 years ago

Yes, I will close it, thanks for assistance. Btw, great lib!