Class Horde_Crypt_smime

Description

Horde_Crypt_smime:: provides a framework for Horde applications to interact with the OpenSSL library and implement S/MIME.

$Horde: framework/Crypt/Crypt/smime.php,v 1.49.2.25 2011-01-14 14:41:08 jan Exp $

Copyright 2002-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Located in /Crypt/Crypt/smime.php (line 19)

Horde_Crypt
   |
   --Horde_Crypt_smime
Variable Summary
 array $_oids
Method Summary
 Horde_Crypt_smime Horde_Crypt_smime (array $params)
 string certToHTML (string $cert)
 boolean checkForOpenSSL ()
 string decrypt (string $text, [array $params = array()])
 string encrypt (string $text, [array $params = array()])
 MIME_Part encryptMIMEPart (MIME_Part $mime_part, [array $params = array()])
 string extractSignedContents (string $data, string $sslpath)
 mixed getEmailFromKey (string $key)
 array parseCert (string $cert)
 stdClass parsePKCS12Data ( $pkcs12, array $params, string $text)
 MIME_Part signAndEncryptMIMEPart (MIME_Part $mime_part, [array $sign_params = array()], [array $encrypt_params = array()])
 MIME_Part signMIMEPart (MIME_Part $mime_part, array $params)
 stdClass verify (string $text, mixed $certs)
 boolean verifyPassphrase (string $private_key, string $passphrase)
Variables
array $_oids = array(
'2.5.4.3' => 'CommonName',
'2.5.4.4' => 'Surname',
'2.5.4.6' => 'Country',
'2.5.4.7' => 'Location',
'2.5.4.8' => 'StateOrProvince',
'2.5.4.9' => 'StreetAddress',
'2.5.4.10' => 'Organisation',
'2.5.4.11' => 'OrganisationalUnit',
'2.5.4.12' => 'Title',
'2.5.4.20' => 'TelephoneNumber',
'2.5.4.42' => 'GivenName',

'2.5.29.14' => 'id-ce-subjectKeyIdentifier',

'2.5.29.14' => 'id-ce-subjectKeyIdentifier',
'2.5.29.15' => 'id-ce-keyUsage',
'2.5.29.17' => 'id-ce-subjectAltName',
'2.5.29.19' => 'id-ce-basicConstraints',
'2.5.29.31' => 'id-ce-CRLDistributionPoints',
'2.5.29.32' => 'id-ce-certificatePolicies',
'2.5.29.35' => 'id-ce-authorityKeyIdentifier',
'2.5.29.37' => 'id-ce-extKeyUsage',

'1.2.840.113549.1.9.1' => 'Email',
'1.2.840.113549.1.1.1' => 'RSAEncryption',
'1.2.840.113549.1.1.2' => 'md2WithRSAEncryption',
'1.2.840.113549.1.1.4' => 'md5withRSAEncryption',
'1.2.840.113549.1.1.5' => 'SHA-1WithRSAEncryption',
'1.2.840.10040.4.3' => 'id-dsa-with-sha-1',

'1.3.6.1.5.5.7.3.2' => 'id_kp_clientAuth',

'2.16.840.1.113730.1.1' => 'netscape-cert-type',
'2.16.840.1.113730.1.2' => 'netscape-base-url',
'2.16.840.1.113730.1.3' => 'netscape-revocation-url',
'2.16.840.1.113730.1.4' => 'netscape-ca-revocation-url',
'2.16.840.1.113730.1.7' => 'netscape-cert-renewal-url',
'2.16.840.1.113730.1.8' => 'netscape-ca-policy-url',
'2.16.840.1.113730.1.12' => 'netscape-ssl-server-name',
'2.16.840.1.113730.1.13' => 'netscape-comment',
)
(line 26)

Object Identifers to name array.

Inherited Variables

Inherited from Horde_Crypt

Horde_Crypt::$_tempdir
Methods
Constructor Horde_Crypt_smime (line 75)

Constructor.

Horde_Crypt_smime Horde_Crypt_smime (array $params)
  • array $params: Parameter array. 'temp' => Location of temporary directory.
certToHTML (line 565)

Convert a PEM format certificate to readable HTML version

  • return: HTML detailing the certificate.
string certToHTML (string $cert)
  • string $cert: PEM format certificate
checkForOpenSSL (line 1232)

Check for the presence of the OpenSSL extension to PHP.

  • return: Returns true if the openssl extension is available. Returns a PEAR_Error if not.
boolean checkForOpenSSL ()
decrypt (line 140)

