sdk_php
sdk_php copied to clipboard
PHP Creating an API context error
Steps to reproduce:
<?php
require __DIR__ . '/vendor/autoload.php';
use bunq\Context\ApiContext;
use bunq\Util\BunqEnumApiEnvironmentType;
$environmentType = BunqEnumApiEnvironmentType::SANDBOX(); // Can also be BunqEnumApiEnvironmentType::PRODUCTION();
$apiKey = 'asdasdasdasd'; // Replace with your API key
$deviceDescription = "JeraldPC"; // 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);
What should happen:
Create API Context
What happens:
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 D:\laragon\www\bunq\vendor\bunq\sdk_php\src\Security\KeyPair.php:66 Stack trace: #0 D:\laragon\www\bunq\vendor\bunq\sdk_php\src\Context\ApiContext.php(187): bunq\Security\KeyPair::generate() #1 D:\laragon\www\bunq\vendor\bunq\sdk_php\src\Context\ApiContext.php(178): bunq\Context\ApiContext->initializeInstallationContext() #2 D:\laragon\www\bunq\vendor\bunq\sdk_php\src\Context\ApiContext.php(119): bunq\Context\ApiContext->initialize('JeraldPC', Array) #3 D:\laragon\www\bunq\index.php(16): bunq\Context\ApiContext::create(Object(bunq\Util\BunqEnumApiEnvironmentType), 'a6785e1ff4f3964...', 'JeraldPC', Array) #4 {main} thrown in D:\laragon\www\bunq\vendor\bunq\sdk_php\src\Security\KeyPair.php on line 66
Traceback
SDK version and environment
- Tested on 1.14.1
- [check ] Sandbox
- [ ] Production
help, what is my problem here? I already have openSSL enabled in PHP
help, what is my problem here? I already have openSSL enabled in PHP
Hi,
Can you maybe create (and test) a simple PHP-script with only the following contents?
<?php
$config = array(
"digest_alg" => "sha512",
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
);
$opensslKeyPair = openssl_pkey_new($config);
Because it looks like it's failing on this part of the script
Check also this installation info of OpenSSL: https://www.php.net/manual/en/openssl.installation.php
I'm still having hardtime. The libcrypto exist already on my apache and php but still not works.
I'm still having hardtime. The libcrypto exist already on my apache and php but still not works.
Is OpenSSL active and enabled in the PHPinfo output? https://php.tutorials24x7.com/blog/how-to-configure-php-openssl-module-on-windows
And is the Window Environment Variable "OPENSSL_CONF" also set to the location of openssl.conf ? https://seegatesite.com/the-steps-how-to-install-openssl-on-xampp-windows/