Agent/Identity: ECDSA -> EC

This commit is contained in:
terrafrost 2020-02-03 00:56:37 -06:00
parent 7387d79a4f
commit cacd08a768

View File

@ -18,7 +18,7 @@ namespace phpseclib3\System\SSH\Agent;
use phpseclib3\Crypt\RSA;
use phpseclib3\Crypt\DSA;
use phpseclib3\Crypt\ECDSA;
use phpseclib3\Crypt\EC;
use phpseclib3\Exception\UnsupportedAlgorithmException;
use phpseclib3\System\SSH\Agent;
use phpseclib3\Common\Functions\Strings;
@ -192,7 +192,7 @@ class Identity implements PrivateKey
throw new UnsupportedAlgorithmException('The only supported hashes for RSA are sha1, sha256 and sha512');
}
}
if ($this->key instanceof ECDSA) {
if ($this->key instanceof EC) {
switch ($this->key->getCurve()) {
case 'secp256r1':
$expectedHash = 'sha256';
@ -247,7 +247,7 @@ class Identity implements PrivateKey
public function withSignatureFormat($format)
{
if ($this->key instanceof RSA) {
throw new UnsupportedAlgorithmException('Only DSA and ECDSA keys support signature format setting');
throw new UnsupportedAlgorithmException('Only DSA and EC keys support signature format setting');
}
if ($format != 'SSH2') {
throw new UnsupportedAlgorithmException('Only SSH2-formatted signatures are currently supported');
@ -266,8 +266,8 @@ class Identity implements PrivateKey
*/
public function getCurve()
{
if (!$this->key instanceof ECDSA) {
throw new UnsupportedAlgorithmException('Only ECDSA keys have curves');
if (!$this->key instanceof EC) {
throw new UnsupportedAlgorithmException('Only EC keys have curves');
}
return $this->key->getCurve();