abstract class PKCS8 extends PKCS8 (View source)

PKCS#8 Formatted RSA Key Handler

Constants

MODE_ANY

Auto-detect the format

MODE_PEM

Require base64-encoded PEM's be supplied

MODE_DER

Require raw DER's be supplied

OID_NAME

OID Name

OID_VALUE

OID Value

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

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  PKCS8
static 
setEncryptionScheme(string $algo)

Sets the default encryption algorithm for PBES2

from  PKCS8
static 
setIterationCount(int $count)

Sets the iteration count

from  PKCS8
static 
setPRF(string $algo)

Sets the PRF for PBES2

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

Break a public or private key down into its constituent components

static string
wrapPrivateKey(string $key, string $attr, mixed $params, string $password, string $oid = null, string $publicKey = '', array $options = [])

Wrap a private key appropriately

from  PKCS8
static string
wrapPublicKey(string $key, mixed $params, string $oid = null)

Wrap a public key appropriately

from  PKCS8
static array
extractEncryptionAlgorithm(string $key)

Returns the encryption parameters used by the key

from  PKCS8
static string
savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, string $password = '', array $options = [])

Convert a private key to the appropriate format.

static string
savePublicKey(BigInteger $n, BigInteger $e, array $options = [])

Convert a public 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 setEncryptionScheme(string $algo)

Sets the default encryption algorithm for PBES2

Parameters

string $algo

static setIterationCount(int $count)

Sets the iteration count

Parameters

int $count

static setPRF(string $algo)

Sets the PRF for PBES2

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 $attr, mixed $params, string $password, string $oid = null, string $publicKey = '', array $options = [])

Wrap a private key appropriately

Parameters

string $key
string $attr
mixed $params
string $password
string $oid optional
string $publicKey optional
array $options optional

Return Value

string

static protected string wrapPublicKey(string $key, mixed $params, string $oid = null)

Wrap a public key appropriately

Parameters

string $key
mixed $params
string $oid

Return Value

string

static array extractEncryptionAlgorithm(string $key)

Returns the encryption parameters used by the key

Parameters

string $key

Return Value

array

static string savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, string $password = '', array $options = [])

Convert a private key to the appropriate format.

Parameters

BigInteger $n
BigInteger $e
BigInteger $d
array $primes
array $exponents
array $coefficients
string $password optional
array $options optional

Return Value

string

static string savePublicKey(BigInteger $n, BigInteger $e, array $options = [])

Convert a public key to the appropriate format

Parameters

BigInteger $n
BigInteger $e
array $options optional

Return Value

string