4.13. SSLPrivateKey Class

SSLPrivateKey objects are containers for private key data.

Table 4.655. SSLPrivateKey Class Method Overview

Method

Except?

Description

SSLPrivateKey::constructor()

Y

Creates the SSLPrivateKey object from the filename argument passed.

SSLPrivateKey::destructor()

N

Destroys the SSLPrivateKey object.

SSLPrivateKey::copy()

Y

Copying objects of this class is not supported, an exception will be thrown.

SSLPrivateKey::getType()

N

Returns the algorithm used for the private key.

SSLPrivateKey::getVersion()

N

Returns the version of the private key.

SSLPrivateKey::getBitLength()

N

Returns the bit length of the private key.

SSLPrivateKey::getInfo()

N

Returns a hash of all information for the private key.


4.13.1. SSLPrivateKey::constructor()

Synopsis

Creates the SSLPrivateKey object from the filename argument passed.

Usage
new SSLPrivateKey(filename, [passphrase])
Example
$pkey = new SSLPrivateKey("/etc/keys/key.pem");

Table 4.656. Arguments for SSLPrivateKey::constructor()

Argument

Type

Description

filename

String

The filename of the PEM-encoded private key file

[passphrase]

String

The passphrase required to decrypt the private key


Table 4.657. Return Values for SSLPrivateKey::constructor()

Return Type

Description

Object

The SSLPrivateKey object is returned


Table 4.658. Exceptions thrown by SSLPrivateKey::constructor()

err

desc

SSLPRIVATEKEY-CONSTRUCTOR-ERROR

missing filename argument, can't open file, unable to parse file, etc


4.13.2. SSLPrivateKey::destructor()

Synopsis

Destroys the SSLPrivateKey object.

Usage
delete lvalue
Example
delete $pkey;

Table 4.659. Arguments for SSLPrivateKey::destructor()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.660. Return Values for SSLPrivateKey::destructor()

Return Type

Description

n/a

This method returns no value


4.13.3. SSLPrivateKey::copy()

Synopsis

Copying objects of this class is not supported, an exception will be thrown.

Table 4.661. Exceptions thrown by SSLPrivateKey::copy()

err

desc

SSLPRIVATEKEY-COPY-ERROR

objects of this class may not be copied


4.13.4. SSLPrivateKey::getType()

Synopsis

Returns a string giving the algorithm used for the private key.

Usage
SSLPrivateKey::getType()
Example
$str = $pkey.getType();

Table 4.662. Arguments for SSLPrivateKey::getType()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.663. Return Values for SSLPrivateKey::getType()

Return Type

Description

String

Returns values include: RSA, RSA2, DSA, DSA1, DSA2, DSA3, DSA4, DH, and unknown


4.13.5. SSLPrivateKey::getVersion()

Synopsis

Returns the version of the private key as an integer.

Usage
SSLPrivateKey::getVersion()
Example
$int = $pkey.getVersion();

Table 4.664. Arguments for SSLPrivateKey::getVersion()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.665. Return Values for SSLPrivateKey::getVersion()

Return Type

Description

Integer

The version of the private key.


4.13.6. SSLPrivateKey::getBitLength()

Synopsis

Returns the bit length of the private key.

Usage
SSLPrivateKey::getBitLength()
Example
$int = $pkey.getBitLength();

Table 4.666. Arguments for SSLPrivateKey::getBitLength()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.667. Return Values for SSLPrivateKey::getBitLength()

Return Type

Description

Integer

The bit length of the private key.


4.13.7. SSLPrivateKey::getInfo()

Synopsis

Returns a hash of all information for the private key.

Usage
SSLPrivateKey::getInfo()
Example
$hash = $pkey.getInfo();

Table 4.668. Arguments for SSLPrivateKey::getInfo()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.669. Return Values for SSLPrivateKey::getInfo()

Return Type

Description

Hash

Keys are 'type', 'version', and 'bitLength' corresponding to the algorithm type, the version, and the bit length of the key respectively.