PHP Class phpseclib\System\SSH\Agent\Identity

Instantiation should only be performed by \phpseclib\System\SSH\Agent class. This could be thought of as implementing an interface that phpseclib\Crypt\RSA implements. ie. maybe a Net_SSH_Auth_PublicKey interface or something. The methods in this interface would be getPublicKey and sign since those are the methods phpseclib looks for to perform public key authentication.
Author: Jim Wigginton ([email protected])
Exibir arquivo Open project: phpseclib/phpseclib Class Usage Examples

Public Properties

Property Type Description
$fsock resource Socket Resource
$key phpseclib\Crypt\RSA Key Object
$key_blob string Key Blob

Public Methods

Method Description
__construct ( resource $fsock ) : Identity Default Constructor.
getPublicKey ( integer $type = 'PKCS8' ) : mixed Get Public Key
setHash ( string $hash = 'sha1' ) Sets the hash
setPublicKey ( phpseclib\Crypt\RSA $key ) Set Public Key
setPublicKeyBlob ( string $key_blob ) Set Public Key
sign ( string $message, integer $padding = RSA::PADDING_PKCS1 ) : string Create a signature

Method Details

__construct() public method

Default Constructor.
public __construct ( resource $fsock ) : Identity
$fsock resource
return Identity

getPublicKey() public method

Wrapper for $this->key->getPublicKey()
public getPublicKey ( integer $type = 'PKCS8' ) : mixed
$type integer optional
return mixed

setHash() public method

ssh-agent only supports signatures with sha1 hashes but to maintain BC with RSA.php this function exists
public setHash ( string $hash = 'sha1' )
$hash string optional

setPublicKey() public method

Called by \phpseclib\System\SSH\Agent::requestIdentities()
public setPublicKey ( phpseclib\Crypt\RSA $key )
$key phpseclib\Crypt\RSA

setPublicKeyBlob() public method

Called by \phpseclib\System\SSH\Agent::requestIdentities(). The key blob could be extracted from $this->key but this saves a small amount of computation.
public setPublicKeyBlob ( string $key_blob )
$key_blob string

sign() public method

See "2.6.2 Protocol 2 private key signature request"
public sign ( string $message, integer $padding = RSA::PADDING_PKCS1 ) : string
$message string
$padding integer optional
return string

Property Details

$fsock public_oe property

Socket Resource
See also: self::sign()
public resource $fsock
return resource

$key public_oe property

Key Object
See also: self::getPublicKey()
public RSA,phpseclib\Crypt $key
return phpseclib\Crypt\RSA

$key_blob public_oe property

Key Blob
See also: self::sign()
public string $key_blob
return string