mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-02-04 04:48:30 +00:00
Agent/Identity: ECDSA -> EC
This commit is contained in:
parent
7387d79a4f
commit
cacd08a768
@ -18,7 +18,7 @@ namespace phpseclib3\System\SSH\Agent;
|
|||||||
|
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
use phpseclib3\Crypt\DSA;
|
use phpseclib3\Crypt\DSA;
|
||||||
use phpseclib3\Crypt\ECDSA;
|
use phpseclib3\Crypt\EC;
|
||||||
use phpseclib3\Exception\UnsupportedAlgorithmException;
|
use phpseclib3\Exception\UnsupportedAlgorithmException;
|
||||||
use phpseclib3\System\SSH\Agent;
|
use phpseclib3\System\SSH\Agent;
|
||||||
use phpseclib3\Common\Functions\Strings;
|
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');
|
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()) {
|
switch ($this->key->getCurve()) {
|
||||||
case 'secp256r1':
|
case 'secp256r1':
|
||||||
$expectedHash = 'sha256';
|
$expectedHash = 'sha256';
|
||||||
@ -247,7 +247,7 @@ class Identity implements PrivateKey
|
|||||||
public function withSignatureFormat($format)
|
public function withSignatureFormat($format)
|
||||||
{
|
{
|
||||||
if ($this->key instanceof RSA) {
|
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') {
|
if ($format != 'SSH2') {
|
||||||
throw new UnsupportedAlgorithmException('Only SSH2-formatted signatures are currently supported');
|
throw new UnsupportedAlgorithmException('Only SSH2-formatted signatures are currently supported');
|
||||||
@ -266,8 +266,8 @@ class Identity implements PrivateKey
|
|||||||
*/
|
*/
|
||||||
public function getCurve()
|
public function getCurve()
|
||||||
{
|
{
|
||||||
if (!$this->key instanceof ECDSA) {
|
if (!$this->key instanceof EC) {
|
||||||
throw new UnsupportedAlgorithmException('Only ECDSA keys have curves');
|
throw new UnsupportedAlgorithmException('Only EC keys have curves');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->key->getCurve();
|
return $this->key->getCurve();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user