OpenSSH
extends OpenSSH
in package
uses
Common
OpenSSH Formatted EC Key Handler
Tags
Table of Contents
Properties
- $binary : bool
- Binary key flag
- $childOIDsLoaded : bool
- Child OIDs loaded
- $comment : string
- Default comment
- $types : array<string|int, mixed>
- Supported Key Types
- $curveOIDs : array<string|int, mixed>
- Curve OIDs
- $useNamedCurves : bool
- Use Named Curves
Methods
- extractPoint() : array<string|int, object>
- Extract points from a string
- load() : array<string|int, mixed>
- Break a public or private key down into its constituent components
- savePrivateKey() : string
- Convert a private key to the appropriate format.
- savePublicKey() : string
- Convert an EC public key to the appropriate format
- setBinaryOutput() : mixed
- Toggle between binary and printable keys
- setComment() : mixed
- Sets the default comment
- setImplicitCurve() : mixed
- Explicitly set the curve
- useNamedCurve() : mixed
- Use Named Curve
- useSpecifiedCurve() : mixed
- Use Specified Curve
- loadCurveByParam() : Base|false
- Returns an instance of \phpseclib3\Crypt\EC\BaseCurves\Base based on the curve parameters
- wrapPrivateKey() : string
- Wrap a private key appropriately
- checkType() : mixed
- Checks to see if the type is valid
- encodeParameters() : string|false
- Encode Parameters
- getAlias() : string
- Returns the alias that corresponds to a curve
- initialize_static_variables() : mixed
- Initialize static variables
Properties
$binary
Binary key flag
protected
static bool
$binary
= false
Tags
$childOIDsLoaded
Child OIDs loaded
protected
static bool
$childOIDsLoaded
= false
$comment
Default comment
protected
static string
$comment
= 'phpseclib-generated-key'
Tags
$types
Supported Key Types
protected
static array<string|int, mixed>
$types
= ['ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519']
$curveOIDs
Curve OIDs
private
static array<string|int, mixed>
$curveOIDs
= []
$useNamedCurves
Use Named Curves
private
static bool
$useNamedCurves
= true
Methods
extractPoint()
Extract points from a string
public
static extractPoint(string $str, Base $curve) : array<string|int, object>
Supports both compressed and uncompressed points
Parameters
- $str : string
- $curve : Base
Return values
array<string|int, object>load()
Break a public or private key down into its constituent components
public
static load(string $key[, string $password = '' ]) : array<string|int, mixed>
Parameters
- $key : string
- $password : string = ''
-
optional
Tags
Return values
array<string|int, mixed>savePrivateKey()
Convert a private key to the appropriate format.
public
static savePrivateKey(Integer $privateKey, Ed25519 $curve, array<string|int, Integer> $publicKey[, string $password = '' ][, array<string|int, mixed> $options = [] ]) : string
Parameters
- $privateKey : Integer
- $curve : Ed25519
- $publicKey : array<string|int, Integer>
- $password : string = ''
-
optional
- $options : array<string|int, mixed> = []
-
optional
Tags
Return values
stringsavePublicKey()
Convert an EC public key to the appropriate format
public
static savePublicKey(Base $curve, array<string|int, Integer> $publicKey[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $curve : Base
- $publicKey : array<string|int, Integer>
- $options : array<string|int, mixed> = []
-
optional
Tags
Return values
stringsetBinaryOutput()
Toggle between binary and printable keys
public
static setBinaryOutput(bool $enabled) : mixed
Printable keys are what are generated by default. These are the ones that go in $HOME/.ssh/authorized_key.
Parameters
- $enabled : bool
Tags
setComment()
Sets the default comment
public
static setComment(string $comment) : mixed
Parameters
- $comment : string
Tags
setImplicitCurve()
Explicitly set the curve
public
static setImplicitCurve(Base $curve) : mixed
If the key contains an implicit curve phpseclib needs the curve to be explicitly provided
Parameters
- $curve : Base
useNamedCurve()
Use Named Curve
public
static useNamedCurve() : mixed
A named curve does not include any parameters. It is up to the EC parameters to know what the coefficients, the base points, etc, are from the name of the curve. A named curve is a more concise way of representing a curve
useSpecifiedCurve()
Use Specified Curve
public
static useSpecifiedCurve() : mixed
A specified curve has all the coefficients, the base points, etc, explicitely included. A specified curve is a more verbose way of representing a curve
loadCurveByParam()
Returns an instance of \phpseclib3\Crypt\EC\BaseCurves\Base based on the curve parameters
protected
static loadCurveByParam(array<string|int, mixed> $params) : Base|false
Parameters
- $params : array<string|int, mixed>
Return values
Base|falsewrapPrivateKey()
Wrap a private key appropriately
protected
static wrapPrivateKey(string $publicKey, string $privateKey, string $password, array<string|int, mixed> $options) : string
Parameters
- $publicKey : string
- $privateKey : string
- $password : string
- $options : array<string|int, mixed>
Tags
Return values
stringcheckType()
Checks to see if the type is valid
private
static checkType(string $candidate) : mixed
Parameters
- $candidate : string
Tags
encodeParameters()
Encode Parameters
private
static encodeParameters(Base $curve[, bool $returnArray = false ][, array<string|int, mixed> $options = [] ]) : string|false
Parameters
- $curve : Base
- $returnArray : bool = false
-
optional
- $options : array<string|int, mixed> = []
-
optional
Tags
Return values
string|falsegetAlias()
Returns the alias that corresponds to a curve
private
static getAlias(Base $curve) : string
Parameters
- $curve : Base
Return values
stringinitialize_static_variables()
Initialize static variables
private
static initialize_static_variables() : mixed