1 | <?php namespace Wubbajack\Encryption; |
||
17 | class EncryptedFile implements \Serializable |
||
18 | { |
||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $iv; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $checksum; |
||
28 | |||
29 | /** |
||
30 | * @var \SplFileInfo |
||
31 | */ |
||
32 | protected $file; |
||
33 | |||
34 | /** |
||
35 | * @var int |
||
36 | */ |
||
37 | protected $padding = 0; |
||
38 | |||
39 | /** |
||
40 | * EncryptedFile constructor. |
||
41 | * |
||
42 | * @param string $iv |
||
43 | * @param string $checksum |
||
44 | * @param \SplFileInfo $file |
||
45 | */ |
||
46 | public function __construct($iv, $checksum, \SplFileInfo $file) |
||
52 | |||
53 | /** |
||
54 | * Creates a new encrypted file object |
||
55 | * |
||
56 | * @param string $iv |
||
57 | * @param string $checksum |
||
58 | * @param int $padding |
||
59 | * @param \SplFileInfo|string $file |
||
60 | * |
||
61 | * @return static |
||
62 | */ |
||
63 | public static function create($iv, $checksum, $padding, $file) |
||
73 | |||
74 | /** |
||
75 | * Returns the IV |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getIv() |
||
83 | |||
84 | /** |
||
85 | * Returns the checksum of the encrypted file |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getChecksum() |
||
93 | |||
94 | /** |
||
95 | * Returns the encrypted file |
||
96 | * |
||
97 | * @return \SplFileInfo |
||
98 | */ |
||
99 | public function getFile() |
||
103 | |||
104 | /** |
||
105 | * Returns the amount of bytes that have been padded |
||
106 | * |
||
107 | * @return int |
||
108 | */ |
||
109 | public function getPadding() |
||
113 | |||
114 | /** |
||
115 | * Sets the padding |
||
116 | * |
||
117 | * @param int$padding |
||
118 | * @return $this |
||
119 | */ |
||
120 | public function setPadding($padding) |
||
126 | |||
127 | /** |
||
128 | * String representation of object |
||
129 | * |
||
130 | * @link http://php.net/manual/en/serializable.serialize.php |
||
131 | * @return string the string representation of the object or null |
||
132 | * @since 5.1.0 |
||
133 | */ |
||
134 | public function serialize() |
||
143 | |||
144 | /** |
||
145 | * Constructs the object |
||
146 | * |
||
147 | * @link http://php.net/manual/en/serializable.unserialize.php |
||
148 | * @param string $serialized <p> |
||
149 | * The string representation of the object. |
||
150 | * </p> |
||
151 | * @return void |
||
152 | * @since 5.1.0 |
||
153 | */ |
||
154 | public function unserialize($serialized) |
||
166 | } |
||
167 |