PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/src/application/libraries/Zend/Crypt/Rsa/Key.php

https://bitbucket.org/masnug/grc276-blog-laravel
PHP | 95 lines | 33 code | 8 blank | 54 comment | 1 complexity | d230ffdb0c74d2247f8b862b74539481 MD5 | raw file
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  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.
  14. *
  15. * @category Zend
  16. * @package Zend_Crypt
  17. * @subpackage Rsa
  18. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: Key.php 23775 2011-03-01 17:25:24Z ralph $
  21. */
  22. /**
  23. * @category Zend
  24. * @package Zend_Crypt
  25. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  26. * @license http://framework.zend.com/license/new-bsd New BSD License
  27. */
  28. class Zend_Crypt_Rsa_Key implements Countable
  29. {
  30. /**
  31. * @var string
  32. */
  33. protected $_pemString = null;
  34. /**
  35. * Bits, key string and type of key
  36. *
  37. * @var array
  38. */
  39. protected $_details = array();
  40. /**
  41. * Key Resource
  42. *
  43. * @var resource
  44. */
  45. protected $_opensslKeyResource = null;
  46. /**
  47. * Retrieves key resource
  48. *
  49. * @return resource
  50. */
  51. public function getOpensslKeyResource()
  52. {
  53. return $this->_opensslKeyResource;
  54. }
  55. /**
  56. * @return string
  57. * @throws Zend_Crypt_Exception
  58. */
  59. public function toString()
  60. {
  61. if (!empty($this->_pemString)) {
  62. return $this->_pemString;
  63. } elseif (!empty($this->_certificateString)) {
  64. return $this->_certificateString;
  65. }
  66. /**
  67. * @see Zend_Crypt_Exception
  68. */
  69. require_once 'Zend/Crypt/Exception.php';
  70. throw new Zend_Crypt_Exception('No public key string representation is available');
  71. }
  72. /**
  73. * @return string
  74. */
  75. public function __toString()
  76. {
  77. return $this->toString();
  78. }
  79. public function count()
  80. {
  81. return $this->_details['bits'];
  82. }
  83. public function getType()
  84. {
  85. return $this->_details['type'];
  86. }
  87. }