diff --git a/src/Box.php b/src/Box.php index a55dd4511..1300f6759 100644 --- a/src/Box.php +++ b/src/Box.php @@ -41,6 +41,7 @@ use function KevinGH\Box\FileSystem\remove; use KevinGH\Box\PhpScoper\NullScoper; use KevinGH\Box\PhpScoper\WhitelistManipulator; +use function openssl_error_string; use function openssl_pkey_export; use function openssl_pkey_get_details; use function openssl_pkey_get_private; @@ -362,7 +363,7 @@ public function sign(string $key, ?string $password): void $resource = openssl_pkey_get_private($key, (string) $password); - Assertion::isResource($resource, 'Could not retrieve the private key, check that the password is correct.'); + Assertion::notSame(false, $resource, sprintf('Could not retrieve the private key, check that the password is correct. "%s"', openssl_error_string() ?: '')); openssl_pkey_export($resource, $private);