Exemple #1
0
 /**
  * @see VerifyInterface::init
  */
 public function init($algorithm, $path)
 {
     if (false === ($this->key = @file_get_contents($path . '.pubkey'))) {
         throw FileException::lastError();
     }
 }
Exemple #2
0
 /**
  * Signs the Phar using a private key file.
  *
  * @param string $file     The private key file name.
  * @param string $password The private key password.
  *
  * @throws Exception\Exception
  * @throws FileException If the private key file could not be read.
  */
 public function signUsingFile($file, $password = null)
 {
     if (false === is_file($file)) {
         throw FileException::create('The file "%s" does not exist or is not a file.', $file);
     }
     if (false === ($key = @file_get_contents($file))) {
         throw FileException::lastError();
     }
     $this->sign($key, $password);
 }
Exemple #3
0
 /**
  * Seeks to a specific point in the file.
  *
  * @param integer $offset The offset to seek.
  * @param integer $whence The direction.
  *
  * @throws Exception
  * @throws FileException If the file could not be seeked.
  */
 private function seek($offset, $whence = SEEK_SET)
 {
     if (-1 === @fseek($this->handle(), $offset, $whence)) {
         throw FileException::lastError();
     }
 }