PKCS1
extends PKCS1
in package
uses
Common
"PKCS1" (RFC5915) Formatted EC Key Handler
Tags
Table of Contents
Constants
- MODE_ANY = 0
- Auto-detect the format
- MODE_DER = 2
- Require raw DER's be supplied
- MODE_PEM = 1
- Require base64-encoded PEM's be supplied
Properties
- $childOIDsLoaded : bool
- Child OIDs loaded
- $format : int
- Is the key a base-64 encoded PEM, DER or should it be auto-detected?
- $curveOIDs : array<string|int, mixed>
- Curve OIDs
- $defaultEncryptionAlgorithm : string
- Default encryption algorithm
- $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
- requireAny() : mixed
- Accept any format and auto detect the format
- requireDER() : mixed
- Require raw DER's be supplied
- requirePEM() : mixed
- Require base64-encoded PEM's be supplied
- saveParameters() : string
- Convert EC parameters to the appropriate format
- savePrivateKey() : string
- Convert a private key to the appropriate format.
- setEncryptionAlgorithm() : mixed
- Sets the default encryption algorithm
- 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 PKCS#1 keys
- getEncryptionMode() : int
- Returns the mode constant corresponding to the mode string
- getEncryptionObject() : string
- Returns a cipher object corresponding to a string
- initialize_static_variables() : mixed
- Initialize static variables
Constants
MODE_ANY
Auto-detect the format
public
mixed
MODE_ANY
= 0
MODE_DER
Require raw DER's be supplied
public
mixed
MODE_DER
= 2
MODE_PEM
Require base64-encoded PEM's be supplied
public
mixed
MODE_PEM
= 1
Properties
$childOIDsLoaded
Child OIDs loaded
protected
static bool
$childOIDsLoaded
= false
$format
Is the key a base-64 encoded PEM, DER or should it be auto-detected?
protected
static int
$format
= self::MODE_ANY
Tags
$curveOIDs
Curve OIDs
private
static array<string|int, mixed>
$curveOIDs
= []
$defaultEncryptionAlgorithm
Default encryption algorithm
private
static string
$defaultEncryptionAlgorithm
= 'AES-128-CBC'
Tags
$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
Return values
array<string|int, mixed>requireAny()
Accept any format and auto detect the format
public
static requireAny() : mixed
This is the default setting
Tags
requireDER()
Require raw DER's be supplied
public
static requireDER() : mixed
Tags
requirePEM()
Require base64-encoded PEM's be supplied
public
static requirePEM() : mixed
Tags
saveParameters()
Convert EC parameters to the appropriate format
public
static saveParameters(Base $curve[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $curve : Base
- $options : array<string|int, mixed> = []
Tags
Return values
stringsavePrivateKey()
Convert a private key to the appropriate format.
public
static savePrivateKey(Integer $privateKey, Base $curve, array<string|int, Integer> $publicKey[, string $password = '' ][, array<string|int, mixed> $options = [] ]) : string
Parameters
- $privateKey : Integer
- $curve : Base
- $publicKey : array<string|int, Integer>
- $password : string = ''
-
optional
- $options : array<string|int, mixed> = []
-
optional
Tags
Return values
stringsetEncryptionAlgorithm()
Sets the default encryption algorithm
public
static setEncryptionAlgorithm(string $algo) : mixed
Parameters
- $algo : string
Tags
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|falsewrapPrivateKey()
Wrap a private key appropriately
protected
static wrapPrivateKey(string $key, string $type, string $password[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $key : string
- $type : string
- $password : string
- $options : array<string|int, mixed> = []
-
optional
Tags
Return values
stringwrapPublicKey()
Wrap a public key appropriately
protected
static wrapPublicKey(string $key, string $type) : string
Parameters
- $key : string
- $type : string
Tags
Return values
stringencodeParameters()
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
Return values
string|falsegenerateSymmetricKey()
Generate a symmetric key for PKCS#1 keys
private
static generateSymmetricKey(string $password, string $iv, int $length) : string
Parameters
- $password : string
- $iv : string
- $length : int
Tags
Return values
stringgetEncryptionMode()
Returns the mode constant corresponding to the mode string
private
static getEncryptionMode(string $mode) : int
Parameters
- $mode : string
Tags
Return values
intgetEncryptionObject()
Returns a cipher object corresponding to a string
private
static getEncryptionObject(string $algo) : string
Parameters
- $algo : string
Tags
Return values
stringinitialize_static_variables()
Initialize static variables
private
static initialize_static_variables() : mixed