[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent/ -> Identity.php (summary)

Pure-PHP ssh-agent client. PHP version 5

Author: Jim Wigginton
Copyright: 2009 Jim Wigginton
License: http://www.opensource.org/licenses/mit-license.html MIT License
Link: http://phpseclib.sourceforge.net
File Size: 230 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Identity:: (8 methods):
  __construct()
  setPublicKey()
  setPublicKeyBlob()
  getPublicKey()
  setSignatureMode()
  setHash()
  sign()
  _string_shift()


Class: Identity  - X-Ref

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.

__construct($fsock)   X-Ref
Default Constructor.

return: \phpseclib\System\SSH\Agent\Identity
param: resource $fsock

setPublicKey($key)   X-Ref
Set Public Key

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

param: \phpseclib\Crypt\RSA $key

setPublicKeyBlob($key_blob)   X-Ref
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.

param: string $key_blob

getPublicKey($format = null)   X-Ref
Get Public Key

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

return: mixed
param: int $format optional

setSignatureMode($mode)   X-Ref
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

param: int $mode

setHash($hash)   X-Ref
Set Hash

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

param: string $hash

sign($message)   X-Ref
Create a signature

See "2.6.2 Protocol 2 private key signature request"

return: string
param: string $message

_string_shift(&$string, $index = 1)   X-Ref
String Shift

Inspired by array_shift

return: string
param: string $string
param: int $index