mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-04 10:38:12 +01:00
EC: use the correct case up front
This commit is contained in:
parent
7b7d254a6c
commit
e14e9e92ca
@ -161,13 +161,15 @@ abstract class EC extends AsymmetricKey
|
|||||||
$privatekey = new PrivateKey;
|
$privatekey = new PrivateKey;
|
||||||
|
|
||||||
$curveName = $curve;
|
$curveName = $curve;
|
||||||
$curve = '\phpseclib3\Crypt\EC\Curves\\' . $curveName;
|
if (preg_match('#(?:^curve|^ed)\d+$#', $curveName)) {
|
||||||
if (!class_exists($curve)) {
|
|
||||||
$curveName = ucfirst($curveName);
|
$curveName = ucfirst($curveName);
|
||||||
$curve = '\phpseclib3\Crypt\EC\Curves\\' . $curveName;
|
} elseif (substr($curveName, 0, 10) == 'brainpoolp') {
|
||||||
if (!class_exists($curve)) {
|
$curveName = 'brainpoolP' . substr($curveName, 10);
|
||||||
throw new UnsupportedCurveException('Named Curve of ' . $curveName . ' is not supported');
|
}
|
||||||
}
|
$curve = '\phpseclib3\Crypt\EC\Curves\\' . $curveName;
|
||||||
|
|
||||||
|
if (!class_exists($curve)) {
|
||||||
|
throw new UnsupportedCurveException('Named Curve of ' . $curveName . ' is not supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
$reflect = new \ReflectionClass($curve);
|
$reflect = new \ReflectionClass($curve);
|
||||||
|
Loading…
Reference in New Issue
Block a user