Class OpenSSLCrypt

Description

Signs, encrypts and decrypts data using the openssl extension

Located in /core/security/OpenSSLCrypt.class.php (line 40)

PHP2Go
   |
   --OpenSSLCrypt
Variable Summary
Method Summary
void clearKeys ()
string|bool engineDecrypt (string $data, [string $saveTo = ''])
bool engineDecryptFile (string $inFileName, string $outFileName)
string|bool engineEncrypt (string $data, [string $saveTo = ''])
bool engineEncryptFile (string $inFileName, string $outFileName)
string|bool engineSign (string &$data, [bool $appendSignature = FALSE])
string|bool engineSignFile (string $inFileName, [bool $appendFile = FALSE])
bool engineVerify (string $data, string $signature)
bool engineVerifyFile (string $inFileName, [int $signatureLength = 128])
string getLastError ()
bool setCertificate (string $pathToCertificate)
void setPassPhrase (string $passPhrase)
bool setPrivateKey (string $pathToKey)
resource|bool _getPrivateKey ()
resource|bool _getPublicKey ()
Variables
OpenSSLCertificate $Certificate (line 55)

OpenSSLCertificate object, containing information about the public key

string $certificatePath (line 47)

Path to the public key (certificate) path

string $errorMsg (line 76)

Latest error message (produced by this class)

string $openSSLError (line 83)

Latest internal error (produced by OpenSSL)

string $passPhrase (line 69)

Private key's passphrase

string $privateKeyPath (line 62)

Path to the private key file

resource $privateKeyRes (line 106)

Private key handle

  • access: private
resource $publicKeyRes (line 98)

Public key handle

  • access: private
bool $throwErrors (line 90)

Whether errors must be thrown

Methods
Constructor OpenSSLCrypt (line 113)

Class constructor

OpenSSLCrypt OpenSSLCrypt ()
clearKeys (line 195)

Clear stored keys

void clearKeys ()
engineDecrypt (line 276)

Decrypts data using the configured private key

string|bool engineDecrypt (string $data, [string $saveTo = ''])
  • string $data: Data to decrypt
  • string $saveTo: Optional file where decrypted data must be saved
engineDecryptFile (line 313)

Decrypts the contents of a file, saving the results in another file

bool engineDecryptFile (string $inFileName, string $outFileName)
  • string $inFileName: Input file name
  • string $outFileName: Output file name
engineEncrypt (line 211)

Encrypts data using the public key from the certificate

string|bool engineEncrypt (string $data, [string $saveTo = ''])
  • string $data: Data to encrypt
  • string $saveTo: Optional file where encrypted data must be saved
engineEncryptFile (line 248)

Encrypts the contents of a file, saving the results in another file

bool engineEncryptFile (string $inFileName, string $outFileName)
  • string $inFileName: Input file name
  • string $outFileName: Output file name
engineSign (line 344)

Signs data using the configured private key

The generated signature will be returned. Optionally, this signature can be appended in the end of the original string.

string|bool engineSign (string &$data, [bool $appendSignature = FALSE])
  • string &$data: Data to sign
  • bool $appendSignature: Whether signature must be appended in $data
engineSignFile (line 372)

Signs the contents of a file

string|bool engineSignFile (string $inFileName, [bool $appendFile = FALSE])
  • string $inFileName: Input file name
  • bool $appendFile: Whether to append signature in the end of the file
engineVerify (line 403)

Verifies the validity of the signed value

bool engineVerify (string $data, string $signature)
  • string $data: Signed data to verify
  • string $signature: Signature
engineVerifyFile (line 423)

Verifies the validity of a signed file

bool engineVerifyFile (string $inFileName, [int $signatureLength = 128])
  • string $inFileName: File name
  • int $signatureLength: Length of the signature
getCertificate (line 143)

Get public key's certificate

OpenSSLCertificate &getCertificate ()
getLastError (line 125)

Get last error message

string getLastError ()
getLastInternalError (line 134)

Get last internal error message (OpenSSL errors)

string getLastInternalError ()
setCertificate (line 156)

Set the public key (certificate) path

bool setCertificate (string $pathToCertificate)
  • string $pathToCertificate: File path
setPassPhrase (line 188)

Set key's passphrase

void setPassPhrase (string $passPhrase)
  • string $passPhrase
setPrivateKey (line 173)

Set private key file

bool setPrivateKey (string $pathToKey)
  • string $pathToKey: Key path
_getPrivateKey (line 445)

Extracts the private key from the file whose path was configured through the setPrivateKeyPath() method

resource|bool _getPrivateKey ()
_getPublicKey (line 474)

Extracts the public key from the certificate configured through the setCertificatePath() method

resource|bool _getPublicKey ()

Inherited Methods

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:28:07 -0300 by phpDocumentor 1.3.2