/** * Break a public or private key down into its constituent components * * @access public * @param string $key * @param string $password optional * @return array */ static function load($key, $password = '') { $components = ['isPublicKey' => strpos($key, 'PUBLIC') !== false]; $key = parent::load($key, $password); if ($key === false) { return false; } $type = isset($key['privateKey']) ? 'private' : 'public'; if ($key[$type . 'KeyAlgorithm']['algorithm'] != '1.2.840.113549.1.1.1') { return false; } $result = $components + PKCS1::load($key[$type . 'Key']); if (isset($key['meta'])) { $result['meta'] = $key['meta']; } return $result; }