Identity
class Identity implements PrivateKey (View source)
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.
Traits
Constants
SSH_AGENT_RSA2_256 |
|
SSH_AGENT_RSA2_512 |
|
Methods
Default Constructor.
Set Public Key
Get Public Key
Sets the hash
Sets the padding
Determines the signature padding mode
Returns the curve
Create a signature
Returns the private key
Sets the password
Details
readBytes(int $length)
Read data
Identity
__construct(resource $fsock)
Default Constructor.
withPublicKey(PublicKey $key)
Set Public Key
Called by \phpseclib3\System\SSH\Agent::requestIdentities()
withPublicKeyBlob(string $key_blob)
Set Public Key
Called by \phpseclib3\System\SSH\Agent::requestIdentities(). The key blob could be extracted from $this->key but this saves a small amount of computation.
getPublicKey(string $type = 'PKCS8')
Get Public Key
Wrapper for $this->key->getPublicKey()
withHash(string $hash)
Sets the hash
withPadding(string $padding)
Sets the padding
Only PKCS1 padding is supported
withSignatureFormat(string $format)
Determines the signature padding mode
Valid values are: ASN1, SSH2, Raw
string|array
getCurve()
Returns the curve
Returns a string if it's a named curve, an array if not
sign($message)
Create a signature
See "2.6.2 Protocol 2 private key signature request"
toString($type, array $options = [])
Returns the private key
withPassword(string|bool $password = false)
Sets the password