Class Crypt_KeyStore_SPI_DefaultKeyStore

Description

Implements interfaces:

Default SPI implemetation.

Default implementation of the service provider interface using mhash, mcrypt, and OpenSSL for cryptographic and PKI functionality and files for storage.

Located in /Crypt/KeyStore/SPI/DefaultKeyStore.php (line 49)


	
			
Class Constant Summary
 CIPHER_3DES = '3DES'
 CIPHER_ARCFOUR = 'ARCFOUR'
 CIPHER_ARCFOUR_IV = 'ARCFOUR_IV'
 CIPHER_BLOWFISH = 'BLOWFISH'
 CIPHER_CAST = 'CAST'
 CIPHER_CRYPT = 'CRYPT'
 CIPHER_DES = 'DES'
 CIPHER_ENIGMA = 'ENIGMA'
 CIPHER_GOST = 'GOST'
 CIPHER_IDEA = 'IDEA'
 CIPHER_LOKI97 = 'LOKI97'
 CIPHER_MARS = 'MARS'
 CIPHER_PANAMA = 'PANAMA'
 CIPHER_RC2 = 'RC2'
 CIPHER_RC6 = 'RC6'
 CIPHER_RIJNDAEL = 'RIJNDAEL'
 CIPHER_SAFER = 'SAFER'
 CIPHER_SAFERPLUS = 'SAFERPLUS'
 CIPHER_SERPENT = 'SERPENT'
 CIPHER_SKIPJACK = 'SKIPJACK'
 CIPHER_THREEWAY = 'THREEWAY'
 CIPHER_TRIPLEDES = 'TRIPLEDES'
 CIPHER_TWOFISH = 'TWOFISH'
 CIPHER_WAKE = 'WAKE'
 CIPHER_XTEA = 'XTEA'
 HASH_ADLER32 = 'ADLER32'
 HASH_CRC32 = 'CRC32'
 HASH_CRC32B = 'CRC32B'
 HASH_GOST = 'GOST'
 HASH_HAVAL128 = 'HAVAL128'
 HASH_HAVAL160 = 'HAVAL160'
 HASH_HAVAL192 = 'HAVAL192'
 HASH_HAVAL256 = 'HAVAL256'
 HASH_MD2 = 'MD2'
 HASH_MD4 = 'MD4'
 HASH_MD5 = 'MD5'
 HASH_RIPEMD160 = 'RIPEMD160'
 HASH_SHA1 = 'SHA1'
 HASH_SHA256 = 'SHA256'
 HASH_TIGER = 'TIGER'
 HASH_TIGER128 = 'TIGER128'
 HASH_TIGER160 = 'TIGER160'
 KEYTYPE_DH = 'DH'
 KEYTYPE_DSA = 'DSA'
 KEYTYPE_RSA = 'RSA'
 MODE_CBC = 'CBC'
 MODE_CFB = 'CFB'
 MODE_ECB = 'ECB'
 MODE_NOFB = 'NOFB'
 MODE_OFB = 'OFB'
 MODE_STREAM = 'STREAM'
 OPT_CERT_DAYS = 'days'
 OPT_CIPHER = 'cipher'
 OPT_DIGEST = 'digest'
 OPT_HASH = 'hash'
 OPT_KEYSIZE = 'keysize'
 OPT_KEYTYPE = 'keytype'
 OPT_MODE = 'mode'
 OPT_SALTSIZE = 'saltsize'
 SIGNATURE_MD2 = 'MD2'
 SIGNATURE_MD4 = 'MD4'
 SIGNATURE_MD5 = 'MD5'
 SIGNATURE_SHA1 = 'SHA1'
Method Summary
array aliases ()
boolean containsAlias (string $alias)
string createCSR (string $alias, [string $password = false], [array $dn = array()], [array $options = array()])
void createSecretKey (string $alias, [array $password = false], [array $options = array()])
string decrypt (string $encData, string $alias, [string $password = false], [array $options = array()])
void deleteEntry (string $alias)
string encrypt (string $data, string $alias, [string $password = false], [array $options = array()])
boolean entryInstanceOf (string $alias, class $entryClazzName)
array getCertificateChain (string $alias)
DateTime getCreationDate (string $alias)
Crypt_KeyStore_Entry getEntry (string $alias, [array $options = false])
string getType ()
Crypt_KeyStore_SPI_DefaultKeyStore __construct ()
void importCertificate (string $cert, string $alias, [string $password = false])
boolean isCertificateEntry (string $alias)
boolean isKeyEntry (string $alias)
void load (string $filename, string $password, [array $options = array()])
string sign (string $data, string $alias, [string $password = false], [array $options = array()])
int size ()
void store (string $filename, string $password, [array $options = array()])
boolean verify (string $data, string $signature, string $alias, [array $options = array()])
Methods
aliases (line 309)

