Methods summary
public
|
#
__construct( string $phrase = "", string $key = NULL, string $cert = NULL, array $SSLParams = NULL, array $CACert = NULL )
Object constructor
Parameters
- $phrase
string $phrase Passphrase to use with protected key.
- $key
string $key A PEM encoded private key, NULL when creating a new key pair.
- $cert
string $cert A PEM encoded certificate, NULL when creating a new key pair.
- $SSLParams
array $SSLParams Associative array of parameters used when creating a new key pair.
The array is a combination of the Distinquished Name and configargs values. The
array may include the following... 'ssl_key_bits' => '4096', // bit size of
the encryption key 'private_key_type' => OPENSSL_KEYTYPE_RSA, // the openssl
key type 'countryName' => 'US', // distinquished name country
'stateOrProvinceName' => 'Nevada', // distinquished name province
'localityName' => 'Las Vegas', // distinquished name locality
'organizationName' => 'SSLKey', // distinquished name organization
'commonName' => 'localhost', // distinquished name domain 'emailAddress'
=> 'admin@localhost' // distinquished name email
- $CACert
array $CACert Associative array containing a certificate authority parameters used to
sign a new key pair. If NULL then the new key pair will be self signed. The
array must include the following elements... 'certificate' => CA certificate
in PEM format, 'privateKey' => CA private key in PEM format, 'passPhrase'
=> CA passphrase.
|
public
mixed
|
#
decryptPackage( string $package, mixed $envelope, string $phrase = NULL )
Decrypt the sealed package using this SSL key pair.
Decrypt the sealed package using this SSL key pair.
Parameters
- $package
string $package The package to decrypt.
- $envelope
mixed $envelope The envelope for the package.
- $phrase
string $phrase The passphrase to use as the pass phrase for decryption.
Returns
mixed The decrypted package or FALSE if there was an error.
|
public
array
|
#
encryptPackage( mixed $package )
Encrypt a package using this SSL key pair.
Encrypt a package using this SSL key pair.
Parameters
- $package
mixed $package The package to encrypt.
Returns
array An array containing the envelope and encrypted package or NULL if an error
occurs.
|
public static
string
|
#
parsePhrase( string $str, boolean $includeWrapper = FALSE )
Parses the passed string looking for a phrase using PEM style encoding. This
is a custom PEM parameter for SSLKey.
Parses the passed string looking for a phrase using PEM style encoding. This
is a custom PEM parameter for SSLKey.
Parameters
- $str
string $str The string to parse looking for the pass phrase component.
- $includeWrapper
boolean $includeWrapper (optional) Specify if the PEM wrapper should be returned with
the phrase.
Returns
string The discovered pass phrase or NULL if not found.
|
public static
string
|
#
parseCertificate( string $str )
Parses the passed string looking for a certificate.
Parses the passed string looking for a certificate.
Parameters
- $str
string $str The string to parse looking for the certificate component.
Returns
string The discovered certificate or NULL if not found.
|
public static
string
|
#
parsePrivateKey( string $str )
Parses the passed string looking for a private key.
Parses the passed string looking for a private key.
Parameters
- $str
string $str The string to parse looking for the private key component.
Returns
string The discovered private key or NULL if not found.
|
public static
string
|
#
makePhrase( integer $len = 64, boolean $alphanumeric = FALSE )
Creates a random passphrase.
Creates a random passphrase.
Parameters
- $len
integer $len The length of the generated pass phrase.
- $alphanumeric
boolean $alphnumeric Determines if the generated pass phrase includes only alphanumeric
characters.
Returns
string The generated pass phrase.
|
public
|
#
getPrivateKey( )
Retrieve the private key from this instance.
Retrieve the private key from this instance.
|
public
|
#
getCertificate( )
Retrieve the certificate from this instance.
Retrieve the certificate from this instance.
|
public
|
#
getKey( )
Retrieve the PEM encoded key (privateKey + certificate)
Retrieve the PEM encoded key (privateKey + certificate)
|
public
|
#
getFullKey( )
Retrieve a custom PEM encoded key with all needed components for encryption
and decryption.
Retrieve a custom PEM encoded key with all needed components for encryption
and decryption.
|
public
|
#
makeDN( array $sslParams = NULL )
Creates a distinquished name array for SSL certificate generation.
Creates a distinquished name array for SSL certificate generation.
Parameters
- $sslParams
array $sslParams The parameters to use when generating the distinquished name.
|
public
|
#
makeConfigArgs( array $sslParams = NULL )
Creates a configArgs array to be used when creating certificates
Creates a configArgs array to be used when creating certificates
Parameters
- $sslParams
array $sslParams The parameters to use when generating the configArgs.
|
public
|
|