abstract class PKCS1 extends PKCS1 (View source)

"PKCS1" (RFC5915) Formatted EC Key Handler

Traits

Generic EC Key Parsing Helper functions

Constants

MODE_ANY

Auto-detect the format

MODE_PEM

Require base64-encoded PEM's be supplied

MODE_DER

Require raw DER's be supplied

Properties

static protected int $format Is the key a base-64 encoded PEM, DER or should it be auto-detected? from  PKCS
static protected bool $childOIDsLoaded Child OIDs loaded from  Common

Methods

static 
requirePEM()

Require base64-encoded PEM's be supplied

from  PKCS
static 
requireDER()

Require raw DER's be supplied

from  PKCS
static 
requireAny()

Accept any format and auto detect the format

from  PKCS
static 
setEncryptionAlgorithm(string $algo)

Sets the default encryption algorithm

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

Break a public or private key down into its constituent components

static string
wrapPrivateKey(string $key, string $type, string $password, array $options = [])

Wrap a private key appropriately

from  PKCS1
static string
wrapPublicKey(string $key, string $type)

Wrap a public key appropriately

from  PKCS1
static 
setImplicitCurve(Base $curve)

Explicitly set the curve

from  Common
static Base|false
loadCurveByParam(array $params)

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

from  Common
static object[]
extractPoint(string $str, Base $curve)

Extract points from a string

from  Common
static 
useSpecifiedCurve()

Use Specified Curve

from  Common
static 
useNamedCurve()

Use Named Curve

from  Common
static string
saveParameters(Base $curve, array $options = [])

Convert EC parameters to the appropriate format

static string
savePrivateKey(Integer $privateKey, Base $curve, array $publicKey, string $password = '', array $options = [])

Convert a private key to the appropriate format.

Details

static requirePEM()

Require base64-encoded PEM's be supplied

static requireDER()

Require raw DER's be supplied

static requireAny()

Accept any format and auto detect the format

This is the default setting

static setEncryptionAlgorithm(string $algo)

Sets the default encryption algorithm

Parameters

string $algo

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

Break a public or private key down into its constituent components

Parameters

string $key
string $password optional

Return Value

array

static protected string wrapPrivateKey(string $key, string $type, string $password, array $options = [])

Wrap a private key appropriately

Parameters

string $key
string $type
string $password
array $options optional

Return Value

string

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

Wrap a public key appropriately

Parameters

string $key
string $type

Return Value

string

static setImplicitCurve(Base $curve)

Explicitly set the curve

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

Parameters

Base $curve

static protected Base|false loadCurveByParam(array $params)

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

Parameters

array $params

Return Value

Base|false

static object[] extractPoint(string $str, Base $curve)

Extract points from a string

Supports both compressed and uncompressed points

Parameters

string $str
Base $curve

Return Value

object[]

static useSpecifiedCurve()

Use Specified Curve

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

static useNamedCurve()

Use Named Curve

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

static string saveParameters(Base $curve, array $options = [])

Convert EC parameters to the appropriate format

Parameters

Base $curve
array $options

Return Value

string

static string savePrivateKey(Integer $privateKey, Base $curve, array $publicKey, string $password = '', array $options = [])

Convert a private key to the appropriate format.

Parameters

Integer $privateKey
Base $curve
array $publicKey
string $password optional
array $options optional

Return Value

string