Documentation

PuTTY extends PuTTY
in package
uses Common

AbstractYes

PuTTY Formatted EC Key Handler

Tags
author

Jim Wigginton terrafrost@php.net

access

public

Table of Contents

Constants

PUBLIC_HANDLER  = 'phpseclib3\Crypt\EC\Formats\Keys\OpenSSH'
Public Handler

Properties

$childOIDsLoaded  : bool
Child OIDs loaded
$types  : array<string|int, mixed>
Supported Key Types
$comment  : string
Default comment
$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
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
wrapPublicKey()  : string
Wrap a public key appropriately
encodeParameters()  : string|false
Encode Parameters
generateSymmetricKey()  : string
Generate a symmetric key for PuTTY keys
initialize_static_variables()  : mixed
Initialize static variables

Constants

PUBLIC_HANDLER

Public Handler

public string PUBLIC_HANDLER = 'phpseclib3\Crypt\EC\Formats\Keys\OpenSSH'
Tags
access

private

Properties

$childOIDsLoaded

Child OIDs loaded

protected static bool $childOIDsLoaded = false

$types

Supported Key Types

protected static array<string|int, mixed> $types = ['ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519']
Tags
access

private

$comment

Default comment

private static string $comment = 'phpseclib-generated-key'
Tags
access

private

$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
access

public

Return values
array<string|int, mixed>

savePrivateKey()

Convert a private key to the appropriate format.

public static savePrivateKey(Integer $privateKey, Base $curve, array<string|int, Integer$publicKey[, string $password = false ][, array<string|int, mixed> $options = [] ]) : string
Parameters
$privateKey : Integer
$curve : Base
$publicKey : array<string|int, Integer>
$password : string = false

optional

$options : array<string|int, mixed> = []

optional

Tags
access

public

Return values
string

savePublicKey()

Convert an EC public key to the appropriate format

public static savePublicKey(Base $curve, array<string|int, FiniteField$publicKey) : string
Parameters
$curve : Base
$publicKey : array<string|int, FiniteField>
Tags
access

public

Return values
string

setComment()

Sets the default comment

public static setComment(string $comment) : mixed
Parameters
$comment : string
Tags
access

public

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|false

wrapPrivateKey()

Wrap a private key appropriately

protected static wrapPrivateKey(string $public, string $private, string $type, string $password[, array<string|int, mixed> $options = [] ]) : string
Parameters
$public : string
$private : string
$type : string
$password : string
$options : array<string|int, mixed> = []

optional

Tags
access

private

Return values
string

wrapPublicKey()

Wrap a public key appropriately

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

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

Parameters
$key : string
$type : string
Tags
access

private

Return values
string

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
todo

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

Return values
string|false

generateSymmetricKey()

Generate a symmetric key for PuTTY keys

private static generateSymmetricKey(string $password, int $length) : string
Parameters
$password : string
$length : int
Tags
access

public

Return values
string

initialize_static_variables()

Initialize static variables

private static initialize_static_variables() : mixed

        
On this page

Search results