Decrypt text via S/MIME.

  • return: The decrypted message. Returns PEAR_Error object on error.
string decrypt (string $text, [array $params = array()])
  • string $text: The text to be smime decrypted.
  • array $params: The parameters needed for decryption. See the individual _decrypt*() functions for the parameter requirements.

Redefinition of:
Horde_Crypt::decrypt()
Decrypt the requested data.
encrypt (line 112)

Encrypt text using S/MIME.

  • return: The encrypted message. Returns PEAR_Error object on error.
string encrypt (string $text, [array $params = array()])
  • string $text: The text to be encrypted.
  • array $params: The parameters needed for encryption. See the individual _encrypt*() functions for the parameter requirements.

Redefinition of:
Horde_Crypt::encrypt()
Encrypt the requested data.
encryptMIMEPart (line 307)

Encrypt a MIME_Part using S/MIME.

  • return: A MIME_Part object that is encrypted. Returns PEAR_Error on error.
MIME_Part encryptMIMEPart (MIME_Part $mime_part, [array $params = array()])
  • MIME_Part $mime_part: The MIME_Part object to encrypt.
  • array $params: The parameters required for encryption.
extractSignedContents (line 237)

Extract the contents from signed S/MIME data.

  • return: The contents embedded in the signed data. Returns PEAR_Error on error.
string extractSignedContents (string $data, string $sslpath)
  • string $data: The signed S/MIME data.
  • string $sslpath: The path to the OpenSSL binary.
getEmailFromKey (line 1247)

Extract the email address from a public key.

  • return: Returns the first email address found, or null if there are none.
mixed getEmailFromKey (string $key)
  • string $key: The public key.
parseCert (line 737)

Extract the contents of a PEM format certificate to an array.

  • return: Array containing all extractable information about the certificate.
array parseCert (string $cert)
  • string $cert: PEM format certificate
parsePKCS12Data (line 1300)

Convert a PKCS 12 encrypted certificate package into a private key, public key, and any additional keys.

  • return: An object. 'private' - The private key in PEM format. 'public' - The public key in PEM format. 'certs' - An array of additional certs. Returns PEAR_Error on error.
stdClass parsePKCS12Data ( $pkcs12, array $params, string $text)
  • string $text: The PKCS 12 data.
  • array $params: The parameters needed for parsing.
     Parameters:
     ===========
     'sslpath' => The path to the OpenSSL binary. (REQUIRED)
     'password' => The password to use to decrypt the data. (Optional)
     'newpassword' => The password to use to encrypt the private key.
                      (Optional)
  • $pkcs12
signAndEncryptMIMEPart (line 541)

Sign and Encrypt a MIME_Part using S/MIME.

  • return: A MIME_Part object that is signed and encrypted. Returns PEAR_Error on error.
MIME_Part signAndEncryptMIMEPart (MIME_Part $mime_part, [array $sign_params = array()], [array $encrypt_params = array()])
  • MIME_Part $mime_part: The MIME_Part object to sign and encrypt.
  • array $sign_params: The parameters required for signing. See _encryptSignature().
  • array $encrypt_params: The parameters required for encryption. See _encryptMessage().
signMIMEPart (line 272)

Sign a MIME_Part using S/MIME.

  • return: A MIME_Part object that is signed. Returns PEAR_Error object on error.
MIME_Part signMIMEPart (MIME_Part $mime_part, array $params)
  • MIME_Part $mime_part: The MIME_Part object to sign.
  • array $params: The parameters required for signing.
verify (line 171)

Verify a signature using via S/MIME.

  • return: Object with the following elements: 'result' -> Returns true on success; PEAR_Error object on error. 'cert' -> The certificate of the signer stored in the message (in PEM format). 'email' -> The email of the signing person.
stdClass verify (string $text, mixed $certs)
  • string $text: The multipart/signed data to be verified.
  • mixed $certs: Either a single or array of root certificates.
verifyPassphrase (line 90)

Verify a passphrase for a given private key.

  • return: Returns true on valid passphrase, false on invalid passphrase. Returns PEAR_Error on error.
boolean verifyPassphrase (string $private_key, string $passphrase)
  • string $private_key: The user's private key.
  • string $passphrase: The user's passphrase.

Inherited Methods

Inherited From Horde_Crypt

 Horde_Crypt::decrypt()
 Horde_Crypt::encrypt()
 Horde_Crypt::factory()
 Horde_Crypt::requireSecureConnection()
 Horde_Crypt::singleton()

Documentation generated on Sun, 30 Jan 2011 05:21:34 +0000 by phpDocumentor 1.4.3