PuTTY

Extends\phpseclib3\Crypt\Common\Formats\Keys\PuTTY

PuTTY Formatted EC Key Handler

author

Jim Wigginton terrafrost@php.net

package

Default

Methods

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>

Generate a symmetric key for PuTTY v2 keys

generateV2Key(string $password,integer $length): string
static

Arguments

$password

string

$length

integer

Response

string

Generate a symmetric key for PuTTY v3 keys

generateV3Key(string $password,string $flavour,integer $memory,integer $passes,string $salt): array
static

Arguments

$password

string

$flavour

string

$memory

integer

$passes

integer

$salt

string

Response

array

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

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\BaseCurves\Base $curve,array<mixed,\phpseclib3\Math\Common\FiniteField\Integer> $publicKey,string $secret = null,string $password = false,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> $publicKey): string
static

Arguments

$publicKey

array<mixed,\phpseclib3\Math\Common\FiniteField>

Response

string

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

Sets the default version

setVersion(integer $version)
static

Arguments

$version

integer

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 $public,string $private,string $type,string $password,array $options = array()): string
static

Arguments

$public

string

$private

string

$type

string

$password

string

$options

array

optional

Response

string

Wrap a public key appropriately

wrapPublicKey(string $key,string $type): string
static

This is basically the format described in RFC 4716 (https://tools.ietf.org/html/rfc4716)

Arguments

$key

string

$type

string

Response

string

Constants

Public Handler

PUBLIC_HANDLER
var

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

Default version

version :integer
static
var

Type(s)

integer