@@ -205,6 +205,10 @@ discard block |
||
| 205 | 205 | return array($cipherKey, $macKey, $iv); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | + /** |
|
| 209 | + * @param string $a |
|
| 210 | + * @param string $b |
|
| 211 | + */ |
|
| 208 | 212 | protected function hash_equals($a, $b) { |
| 209 | 213 | $key = openssl_random_pseudo_bytes(128); |
| 210 | 214 | return hash_hmac('sha512', $a, $key) === hash_hmac('sha512', $b, $key); |
@@ -242,7 +246,7 @@ discard block |
||
| 242 | 246 | /** |
| 243 | 247 | * Pad the data with a random char chosen by the pad amount. |
| 244 | 248 | * |
| 245 | - * @param $data |
|
| 249 | + * @param string $data |
|
| 246 | 250 | * @return string |
| 247 | 251 | */ |
| 248 | 252 | protected function pad($data) { |
@@ -258,8 +262,8 @@ discard block |
||
| 258 | 262 | /** |
| 259 | 263 | * Unpad the the data |
| 260 | 264 | * |
| 261 | - * @param $data |
|
| 262 | - * @return bool|string |
|
| 265 | + * @param string $data |
|
| 266 | + * @return false|string |
|
| 263 | 267 | */ |
| 264 | 268 | protected function unpad($data) { |
| 265 | 269 | $length = $this->getKeySize(); |
@@ -276,7 +280,7 @@ discard block |
||
| 276 | 280 | * Encrypt a credential |
| 277 | 281 | * |
| 278 | 282 | * @param Credential|array $credential the credential to decrypt |
| 279 | - * @return Credential|array |
|
| 283 | + * @return string |
|
| 280 | 284 | */ |
| 281 | 285 | public function decryptCredential($credential) { |
| 282 | 286 | return $this->handleCredential($credential, 'decrypt'); |
@@ -297,6 +301,7 @@ discard block |
||
| 297 | 301 | * Handles the encryption / decryption of a credential |
| 298 | 302 | * |
| 299 | 303 | * @param Credential|array $credential the credential to encrypt |
| 304 | + * @param string $op |
|
| 300 | 305 | * @return Credential|array |
| 301 | 306 | * @throws \Exception |
| 302 | 307 | */ |
@@ -342,7 +347,7 @@ discard block |
||
| 342 | 347 | /** |
| 343 | 348 | * Decrypt a file |
| 344 | 349 | * |
| 345 | - * @param File|array $file |
|
| 350 | + * @param File $file |
|
| 346 | 351 | * @return File|array |
| 347 | 352 | */ |
| 348 | 353 | |
@@ -354,6 +359,7 @@ discard block |
||
| 354 | 359 | * Handles the encryption / decryption of a File |
| 355 | 360 | * |
| 356 | 361 | * @param File|array $file the credential to encrypt |
| 362 | + * @param string $op |
|
| 357 | 363 | * @return File|array |
| 358 | 364 | * @throws \Exception |
| 359 | 365 | */ |