Lists all the alias names of this Crypt_KeyStore.

  • return: array of alias strings
  • access: public
array aliases ()

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::aliases()
Lists all the alias names of this Crypt_KeyStore.
containsAlias (line 326)

Checks if the given alias exists in this Crypt_KeyStore.

  • return: true if the key store contains an entry with the alias, false if not
  • access: public
boolean containsAlias (string $alias)
  • string $alias: the alias of the entry to query

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::containsAlias()
Checks if the given alias exists in this Crypt_KeyStore.
createCSR (line 970)

Creates a new private key and certificate signing request (CSR) for the private key. The CSR is returned for signing.

  • access: public
string createCSR (string $alias, [string $password = false], [array $dn = array()], [array $options = array()])
  • string $alias: alias to store new key/certificate under
  • string $password: password used to encrypt key entry
  • array $dn: distinguished name used to create CSR
  • array $options: key pair/certificate generation options

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::createCSR()
Creates a new private key and certificate signing request (CSR) for the private key. The CSR is returned for signing.
createSecretKey (line 878)

Creates a symmetric secret key from a randomly generated

pass phrase and stores the new key in the key store, protecting it with the password if specified. The pass phrase is a sequence of random hex numbers which is then used to generate the key using a SHA-256 hash and 8-bytes of salt.

  • access: public
void createSecretKey (string $alias, [array $password = false], [array $options = array()])
  • string $alias: the alias the new key will be stored as
  • array $password: [optional] password used to protected key
  • array $options: [optional] key creation options

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::createSecretKey()
Creates a symmetric secret key from a randomly generated
decrypt (line 1239)

Decrypts the data with the key stored with the alias, optionally using the password to decrypt the key.

  • return: the encrypted data
  • access: public
string decrypt (string $encData, string $alias, [string $password = false], [array $options = array()])
  • string $encData: the encrypted data to decrypt
  • string $alias: the alias of the key to use to decrypt
  • string $password: the password to use to decrypt the key
  • array $options: array of decryption options

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::decrypt()
Decrypts the data with the key stored with the alias, optionally using the password to decrypt the key.
deleteEntry (line 338)

Deletes the entry identified by the given alias from this Crypt_KeyStore.

  • access: public
void deleteEntry (string $alias)
  • string $alias: the alias of the entry to delete

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::deleteEntry()
Deletes the entry identified by the given alias from this Crypt_KeyStore.
encrypt (line 1119)

Encrypts the data with the key stored with the alias, optionally using the password to decrypt the key.

  • return: the encrypted data
  • access: public
string encrypt (string $data, string $alias, [string $password = false], [array $options = array()])
  • string $data: the plain text data to encrypt
  • string $alias: the alias of the key to use to encrypt
  • string $password: the password to use to decrypt the key
  • array $options: array of encryption options

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::encrypt()
Encrypts the data with the key stored with the alias, optionally using the password to decrypt the key.
entryInstanceOf (line 353)

Determines if the Crypt_KeyStore Entry for the specified alias is an instance or subclass of the specified entryClass.

  • return: true if entry is instance of the class name, false if not
  • access: public
boolean entryInstanceOf (string $alias, class $entryClazzName)
  • string $alias: the alias of the entry to test
  • class $entryClazzName: the key store entry class name to test

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::entryInstanceOf()
Determines if the Crypt_KeyStore Entry for the specified alias is an instance or subclass of the specified entryClass.
getCertificateAlias (line 371)

Returns the (alias) name of the first Crypt_KeyStore entry whose certificate matches the given certificate.

  • return: the alias of the certificate
  • access: public
Crypt_KeyStore_Certificate getCertificateAlias (string $cert)
  • string $cert: the certificate text

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::getCertificateAlias()
Returns the (alias) name of the first Crypt_KeyStore entry whose certificate matches the given certificate.
getCertificateChain (line 412)

Returns the certificate chain associated with the given alias.

  • return: an array of certificates in the chain, or NULL if the chain does not exist for the the alias
  • access: public
array getCertificateChain (string $alias)
  • string $alias: the alias of the certificate chain

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::getCertificateChain()
Returns the certificate chain associated with the given alias.
getCreationDate (line 438)

