Esempio n. 1
0
 /**
  * Verify the chain file.
  *
  * @param int $purpose X509_PURPOSE_*
  *
  * @return bool
  */
 public function verify(int $purpose = X509_PURPOSE_ANY) : bool
 {
     $chainFile = new TempFile();
     $chainFile->setContent($this);
     $certificate = $this[0];
     return $certificate->checkPurpose($purpose, [], $chainFile);
 }
Esempio n. 2
0
 public function testSetAndHasPermissions()
 {
     $file = new TempFile();
     # $file->setPermissions(0777);
     $file->setPermissions(File::PERMISSION_OWNER_ALL);
     $this->assertTrue($file->checkPermissions(0700));
     $file->setPermissions(File::PERMISSION_OWNER_ALL | File::PERMISSION_GROUP_READ);
     $this->assertTrue($file->checkPermissions(0740));
     $file->setPermissions(File::PERMISSION_OWNER_ALL | File::PERMISSION_GROUP_READ | File::PERMISSION_GROUP_WRITE | File::PERMISSION_OTHER_READ);
     $this->assertTrue($file->checkPermissions(0764));
 }
Esempio n. 3
0
 /**
  * @param string $mime
  * @param $chain
  *
  * @return bool
  */
 public function verify(string $mime, $chain) : bool
 {
     $inputFileName = new TempFile('smime_signed_');
     $inputFileName->setContent($mime);
     $status = openssl_pkcs7_verify($inputFileName, $this->getFlags(), '/dev/null', [], $chain);
     if (!is_bool($status)) {
         throw new RuntimeException(OpenSSL::getLastError());
     }
     return $status;
 }
Esempio n. 4
0
 /**
  * @expectedException RuntimeException
  */
 public function testSetGroupName()
 {
     $file = new TempFile();
     $file->setGroupName('nobody');
 }