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
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
$flags
Signature flags
private
int
$flags
= 0
Tags
$fsock
Socket Resource
private
resource
$fsock
Tags
$key
Key Object
private
RSA
$key
Tags
$key_blob
Key Blob
private
string
$key_blob
Tags
Methods
__construct()
Default Constructor.
public
__construct(resource $fsock) : Identity
Parameters
- $fsock : resource
Tags
Return values
IdentitygetCurve()
Returns the curve
public
getCurve() : string|array<string|int, mixed>
Returns a string if it's a named curve, an array if not
Tags
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
readBytes()
Read data
public
readBytes(int $length) : mixed
Parameters
- $length : int
Tags
sign()
Create a signature
public
sign(string $message) : string
See "2.6.2 Protocol 2 private key signature request"
Parameters
- $message : string
Tags
Return values
stringtoString()
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
stringwithHash()
Sets the hash
public
withHash(string $hash) : mixed
Parameters
- $hash : string
Tags
withPadding()
Sets the padding
public
withPadding(string $padding) : mixed
Only PKCS1 padding is supported
Parameters
- $padding : string
Tags
withPassword()
Sets the password
public
withPassword([string|bool $password = false ]) : mixed
Parameters
- $password : string|bool = false
Tags
withPublicKey()
Set Public Key
public
withPublicKey(PublicKey $key) : mixed
Called by \phpseclib3\System\SSH\Agent::requestIdentities()
Parameters
- $key : PublicKey
Tags
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
withSignatureFormat()
Determines the signature padding mode
public
withSignatureFormat(string $format) : mixed
Valid values are: ASN1, SSH2, Raw
Parameters
- $format : string