Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Private.php
Go to the documentation of this file.
1 <?php
26 #require_once 'Zend/Crypt/Rsa/Key.php';
27 
35 {
36 
37  protected $_publicKey = null;
38 
39  public function __construct($pemString, $passPhrase = null)
40  {
41  $this->_pemString = $pemString;
42  $this->_parse($passPhrase);
43  }
44 
49  protected function _parse($passPhrase)
50  {
51  $result = openssl_get_privatekey($this->_pemString, $passPhrase);
52  if (!$result) {
56  #require_once 'Zend/Crypt/Exception.php';
57  throw new Zend_Crypt_Exception('Unable to load private key');
58  }
59  $this->_opensslKeyResource = $result;
60  $this->_details = openssl_pkey_get_details($this->_opensslKeyResource);
61  }
62 
63  public function getPublicKey()
64  {
65  if ($this->_publicKey === null) {
69  #require_once 'Zend/Crypt/Rsa/Key/Public.php';
70  $this->_publicKey = new Zend_Crypt_Rsa_Key_Public($this->_details['key']);
71  }
72  return $this->_publicKey;
73  }
74 
75 }
__construct($pemString, $passPhrase=null)
Definition: Private.php:39