00001 <?php
00026 require_once 'Zend/Crypt/Rsa/Key.php';
00027
00034 class Zend_Crypt_Rsa_Key_Public extends Zend_Crypt_Rsa_Key
00035 {
00036
00037 protected $_certificateString = null;
00038
00039 public function __construct($string)
00040 {
00041 $this->_parse($string);
00042 }
00043
00048 protected function _parse($string)
00049 {
00050 if (preg_match("/^-----BEGIN CERTIFICATE-----/", $string)) {
00051 $this->_certificateString = $string;
00052 } else {
00053 $this->_pemString = $string;
00054 }
00055 $result = openssl_get_publickey($string);
00056 if (!$result) {
00060 require_once 'Zend/Crypt/Exception.php';
00061 throw new Zend_Crypt_Exception('Unable to load public key');
00062 }
00063
00064
00065 $this->_opensslKeyResource = $result;
00066 $this->_details = openssl_pkey_get_details($this->_opensslKeyResource);
00067 }
00068
00069 public function getCertificate()
00070 {
00071 return $this->_certificateString;
00072 }
00073
00074 }