public function getResource() { if (!($resource = openssl_pkey_get_public($this->keyPEM))) { throw new KeyFormatException(sprintf('Fail to convert key into resource: %s', openssl_error_string())); } return $resource; }