コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function writeEncryptDictionary(ObjectWriter $objectWriter)
 {
     $objectWriter->startDictionary();
     $objectWriter->writeName('Filter');
     $objectWriter->writeName('Standard');
     $objectWriter->writeName('V');
     $objectWriter->writeNumber($this->getAlgorithm());
     $objectWriter->writeName('R');
     $objectWriter->writeNumber($this->getRevision());
     $objectWriter->writeName('O');
     $objectWriter->writeNumber($this->ownerEntry);
     $objectWriter->writeName('U');
     $objectWriter->writeNumber($this->userEntry);
     $objectWriter->writeName('P');
     if (null === $this->userPermissions) {
         $objectWriter->writeNumber(0);
     } else {
         $objectWriter->writeNumber($this->userPermissions->toInt($this->getRevision()));
     }
     $this->writeAdditionalEncryptDictionaryEntries($objectWriter);
     $objectWriter->endDictionary();
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function createEncryption($userPassword, $ownerPassword = null, Permissions $userPermissions = null)
 {
     return new Pdf16Encryption(md5('test', true), $userPassword, $ownerPassword ?: $userPassword, $userPermissions ?: Permissions::allowNothing());
 }
コード例 #3
0
 public function testAbstractReturnsInvalidKeyLength()
 {
     $this->setExpectedException(UnexpectedValueException::class, 'Key length must be either 40 or 128');
     $this->getAbstractEncryption(100)->__construct('', '', '', Permissions::allowNothing());
 }
コード例 #4
0
ファイル: EncryptionOptions.php プロジェクト: sachsy/BaconPdf
 /**
  * @param string           $userPassword
  * @param string|null      $ownerPassword
  * @param Permissions|null $userPermissions
  */
 public function __construct($userPassword, $ownerPassword = null, Permissions $userPermissions = null)
 {
     $this->userPassword = $userPassword;
     $this->ownerPassword = null !== $ownerPassword ? $ownerPassword : $userPassword;
     $this->userPermissions = null !== $userPermissions ? $userPermissions : Permissions::allowEverything();
 }
コード例 #5
0
ファイル: PermissionsTest.php プロジェクト: sachsy/BaconPdf
 public function testFullPermissions()
 {
     $permissions = Permissions::allowEverything();
     $this->assertSame(60, $permissions->toInt(2));
     $this->assertSame(3900, $permissions->toInt(3));
 }