@@ 425-433 (lines=9) @@ | ||
422 | * |
|
423 | * @return string |
|
424 | */ |
|
425 | protected function readIV(string $data, int $ivLength): string |
|
426 | { |
|
427 | $vector = substr($data, 0, $ivLength); |
|
428 | $isOk = $vector !== false && strlen($vector) === $ivLength; |
|
429 | ||
430 | $isOk === true ?: $this->throwException(new CryptException($this->getReadVectorErrorMessage())); |
|
431 | ||
432 | return $vector; |
|
433 | } |
|
434 | ||
435 | /** |
|
436 | * @param string $data |
|
@@ 441-449 (lines=9) @@ | ||
438 | * |
|
439 | * @return string |
|
440 | */ |
|
441 | protected function readTag(string $data, int $tagLength): string |
|
442 | { |
|
443 | $tag = substr($data, 0, $tagLength); |
|
444 | $isOk = $tag !== false && strlen($tag) === $tagLength; |
|
445 | ||
446 | $isOk === true ?: $this->throwException(new CryptException($this->getReadTagErrorMessage())); |
|
447 | ||
448 | return $tag; |
|
449 | } |
|
450 | ||
451 | /** |
|
452 | * @param string $data |
|
@@ 457-465 (lines=9) @@ | ||
454 | * |
|
455 | * @return string |
|
456 | */ |
|
457 | protected function extractData(string $data, int $ivLength): string |
|
458 | { |
|
459 | $result = substr($data, $ivLength); |
|
460 | ||
461 | $isOk = $result !== false && empty($result) === false; |
|
462 | $isOk === true ?: $this->throwException(new CryptException($this->getExtractDataErrorMessage())); |
|
463 | ||
464 | return $result; |
|
465 | } |
|
466 | ||
467 | /** |
|
468 | * @param string $data |