source-class-Com.Tecnick.Pdf.Encrypt.Data

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.
  1: <?php
  2: /**
  3:  * Encrypt.php
  4:  *
  5:  * @since       2008-01-02
  6:  * @category    Library
  7:  * @package     PdfEncrypt
  8:  * @author      Nicola Asuni <info@tecnick.com>
  9:  * @copyright   2011-2015 Nicola Asuni - Tecnick.com LTD
 10:  * @license     http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
 11:  * @link        https://github.com/tecnickcom/tc-lib-pdf-encrypt
 12:  *
 13:  * This file is part of tc-lib-pdf-encrypt software library.
 14:  */
 15: 
 16: namespace Com\Tecnick\Pdf\Encrypt;
 17: 
 18: /**
 19:  * Com\Tecnick\Pdf\Encrypt\Data
 20:  *
 21:  * Ecrypt common data
 22:  *
 23:  * @since       2008-01-02
 24:  * @category    Library
 25:  * @package     PdfEncrypt
 26:  * @author      Nicola Asuni <info@tecnick.com>
 27:  * @copyright   2011-2015 Nicola Asuni - Tecnick.com LTD
 28:  * @license     http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
 29:  * @link        https://github.com/tecnickcom/tc-lib-pdf-encrypt
 30:  */
 31: abstract class Data extends \Com\Tecnick\Pdf\Encrypt\Output
 32: {
 33:     //@codingStandardsIgnoreStart
 34:     /**
 35:      * Encryption padding string.
 36:      *
 37:      * @var string
 38:      */
 39:     protected static $encpad = "\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A";
 40:     //@codingStandardsIgnoreEnd
 41:     
 42:     /**
 43:      * Map permission modes and bits
 44:      *
 45:      * @var array
 46:      */
 47:     protected static $permbits = array(
 48:         'owner'       =>    2,  // bit 2 -- inverted logic: cleared by default
 49:                                 // When set permits change of encryption and enables all other permissions.
 50:         'print'       =>    4,  // bit 3
 51:                                 // Print the document.
 52:         'modify'      =>    8,  // bit 4
 53:                                 // Modify the contents of the document by operations other than those controlled
 54:                                 // by 'fill-forms', 'extract' and 'assemble'.
 55:         'copy'        =>   16,  // bit 5
 56:                                 // Copy or otherwise extract text and graphics from the document.
 57:         'annot-forms' =>   32,  // bit 6
 58:                                 // Add or modify text annotations, fill in interactive form fields, and,
 59:                                 // if 'modify' is also set, create or modify interactive form fields
 60:                                 // (including signature fields).
 61:         'fill-forms'  =>  256,  // bit 9
 62:                                 // Fill in existing interactive form fields (including signature fields),
 63:                                 // even if 'annot-forms' is not specified.
 64:         'extract'     =>  512,  // bit 10
 65:                                 // Extract text and graphics (in support of accessibility to users with
 66:                                 // disabilities or for other purposes).
 67:         'assemble'    => 1024,  // bit 11
 68:                                 // Assemble the document (insert, rotate, or delete pages and create bookmarks
 69:                                 // or thumbnail images), even if 'modify' is not set.
 70:         'print-high'  => 2048,  // bit 12
 71:                                 // Print the document to a representation from which a faithful digital copy of the
 72:                                 // PDF content could be generated. When this is not set, printing is limited to a
 73:                                 // low-level representation of the appearance, possibly of degraded quality.
 74:     );
 75:     
 76:     /**
 77:      * Encryption settings
 78:      *
 79:      * @var array
 80:      */
 81:     protected static $encrypt_settings = array(
 82:         0 => array(      // RC4 40 bit
 83:             'V'          => 1,
 84:             'Length'     => 40,
 85:             'CF'         => array(
 86:                 'CFM'       => 'V2',
 87:                 'AuthEvent' => 'DocOpen',
 88:             ),
 89:         ),
 90:         1 => array(     // RC4 128 bit
 91:             'V'          => 2,
 92:             'Length'     => 128,
 93:             'CF'         => array(
 94:                 'CFM'       => 'V2',
 95:                 'AuthEvent' => 'DocOpen',
 96:             ),
 97:             'SubFilter'  => 'adbe.pkcs7.s4',
 98:             'Recipients' => array(),
 99:         ),
100:         2 => array(     // AES 128 bit
101:             'V'          => 4,
102:             'Length'     => 128,
103:             'CF'         => array(
104:                 'CFM'       => 'AESV2',
105:                 'Length'    => 128,
106:                 'AuthEvent' => 'DocOpen',
107:             ),
108:             'SubFilter'  => 'adbe.pkcs7.s5',
109:             'Recipients' => array(),
110:         ),
111:         3 => array(      // AES 256 bit
112:             'V'          => 5,
113:             'Length'     => 256,
114:             'CF'         => array(
115:                 'CFM'       => 'AESV3',
116:                 'Length'    => 256,
117:                 'AuthEvent' => 'DocOpen',
118:             ),
119:             'SubFilter'  => 'adbe.pkcs7.s5',
120:             'Recipients' => array(),
121:         ),
122:     );
123: 
124:     /**
125:      * Define a list of available encrypt encoders.
126:      *
127:      * @var array
128:      */
129:     protected static $encmap = array(
130:         0          => 'RCFourFive',    // RC4-40
131:         1          => 'RCFourSixteen', // RC4-128
132:         2          => 'AESSixteen',    // AES-128
133:         3          => 'AESThirtytwo',  // AES-256
134:         'RC4'      => 'RCFour',        // RC4-40
135:         'RC4-40'   => 'RCFourFive',    // RC4-40
136:         'RC4-128'  => 'RCFourSixteen', // RC4-128
137:         'AES'      => 'AES',           // AES-256
138:         'AES-128'  => 'AESSixteen',    // AES-128
139:         'AES-256'  => 'AESThirtytwo',  // AES-256
140:         'AESnopad' => 'AESnopad',      // AES - no padding
141:         'MD5-16'   => 'MDFiveSixteen', // MD5-16
142:         'seed'     => 'Seed',          // Random seed string
143:     );
144: }
145: 
 

© 2004-2017 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy