Example #1
0
 /**
  * get a CSR from a file upload
  * @param $csrName the name of the file in the $_FILES array
  * @param $testBlacklist check whether the openssl pubkey is suffering
  *                       from the known Debian vulnerability
  * @return CSR_PKCS10 object containing the uploaded CSR if successful
  * @throws FileException if the file transfer was erroneous/incomplete
  */
 public static function receiveUploadedCSR($csrName, $testBlacklist = false)
 {
     /* bubble up exception from here */
     CSRUpload::testFile($csrName);
     /* 'tmpFile' is PHP-generated */
     $fname = $_FILES[$csrName]['tmp_name'];
     $fsize = filesize($fname);
     $fd = fopen($fname, 'r');
     $content = Input::sanitizeBase64(fread($fd, $fsize));
     fclose($fd);
     if ($testBlacklist === true) {
         CSRUpload::testBlacklist($content);
     }
     return new CSR_PKCS10($content);
 }