Identity

Implements\phpseclib3\Crypt\Common\PrivateKey

Pure-PHP ssh-agent client identity object

Instantiation should only be performed by \phpseclib3\System\SSH\Agent class. This could be thought of as implementing an interface that phpseclib3\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 terrafrost@php.net

internal
package

Default

Methods

Default Constructor.

__construct(resource $fsock)

Arguments

$fsock

resource

Returns the curve

getCurve(): string|array

Returns a string if it's a named curve, an array if not

Response

string|array

Get Public Key

getPublicKey(string $type = 'PKCS8'): mixed

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

Arguments

$type

string

optional

Response

mixed

Read data

readBytes(integer $length)
inherited
Throws
\RuntimeException

on connection errors

Arguments

$length

integer

Create a signature

sign(string $message): string

See "2.6.2 Protocol 2 private key signature request"

Throws
\RuntimeException

on connection errors

\phpseclib3\Exception\UnsupportedAlgorithmException

if the algorithm is unsupported

Arguments

$message

string

Response

string

Returns the private key

toString(string $type,array $options = array()): string

Arguments

$type

string

$options

array

optional

Response

string

Sets the hash

withHash(string $hash)

Arguments

$hash

string

Sets the padding

withPadding(string $padding)

Only PKCS1 padding is supported

Arguments

$padding

string

Sets the password

withPassword(string|boolean $password = false): \phpseclib3\System\SSH\Agent\never

Arguments

$password

string|boolean

Response

\phpseclib3\System\SSH\Agent\never

Set Public Key

withPublicKey(\phpseclib3\Crypt\Common\PublicKey $key)

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

Arguments

Set Public Key

withPublicKeyBlob(string $key_blob)

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

Arguments

$key_blob

string

Determines the signature padding mode

withSignatureFormat(string $format)

Valid values are: ASN1, SSH2, Raw

Arguments

$format

string

Constants

SSH_AGENT_RSA2_256

SSH_AGENT_RSA2_256

SSH_AGENT_RSA2_512

SSH_AGENT_RSA2_512

Properties

Key Object

key :\phpseclib3\Crypt\Common\PublicKey

Key Blob

key_blob :string
var
see

Type(s)

string

Socket Resource

fsock :resource
var
see

Type(s)

resource

Signature flags

flags :integer
var
see

Type(s)

integer

Curve Aliases

curveAliases :array
static
var

Type(s)

array