Returns the creation date of the entry identified by the given alias.

  • return: the date/time the key was added to the key store
  • access: public
DateTime getCreationDate (string $alias)
  • string $alias: the alias of the entry to retrieve

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::getCreationDate()
Returns the creation date of the entry identified by the given alias.
getEntry (line 457)

Gets a Crypt_KeyStore Entry for the specified alias with the specified protection parameter.

  • access: public
Crypt_KeyStore_Entry getEntry (string $alias, [array $options = false])
  • string $alias: the alias of the entry to retrieve
  • array $options: the password used to decrypt the key

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::getEntry()
Gets a Crypt_KeyStore Entry for the specified alias with the specified protection parameter.
getType (line 589)

Returns the type of this Crypt_KeyStore.

  • return: the type of key store implementation
  • access: public
string getType ()

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::getType()
Returns the type of this Crypt_KeyStore.
Constructor __construct (line 281)

Default, no-argument contructor.

  • access: public
Crypt_KeyStore_SPI_DefaultKeyStore __construct ()
importCertificate (line 1042)

Imports a signed-certificate into the key store assigning the alias to the new entry. If the alias is a pre-existing private key, the certificate must be valid and correspond to the private key. Otherwise, an exception is thrown.

  • access: public
void importCertificate (string $cert, string $alias, [string $password = false])
  • string $cert: the certificate to import
  • string $alias: the alias of the entry to import certificate into
  • string $password: private key password

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::importCertificate()
Imports a signed-certificate into the key store assigning the alias to the new entry. If the alias is a pre-existing private key, the certificate must be valid and correspond to the private key. Otherwise, an exception is thrown.
isCertificateEntry (line 602)

Returns true if the entry identified by the given alias is a Crypt_KeyStore_TrustedCertificateEntry.

  • return: true if entry is a certificate, false if not
  • access: public
boolean isCertificateEntry (string $alias)
  • string $alias: the alias of the entry to test

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::isCertificateEntry()
Returns true if the entry identified by the given alias was created by a call to _setCertificateEntry, or created by a call to _setEntry with a Crypt_KeyStore_TrustedCertificateEntry.
isKeyEntry (line 625)

Returns true if the entry identified by the given alias was is a Crypt_KeyStore_PrivateKeyEntry or a Crypt_KeyStore_SecretKeyEntry.

  • return: true if entry is a key, false if not
  • access: public
boolean isKeyEntry (string $alias)
  • string $alias: the alias of the entry to test

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::isKeyEntry()
Returns true if the entry identified by the given alias was created by a call to _setKeyEntry, or created by a call to _setEntry with a Crypt_KeyStore_PrivateKeyEntry or a Crypt_KeyStore_SecretKeyEntry.
load (line 1476)

Loads this Crypt_KeyStore from the given input stream.

  • access: public
void load (string $filename, string $password, [array $options = array()])
  • string $filename: path and file name of key store file
  • string $password: password used encrypt key store
  • array $options: store options

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::load()
Loads this Crypt_KeyStore from the given input stream.
sign (line 1370)

Signs the data with the private key stored by the specified alias and returns the signature hex-encoded.

  • return: the signature
  • access: public
string sign (string $data, string $alias, [string $password = false], [array $options = array()])
  • string $data: the data to be signed
  • string $alias: the alias of the private key to use for signing
  • string $password: the password to unlock the private key
  • array $options: array of signing options

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::sign()
Signs the data with the private key stored by the specified alias.
size (line 756)

Retrieves the number of entries in this Crypt_KeyStore.

  • return: the number of entries in the Crypt_KeyStore instance
  • access: public
int size ()

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::size()
Retrieves the number of entries in this Crypt_KeyStore.
store (line 1632)

Stores this Crypt_KeyStore to the given output stream, and protects its integrity with the given password.

  • access: public
void store (string $filename, string $password, [array $options = array()])
  • string $filename: path and file name of key store file
  • string $password: password used encrypt key store
  • array $options: store options

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::store()
Stores this Crypt_KeyStore to the given output stream, and protects its integrity with the given password.
verify (line 1423)

Verifies the signature was signed by the private key stored by the specified alias. The signature must be the hex-encoded signature.

  • return: true if signature is valid, false if not
  • access: public
boolean verify (string $data, string $signature, string $alias, [array $options = array()])
  • string $data: the original data to verify signature against
  • string $signature: the hex-encoded signature to verify
  • string $alias: the alias of the private key
  • array $options: array of verifying options

