Documentation

Identity
in package
implements PrivateKey uses ReadBytes

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.

Tags
author

Jim Wigginton terrafrost@php.net

access

internal

Table of Contents

Interfaces

PrivateKey
PrivateKey interface

Constants

SSH_AGENT_RSA2_256  = 2
SSH_AGENT_RSA2_512  = 4

Properties

$curveAliases  : array<string|int, mixed>
Curve Aliases
$flags  : int
Signature flags
$fsock  : resource
Socket Resource
$key  : RSA
Key Object
$key_blob  : string
Key Blob

Methods

__construct()  : Identity
Default Constructor.
getCurve()  : string|array<string|int, mixed>
Returns the curve
getPublicKey()  : mixed
Get Public Key
readBytes()  : mixed
Read data
sign()  : string
Create a signature
toString()  : string
Returns the private key
withHash()  : mixed
Sets the hash
withPadding()  : mixed
Sets the padding
withPassword()  : mixed
Sets the password
withPublicKey()  : mixed
Set Public Key
withPublicKeyBlob()  : mixed
Set Public Key
withSignatureFormat()  : mixed
Determines the signature padding mode

Constants

SSH_AGENT_RSA2_256

public mixed SSH_AGENT_RSA2_256 = 2

SSH_AGENT_RSA2_512

public mixed SSH_AGENT_RSA2_512 = 4

Properties

$curveAliases

Curve Aliases

private static array<string|int, mixed> $curveAliases = ['secp256r1' => 'nistp256', 'secp384r1' => 'nistp384', 'secp521r1' => 'nistp521', 'Ed25519' => 'Ed25519']
Tags
access

private

$flags

Signature flags

private int $flags = 0
Tags
access

private

see
self::sign()
see
self::setHash()

$fsock

Socket Resource

private resource $fsock
Tags
access

private

see
self::sign()

$key

Key Object

private RSA $key
Tags
access

private

see
self::getPublicKey()

$key_blob

Key Blob

private string $key_blob
Tags
access

private

see
self::sign()

Methods

__construct()

Default Constructor.

public __construct(resource $fsock) : Identity
Parameters
$fsock : resource
Tags
access

private

Return values
Identity

getCurve()

Returns the curve

public getCurve() : string|array<string|int, mixed>

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

Tags
access

public

Return values
string|array<string|int, mixed>

getPublicKey()

Get Public Key

public getPublicKey([string $type = 'PKCS8' ]) : mixed

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

Parameters
$type : string = 'PKCS8'

optional

Tags
access

public

readBytes()

Read data

public readBytes(int $length) : mixed
Parameters
$length : int
Tags
throws
RuntimeException

on connection errors

access

public

sign()

Create a signature

public sign(string $message) : string

See "2.6.2 Protocol 2 private key signature request"

Parameters
$message : string
Tags
throws
RuntimeException

on connection errors

throws
UnsupportedAlgorithmException

if the algorithm is unsupported

access

public

Return values
string

toString()

Returns the private key

public toString(string $type[, array<string|int, mixed> $options = [] ]) : string
Parameters
$type : string
$options : array<string|int, mixed> = []

optional

Return values
string

withHash()

Sets the hash

public withHash(string $hash) : mixed
Parameters
$hash : string
Tags
access

public

withPadding()

Sets the padding

public withPadding(string $padding) : mixed

Only PKCS1 padding is supported

Parameters
$padding : string
Tags
access

public

withPassword()

Sets the password

public withPassword([string|bool $password = false ]) : mixed
Parameters
$password : string|bool = false
Tags
access

public

withPublicKey()

Set Public Key

public withPublicKey(PublicKey $key) : mixed

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

Parameters
$key : PublicKey
Tags
access

private

withPublicKeyBlob()

Set Public Key

public withPublicKeyBlob(string $key_blob) : mixed

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

Parameters
$key_blob : string
Tags
access

private

withSignatureFormat()

Determines the signature padding mode

public withSignatureFormat(string $format) : mixed

Valid values are: ASN1, SSH2, Raw

Parameters
$format : string
Tags
access

public


        
On this page

Search results