@@ 414-422 (lines=9) @@ | ||
411 | * |
|
412 | * @return string |
|
413 | */ |
|
414 | protected function readIV(string $data, int $ivLength): string |
|
415 | { |
|
416 | $vector = substr($data, 0, $ivLength); |
|
417 | $isOk = $vector !== false && strlen($vector) === $ivLength; |
|
418 | ||
419 | $isOk === true ?: $this->throwException(new CryptException($this->getReadVectorErrorMessage())); |
|
420 | ||
421 | return $vector; |
|
422 | } |
|
423 | ||
424 | /** |
|
425 | * @param string $data |
|
@@ 430-438 (lines=9) @@ | ||
427 | * |
|
428 | * @return string |
|
429 | */ |
|
430 | protected function readTag(string $data, int $tagLength): string |
|
431 | { |
|
432 | $tag = substr($data, 0, $tagLength); |
|
433 | $isOk = $tag !== false && strlen($tag) === $tagLength; |
|
434 | ||
435 | $isOk === true ?: $this->throwException(new CryptException($this->getReadTagErrorMessage())); |
|
436 | ||
437 | return $tag; |
|
438 | } |
|
439 | ||
440 | /** |
|
441 | * @param string $data |
|
@@ 446-454 (lines=9) @@ | ||
443 | * |
|
444 | * @return string |
|
445 | */ |
|
446 | protected function extractData(string $data, int $ivLength): string |
|
447 | { |
|
448 | $result = substr($data, $ivLength); |
|
449 | ||
450 | $isOk = $result !== false && empty($result) === false; |
|
451 | $isOk === true ?: $this->throwException(new CryptException($this->getExtractDataErrorMessage())); |
|
452 | ||
453 | return $result; |
|
454 | } |
|
455 | ||
456 | /** |
|
457 | * @param string $data |