Implementation of:
Crypt_KeyStore_SPI_KeyStoreSPI::verify()
Verifies the signature was signed by the private key stored by the specified alias.
Class Constants
CIPHER_3DES = '3DES' (line 105)

Generic cipher algorithm constants.

CIPHER_ARCFOUR = 'ARCFOUR' (line 107)
CIPHER_ARCFOUR_IV = 'ARCFOUR_IV' (line 106)
CIPHER_BLOWFISH = 'BLOWFISH' (line 108)
CIPHER_CAST = 'CAST' (line 109)
CIPHER_CRYPT = 'CRYPT' (line 110)
CIPHER_DES = 'DES' (line 111)
CIPHER_ENIGMA = 'ENIGMA' (line 112)
CIPHER_GOST = 'GOST' (line 113)
CIPHER_IDEA = 'IDEA' (line 114)
CIPHER_LOKI97 = 'LOKI97' (line 115)
CIPHER_MARS = 'MARS' (line 116)
CIPHER_PANAMA = 'PANAMA' (line 117)
CIPHER_RC2 = 'RC2' (line 119)
CIPHER_RC6 = 'RC6' (line 120)
CIPHER_RIJNDAEL = 'RIJNDAEL' (line 118)
CIPHER_SAFER = 'SAFER' (line 121)
CIPHER_SAFERPLUS = 'SAFERPLUS' (line 122)
CIPHER_SERPENT = 'SERPENT' (line 123)
CIPHER_SKIPJACK = 'SKIPJACK' (line 124)
CIPHER_THREEWAY = 'THREEWAY' (line 125)
CIPHER_TRIPLEDES = 'TRIPLEDES' (line 126)
CIPHER_TWOFISH = 'TWOFISH' (line 127)
CIPHER_WAKE = 'WAKE' (line 128)
CIPHER_XTEA = 'XTEA' (line 129)
HASH_ADLER32 = 'ADLER32' (line 63)

Generic hash algorithm constants.

HASH_CRC32 = 'CRC32' (line 64)
HASH_CRC32B = 'CRC32B' (line 65)
HASH_GOST = 'GOST' (line 66)
HASH_HAVAL128 = 'HAVAL128' (line 67)
HASH_HAVAL160 = 'HAVAL160' (line 68)
HASH_HAVAL192 = 'HAVAL192' (line 69)
HASH_HAVAL256 = 'HAVAL256' (line 70)
HASH_MD2 = 'MD2' (line 71)
HASH_MD4 = 'MD4' (line 72)
HASH_MD5 = 'MD5' (line 73)
HASH_RIPEMD160 = 'RIPEMD160' (line 74)
HASH_SHA1 = 'SHA1' (line 75)
HASH_SHA256 = 'SHA256' (line 76)
HASH_TIGER = 'TIGER' (line 77)
HASH_TIGER128 = 'TIGER128' (line 78)
HASH_TIGER160 = 'TIGER160' (line 79)
KEYTYPE_DH = 'DH' (line 57)
KEYTYPE_DSA = 'DSA' (line 56)
KEYTYPE_RSA = 'RSA' (line 55)

Generic key-type constants.

MODE_CBC = 'CBC' (line 95)
MODE_CFB = 'CFB' (line 96)
MODE_ECB = 'ECB' (line 94)

Generic cipher mode constants.

MODE_NOFB = 'NOFB' (line 98)
MODE_OFB = 'OFB' (line 97)
MODE_STREAM = 'STREAM' (line 99)
OPT_CERT_DAYS = 'days' (line 173)

Option key for the certificate days.

OPT_CIPHER = 'cipher' (line 138)

Option key for the cipher algorithm.

OPT_DIGEST = 'digest' (line 163)

Option key for the message digest/signature algorithm.

OPT_HASH = 'hash' (line 143)

Option key for the hash algorithm.

OPT_KEYSIZE = 'keysize' (line 153)

Option key for the key size.

OPT_KEYTYPE = 'keytype' (line 168)

Option key for the key type.

OPT_MODE = 'mode' (line 148)

Option key for the cipher mode.

OPT_SALTSIZE = 'saltsize' (line 158)

Option key for the salt size.

SIGNATURE_MD2 = 'MD2' (line 88)
SIGNATURE_MD4 = 'MD4' (line 87)
SIGNATURE_MD5 = 'MD5' (line 86)
SIGNATURE_SHA1 = 'SHA1' (line 85)

Generic digest signature constants.

Documentation generated on Tue, 08 Jul 2008 14:52:06 -0500 by phpDocumentor 1.4.2