7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
26 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27 * @license http://framework.zend.com/license/new-bsd New BSD License
29 class Zend_Crypt_Rsa_Key implements Countable
34 protected $_pemString = null;
37 * Bits, key string and type of key
41 protected $_details = array();
48 protected $_opensslKeyResource = null;
51 * Retrieves key resource
55 public function getOpensslKeyResource()
57 return $this->_opensslKeyResource;
62 * @throws Zend_Crypt_Exception
64 public function toString()
66 if (!empty($this->_pemString)) {
67 return $this->_pemString;
68 } elseif (!empty($this->_certificateString)) {
69 return $this->_certificateString;
72 * @see Zend_Crypt_Exception
74 require_once 'Zend/Crypt/Exception.php';
75 throw new Zend_Crypt_Exception('No public key string representation is available');
81 public function __toString()
83 return $this->toString();
86 public function count()
88 return $this->_details['bits'];
91 public function getType()
93 return $this->_details['type'];