26 #require_once 'Zend/Crypt/Rsa/Key/Private.php'; 31 #require_once 'Zend/Crypt/Rsa/Key/Public.php'; 72 if (!extension_loaded(
'openssl')) {
73 #require_once 'Zend/Crypt/Rsa/Exception.php'; 79 $this->_hashAlgorithm = OPENSSL_ALGO_SHA1;
89 $this->_passPhrase =
$options[
'passPhrase'];
99 case 'certificateString':
102 case 'certificatePath':
105 case 'hashAlgorithm':
131 if (isset($privateKey)) {
132 $opensslKeyResource = $privateKey->getOpensslKeyResource();
134 $opensslKeyResource = $this->_privateKey->getOpensslKeyResource();
142 return base64_encode($signature);
156 $signature = base64_decode($signature);
173 $function =
'openssl_public_encrypt';
175 $function =
'openssl_private_encrypt';
179 return base64_encode($encrypted);
196 $function =
'openssl_private_decrypt';
198 $function =
'openssl_public_decrypt';
215 if ($configargs !==
null) {
216 if (isset($configargs[
'passPhrase'])) {
217 $passPhrase = $configargs[
'passPhrase'];
218 unset($configargs[
'passPhrase']);
226 #require_once 'Zend/Crypt/Rsa/Exception.php'; 230 openssl_pkey_export(
$resource, $private, $passPhrase);
234 $return =
new ArrayObject(array(
235 'privateKey'=>$privateKey,
236 'publicKey'=>$publicKey
237 ), ArrayObject::ARRAY_AS_PROPS);
246 $this->_pemString =
$value;
249 $this->_publicKey = $this->_privateKey->getPublicKey();
251 $this->_privateKey =
null;
264 $this->_certificateString =
$value;
270 $this->_certificatePath =
$value;
276 switch (strtolower(
$name)) {
278 $this->_hashAlgorithm = OPENSSL_ALGO_MD2;
281 $this->_hashAlgorithm = OPENSSL_ALGO_MD4;
284 $this->_hashAlgorithm = OPENSSL_ALGO_MD5;
287 $this->_hashAlgorithm = OPENSSL_ALGO_SHA1;
290 $this->_hashAlgorithm = OPENSSL_ALGO_DSS1;
326 if (isset(
$config[
'private_key_bits'])) {
327 $configs[
'private_key_bits'] =
$config[
'private_key_bits'];
329 if (isset(
$config[
'privateKeyBits'])) {
330 $configs[
'private_key_bits'] =
$config[
'privateKeyBits'];
332 if (!empty($configs)) {
setCertificateString($value)
decrypt($data, Zend_Crypt_Rsa_Key $key, $format=null)
setOptions(array $options)
setCertificatePath($value)
sign($data, Zend_Crypt_Rsa_Key_Private $privateKey=null, $format=null)
encrypt($data, Zend_Crypt_Rsa_Key $key, $format=null)
__construct(array $options=null)
generateKeys(array $configargs=null)
verifySignature($data, $signature, $format=null)
_parseConfigArgs(array $config=null)
if(!isset($_GET['name'])) $name