mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-11 16:49:42 +01:00
EC/PKCS1: throw exception when trying to load non-strings
This commit is contained in:
parent
094bcbdd97
commit
02fa3b142e
@ -37,6 +37,7 @@ use ParagonIE\ConstantTime\Base64;
|
|||||||
use phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve;
|
use phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve;
|
||||||
use phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve;
|
use phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve;
|
||||||
use phpseclib3\Exception\UnsupportedCurveException;
|
use phpseclib3\Exception\UnsupportedCurveException;
|
||||||
|
use phpseclib3\Common\Functions\Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "PKCS1" (RFC5915) Formatted EC Key Handler
|
* "PKCS1" (RFC5915) Formatted EC Key Handler
|
||||||
@ -61,6 +62,10 @@ abstract class PKCS1 extends Progenitor
|
|||||||
{
|
{
|
||||||
self::initialize_static_variables();
|
self::initialize_static_variables();
|
||||||
|
|
||||||
|
if (!Strings::is_stringable($key)) {
|
||||||
|
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
||||||
|
}
|
||||||
|
|
||||||
if (strpos($key, 'BEGIN EC PARAMETERS') && strpos($key, 'BEGIN EC PRIVATE KEY')) {
|
if (strpos($key, 'BEGIN EC PARAMETERS') && strpos($key, 'BEGIN EC PRIVATE KEY')) {
|
||||||
$components = [];
|
$components = [];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user