bunq / sdk_php

PHP SDK for bunq API
MIT License
84 stars 54 forks source link

error:02001003:system library:fopen:No such process #159

Closed sankarcn closed 6 years ago

sankarcn commented 6 years ago

Steps to reproduce:

** Note... This might be a config issue on my side. But request you to please help. I am clueless on how to fix this.

  1. I tried to create an installation context based on the advice given. require_once DIR . '/vendor/autoload.php'; use bunq\Context\ApiContext; use bunq\Util\BunqEnumApiEnvironmentType;

$environmentType = BunqEnumApiEnvironmentType::SANDBOX(); // Can also be BunqEnumApiEnvironmentType::PRODUCTION(); $apiKey = 'XXXXXXX'; // Replace with your API key $deviceDescription = 'Testing of BUNQ'; // Replace with your device description $permittedIps = ['0.0.0.0']; // List the real expected IPs of this device or leave empty to use the current IP

$apiContext = ApiContext::create( $environmentType, $apiKey, $deviceDescription, $permittedIps );

BunqContext::loadApiContext($apiContext); $fileName = 'bunq.cfg'; // Replace with your own secure location to store the API context details $apiContext->save($fileName);

What should happen:

  1. Installation Context file should have been generated

What happens:

1.openssl_pkey_new() Line 61 in KeyPair.pho is failing, most likely because it is not able to get the openssl.cnf file.

Traceback

The first line below is an echo I did of openssl_error_string();

error:02001003:system library:fopen:No such process Fatal error: Uncaught bunq\Exception\BunqException: Generating a new private key failed. See "http://php.net/manual/en/function.openssl-pkey-new.php" for more info. in C:\xampp\htdocs\vendor\bunq\sdk_php\src\Security\KeyPair.php:67 Stack trace: #0 C:\xampp\htdocs\vendor\bunq\sdk_php\src\Context\ApiContext.php(143): bunq\Security\KeyPair::generate() #1 C:\xampp\htdocs\vendor\bunq\sdk_php\src\Context\ApiContext.php(134): bunq\Context\ApiContext->initializeInstallationContext() #2 C:\xampp\htdocs\vendor\bunq\sdk_php\src\Context\ApiContext.php(115): bunq\Context\ApiContext->initialize('Testing of BUNQ', Array) #3 C:\xampp\htdocs\CreateContext.php(15): bunq\Context\ApiContext::create(Object(bunq\Util\BunqEnumApiEnvironmentType), '9ffd9b6efcecf02...', 'Testing of BUNQ', Array) #4 {main} thrown in C:\xampp\htdocs\vendor\bunq\sdk_php\src\Security\KeyPair.php on line 67

SDK version and environment

Response id

Extra info:

sankarcn commented 6 years ago

Fixed it by explicitly passing the config path... Getting a 400 error as response from BUNQ now. Will have to debug that...
$opensslConfigPath = "C:/xampp/php/extras/ssl/openssl.cnf"; $opensslKeyPair = openssl_pkey_new([ "config" => $opensslConfigPath, self::FIELD_KEY_ALGORITHM => self::PRIVATE_KEY_ALGORITHM, self::FIELD_KEY_LENGTH => self::PRIVATE_KEY_LENGTH, self::FIELD_KEY_TYPE => OPENSSL_KEYTYPE_RSA