/** * 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); }
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)); }
/** * @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; }
/** * @expectedException RuntimeException */ public function testSetGroupName() { $file = new TempFile(); $file->setGroupName('nobody'); }