Skip to content

Commit e615312

Browse files
committed
Fix undefined const OPENSSL_KEYTYPE_EC
1 parent 06cfaa8 commit e615312

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Generator/EcKey/EcKeyGenerator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class EcKeyGenerator implements PrivateKeyGeneratorInterface
3030
*/
3131
public function generatePrivateKey(KeyOption $keyOption)
3232
{
33+
if (\PHP_VERSION_ID < 70100) {
34+
throw new \LogicException('The generation of ECDSA requires a version of PHP >= 7.1');
35+
}
36+
3337
Assert::isInstanceOf($keyOption, EcKeyOption::class);
3438

3539
return $this->generatePrivateKeyFromOpensslOptions(

Generator/EcKey/EcKeyOption.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ class EcKeyOption implements KeyOption
2121

2222
public function __construct($curveName = 'secp384r1')
2323
{
24+
if (\PHP_VERSION_ID < 70100) {
25+
throw new \LogicException('The generation of ECDSA requires a version of PHP >= 7.1');
26+
}
27+
2428
Assert::stringNotEmpty($curveName);
2529
Assert::oneOf($curveName, openssl_get_curve_names(), 'The given curve %s is not supported. Available curves are: %s');
2630

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"php": ">=5.5.0",
3636
"ext-hash": "*",
3737
"ext-openssl": "*",
38+
"lib-openssl": ">=0.9.8",
3839
"webmozart/assert": "^1.0"
3940
},
4041
"require-dev": {

0 commit comments

Comments
 (0)