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 | 10 | 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 | 10 | public static function create($iv, $checksum, $padding, $file) |
|
77 | |||
78 | /** |
||
79 | * Returns the IV |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | 6 | public function getIv() |
|
87 | |||
88 | /** |
||
89 | * Returns the checksum of the encrypted file |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | 6 | public function getChecksum() |
|
97 | |||
98 | /** |
||
99 | * Returns the encrypted file |
||
100 | * |
||
101 | * @return \SplFileInfo |
||
102 | */ |
||
103 | 6 | public function getFile() |
|
107 | |||
108 | /** |
||
109 | * Returns the amount of bytes that have been padded |
||
110 | * |
||
111 | * @return int |
||
112 | */ |
||
113 | 6 | public function getPadding() |
|
117 | |||
118 | /** |
||
119 | * Sets the padding |
||
120 | * |
||
121 | * @param int$padding |
||
122 | * @return $this |
||
123 | */ |
||
124 | 10 | public function setPadding($padding) |
|
130 | |||
131 | /** |
||
132 | * String representation of object |
||
133 | * |
||
134 | * @link http://php.net/manual/en/serializable.serialize.php |
||
135 | * @return string the string representation of the object or null |
||
136 | * @since 5.1.0 |
||
137 | */ |
||
138 | 2 | public function serialize() |
|
147 | |||
148 | /** |
||
149 | * Constructs the object |
||
150 | * |
||
151 | * @link http://php.net/manual/en/serializable.unserialize.php |
||
152 | * @param string $serialized <p> |
||
153 | * The string representation of the object. |
||
154 | * </p> |
||
155 | * @return void |
||
156 | * @since 5.1.0 |
||
157 | */ |
||
158 | 2 | public function unserialize($serialized) |
|
170 | } |
||
171 |