Documentation

PKCS1 extends PKCS1
in package

AbstractYes

PKCS#1 Formatted DSA Key Handler

Tags
author

Jim Wigginton terrafrost@php.net

access

public

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 DSA parameters to the appropriate format
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
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
access

private

$defaultEncryptionAlgorithm

Default encryption algorithm

private static string $defaultEncryptionAlgorithm = 'AES-128-CBC'
Tags
access

private

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
access

public

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
access

public

requireDER()

Require raw DER's be supplied

public static requireDER() : mixed
Tags
access

public

requirePEM()

Require base64-encoded PEM's be supplied

public static requirePEM() : mixed
Tags
access

public

setEncryptionAlgorithm()

Sets the default encryption algorithm

public static setEncryptionAlgorithm(string $algo) : mixed
Parameters
$algo : string
Tags
access

public

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
access

public

Return values
string

wrapPublicKey()

Wrap a public key appropriately

protected static wrapPublicKey(string $key, string $type) : string
Parameters
$key : string
$type : string
Tags
access

public

Return values
string

generateSymmetricKey()

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
access

private

Return values
string

getEncryptionMode()

Returns the mode constant corresponding to the mode string

private static getEncryptionMode(string $mode) : int
Parameters
$mode : string
Tags
access

public

throws
UnexpectedValueException

if the block cipher mode is unsupported

Return values
int

getEncryptionObject()

Returns a cipher object corresponding to a string

private static getEncryptionObject(string $algo) : string
Parameters
$algo : string
Tags
access

public

throws
UnexpectedValueException

if the encryption algorithm is unsupported

Return values
string

        
On this page

Search results