PKCS1
extends PKCS1
in package
AbstractYes
"PKCS1" Formatted DH 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
- $format : int
- Is the key a base-64 encoded PEM, DER or should it be auto-detected?
- $defaultEncryptionAlgorithm : string
- Default encryption algorithm
Methods
- 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
- setEncryptionAlgorithm() : mixed
- Sets the default encryption algorithm
- wrapPrivateKey() : string
- Wrap a private key appropriately
- wrapPublicKey() : string
- Wrap a public key appropriately
- 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
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
$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
= 'AES-128-CBC'
Tags
Methods
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(BigInteger $prime, BigInteger $base[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $prime : BigInteger
- $base : BigInteger
- $options : array<string|int, mixed> = []
Tags
Return values
stringsetEncryptionAlgorithm()
Sets the default encryption algorithm
public
static setEncryptionAlgorithm(string $algo) : mixed
Parameters
- $algo : string
Tags
wrapPrivateKey()
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
stringgenerateSymmetricKey()
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