OpenSSH

Extends\phpseclib3\Crypt\Common\Formats\Keys\OpenSSH

OpenSSH Formatted EC Key Handler

author

Jim Wigginton terrafrost@php.net

package

Default

Methods

Checks to see if the type is valid

checkType(string $candidate)
static

Arguments

$candidate

string

Encode Parameters

encodeParameters(\phpseclib3\Crypt\EC\BaseCurves\Base $curve,boolean $returnArray = false,array $options = array()): string|false
inheritedstatic
todo

Maybe at some point this could be moved to __toString() for each of the curves?

Arguments

$returnArray

boolean

optional

$options

array

optional

Response

string|false

Extract points from a string

extractPoint(string $str,\phpseclib3\Crypt\EC\BaseCurves\Base $curve): array<mixed,object>
inheritedstatic

Supports both compressed and uncompressed points

Arguments

$str

string

Response

array<mixed,object>

Returns the alias that corresponds to a curve

getAlias(\phpseclib3\Crypt\EC\BaseCurves\Base $curve): string
static

Arguments

Response

string

Initialize static variables

initialize_static_variables()
inheritedstatic

Break a public or private key down into its constituent components

load(string $key,string $password = ''): array
static

$type can be either ssh-dss or ssh-rsa

Arguments

$key

string

$password

string

Response

array

Returns an instance of \phpseclib3\Crypt\EC\BaseCurves\Base based on the curve parameters

loadCurveByParam(array $params): \phpseclib3\Crypt\EC\BaseCurves\Base|false
inheritedstatic

Arguments

$params

array

Response

\phpseclib3\Crypt\EC\BaseCurves\Base|false

Convert a private key to the appropriate format.

savePrivateKey(\phpseclib3\Math\BigInteger $privateKey,\phpseclib3\Crypt\EC\Curves\Ed25519 $curve,array<mixed,\phpseclib3\Math\Common\FiniteField\Integer> $publicKey,string $secret = null,string $password = '',array $options = array()): string
static

Arguments

$secret

string

optional

$password

string

optional

$options

array

optional

Response

string

Convert an EC public key to the appropriate format

savePublicKey(\phpseclib3\Crypt\EC\BaseCurves\Base $curve,array<mixed,\phpseclib3\Math\Common\FiniteField\Integer> $publicKey,array $options = array()): string
static

Arguments

$options

array

optional

Response

string

Toggle between binary and printable keys

setBinaryOutput(boolean $enabled)
static

Printable keys are what are generated by default. These are the ones that go in $HOME/.ssh/authorized_key.

Arguments

$enabled

boolean

Sets the default comment

setComment(string $comment)
static

Arguments

$comment

string

Explicitly set the curve

setImplicitCurve(\phpseclib3\Crypt\EC\BaseCurves\Base $curve)
inheritedstatic

If the key contains an implicit curve phpseclib needs the curve to be explicitly provided

Arguments

Use Named Curve

useNamedCurve()
inheritedstatic

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

Use Specified Curve

useSpecifiedCurve()
inheritedstatic

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

Wrap a private key appropriately

wrapPrivateKey(string $publicKey,string $privateKey,string $password,array $options): string
static

Arguments

$publicKey

string

$privateKey

string

$password

string

$options

array

Response

string

Properties

Supported Key Types

types :array
static
var

Type(s)

array

Curve OIDs

curveOIDs :array
inheritedstatic
var

Type(s)

array

Child OIDs loaded

childOIDsLoaded :boolean
inheritedstatic
var

Type(s)

boolean

Use Named Curves

useNamedCurves :boolean
inheritedstatic
var

Type(s)

boolean

Default comment

comment :string
static
var

Type(s)

string

Binary key flag

binary :boolean
static
var

Type(s)

boolean