\phpseclib\System\SSH\AgentIdentity

Pure-PHP ssh-agent client identity object

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.

Summary

Methods
Properties
Constants
__construct()
setPublicKey()
setPublicKeyBlob()
getPublicKey()
setSignatureMode()
setHash()
sign()
_string_shift()
$key
$key_blob
$fsock
$flags
SSH_AGENT_RSA2_256
SSH_AGENT_RSA2_512
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

SSH_AGENT_RSA2_256

SSH_AGENT_RSA2_256

SSH_AGENT_RSA2_512

SSH_AGENT_RSA2_512

Properties

$key_blob

$key_blob : string

Key Blob

Type

string

$fsock

$fsock : resource

Socket Resource

Type

resource

$flags

$flags : integer

Signature flags

Type

integer

Methods

setPublicKey()

setPublicKey(\phpseclib\Crypt\RSA  $key) 

Set Public Key

Called by \phpseclib\System\SSH\Agent::requestIdentities()

Parameters

\phpseclib\Crypt\RSA $key

setPublicKeyBlob()

setPublicKeyBlob(string  $key_blob) 

Set Public Key

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

Parameters

string $key_blob

getPublicKey()

getPublicKey(integer  $format = null) : mixed

Get Public Key

Wrapper for $this->key->getPublicKey()

Parameters

integer $format

optional

Returns

mixed

setSignatureMode()

setSignatureMode(integer  $mode) 

Set Signature Mode

Doesn't do anything as ssh-agent doesn't let you pick and choose the signature mode. ie. ssh-agent's only supported mode is \phpseclib\Crypt\RSA::SIGNATURE_PKCS1

Parameters

integer $mode

setHash()

setHash(string  $hash) 

Set Hash

ssh-agent doesn't support using hashes for RSA other than SHA1

Parameters

string $hash

sign()

sign(string  $message) : string

Create a signature

See "2.6.2 Protocol 2 private key signature request"

Parameters

string $message

Returns

string

_string_shift()

_string_shift(string  $string, integer  $index = 1) : string

String Shift

Inspired by array_shift

Parameters

string $string
integer $index

Returns

string