PKCS1

Extends\phpseclib3\Crypt\Common\Formats\Keys\PKCS1

"PKCS1" (RFC5915) 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 PKCS#1 keys

generateSymmetricKey(string $password,string $iv,integer $length): string
static

Arguments

$password

string

$iv

string

$length

integer

Response

string

Returns the mode constant corresponding to the mode string

getEncryptionMode(string $mode): integer
static
Throws
\UnexpectedValueException

if the block cipher mode is unsupported

Arguments

$mode

string

Response

integer

Returns a cipher object corresponding to a string

getEncryptionObject(string $algo): string
static
Throws
\UnexpectedValueException

if the encryption algorithm is unsupported

Arguments

$algo

string

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

Arguments

$key

string

$password

string

optional

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

Accept any format and auto detect the format

requireAny()
inheritedstatic

This is the default setting

Require raw DER's be supplied

requireDER()
inheritedstatic

Require base64-encoded PEM's be supplied

requirePEM()
inheritedstatic

Convert EC parameters to the appropriate format

saveParameters(\phpseclib3\Crypt\EC\BaseCurves\Base $curve,array $options = array()): string
static

Arguments

$options

array

Response

string

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 = '',array $options = array()): string
static

Arguments

$secret

string

optional

$password

string

optional

$options

array

optional

Response

string

Sets the default encryption algorithm

setEncryptionAlgorithm(string $algo)
static

Arguments

$algo

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

Arguments

$key

string

$type

string

$password

string

$options

array

optional

Response

string

Wrap a public key appropriately

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

Arguments

$key

string

$type

string

Response

string

Constants

Auto-detect the format

MODE_ANY
inherited

Require base64-encoded PEM's be supplied

MODE_PEM
inherited

Require raw DER's be supplied

MODE_DER
inherited

Properties

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 encryption algorithm

defaultEncryptionAlgorithm :string
static
var

Type(s)

string

Is the key a base-64 encoded PEM, DER or should it be auto-detected?

format :integer
inheritedstatic
var

Type(s)

integer