PKCS8
extends PKCS8
in package
PKCS#8 Formatted DSA 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
- OID_NAME = 'id-dsa'
- OID Name
- OID_VALUE = '1.2.840.10040.4.1'
- OID Value
Properties
- $childOIDsLoaded : bool
- Child OIDs loaded
- $format : int
- Is the key a base-64 encoded PEM, DER or should it be auto-detected?
- $defaultEncryptionAlgorithm : string
- Default encryption algorithm
- $defaultEncryptionScheme : string
- Default encryption scheme
- $defaultIterationCount : int
- Default Iteration Count
- $defaultPRF : string
- Default PRF
- $oidsLoaded : bool
- OIDs loaded
Methods
- extractEncryptionAlgorithm() : array<string|int, mixed>
- Returns the encryption parameters used by the key
- 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
- savePrivateKey() : string
- Convert a private key to the appropriate format.
- savePublicKey() : string
- Convert a public key to the appropriate format
- setEncryptionAlgorithm() : mixed
- Sets the default encryption algorithm
- setEncryptionScheme() : mixed
- Sets the default encryption algorithm for PBES2
- setIterationCount() : mixed
- Sets the iteration count
- setPRF() : mixed
- Sets the PRF for PBES2
- wrapPrivateKey() : string
- Wrap a private key appropriately
- wrapPublicKey() : string
- Wrap a public key appropriately
- getPBES1EncryptionObject() : SymmetricKey
- Returns a SymmetricKey object based on a PBES1 $algo
- getPBES1Hash() : string
- Returns a hash based on a PBES1 $algo
- getPBES1KDF() : string
- Returns a KDF baesd on a PBES1 $algo
- getPBES2EncryptionObject() : SymmetricKey
- Returns a SymmetricKey object baesd on a PBES2 $algo
- initialize_static_variables() : mixed
- Initialize static variables
- preParse() : array<string|int, mixed>
- Perform some preliminary parsing of the key
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
OID_NAME
OID Name
public
string
OID_NAME
= 'id-dsa'
Tags
OID_VALUE
OID Value
public
string
OID_VALUE
= '1.2.840.10040.4.1'
Tags
Properties
$childOIDsLoaded
Child OIDs loaded
protected
static bool
$childOIDsLoaded
= false
Tags
$format
Is the key a base-64 encoded PEM, DER or should it be auto-detected?
protected
static int
$format
= self::MODE_ANY
Tags
$defaultEncryptionAlgorithm
Default encryption algorithm
private
static string
$defaultEncryptionAlgorithm
= 'id-PBES2'
Tags
$defaultEncryptionScheme
Default encryption scheme
private
static string
$defaultEncryptionScheme
= 'aes128-CBC-PAD'
Only used when defaultEncryptionAlgorithm is id-PBES2
Tags
$defaultIterationCount
Default Iteration Count
private
static int
$defaultIterationCount
= 2048
Tags
$defaultPRF
Default PRF
private
static string
$defaultPRF
= 'id-hmacWithSHA256'
Only used when defaultEncryptionAlgorithm is id-PBES2
Tags
$oidsLoaded
OIDs loaded
private
static bool
$oidsLoaded
= false
Tags
Methods
extractEncryptionAlgorithm()
Returns the encryption parameters used by the key
public
static extractEncryptionAlgorithm(string $key) : array<string|int, mixed>
Parameters
- $key : string
Return values
array<string|int, mixed>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
savePrivateKey()
Convert a private key to the appropriate format.
public
static savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x[, string $password = '' ][, array<string|int, mixed> $options = [] ]) : string
Parameters
- $p : BigInteger
- $q : BigInteger
- $g : BigInteger
- $y : BigInteger
- $x : BigInteger
- $password : string = ''
-
optional
- $options : array<string|int, mixed> = []
-
optional
Tags
Return values
stringsavePublicKey()
Convert a public key to the appropriate format
public
static savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $p : BigInteger
- $q : BigInteger
- $g : BigInteger
- $y : BigInteger
- $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
setEncryptionScheme()
Sets the default encryption algorithm for PBES2
public
static setEncryptionScheme(string $algo) : mixed
Parameters
- $algo : string
Tags
setIterationCount()
Sets the iteration count
public
static setIterationCount(int $count) : mixed
Parameters
- $count : int
Tags
setPRF()
Sets the PRF for PBES2
public
static setPRF(string $algo) : mixed
Parameters
- $algo : string
Tags
wrapPrivateKey()
Wrap a private key appropriately
protected
static wrapPrivateKey(string $key, string $attr, mixed $params, string $password[, string $oid = null ][, string $publicKey = '' ][, array<string|int, mixed> $options = [] ]) : string
Parameters
- $key : string
- $attr : string
- $params : mixed
- $password : string
- $oid : string = null
-
optional
- $publicKey : string = ''
-
optional
- $options : array<string|int, mixed> = []
-
optional
Tags
Return values
stringwrapPublicKey()
Wrap a public key appropriately
protected
static wrapPublicKey(string $key, mixed $params[, string $oid = null ]) : string
Parameters
- $key : string
- $params : mixed
- $oid : string = null
Tags
Return values
stringgetPBES1EncryptionObject()
Returns a SymmetricKey object based on a PBES1 $algo
private
static getPBES1EncryptionObject(string $algo) : SymmetricKey
Parameters
- $algo : string
Tags
Return values
SymmetricKeygetPBES1Hash()
Returns a hash based on a PBES1 $algo
private
static getPBES1Hash(string $algo) : string
Parameters
- $algo : string
Tags
Return values
stringgetPBES1KDF()
Returns a KDF baesd on a PBES1 $algo
private
static getPBES1KDF(string $algo) : string
Parameters
- $algo : string
Tags
Return values
stringgetPBES2EncryptionObject()
Returns a SymmetricKey object baesd on a PBES2 $algo
private
static getPBES2EncryptionObject(string $algo) : SymmetricKey
Parameters
- $algo : string
Tags
Return values
SymmetricKeyinitialize_static_variables()
Initialize static variables
private
static initialize_static_variables() : mixed
Tags
preParse()
Perform some preliminary parsing of the key
private
static preParse(string &$key) : array<string|int, mixed>
Parameters
- $key : string