Closed sankarcn closed 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
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.
$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:
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: