public function OpenSSL::getIv in DRD Agent 8.3
Same name and namespace in other branches
- 4.0.x src/Crypt/Method/OpenSSL.php \Drupal\drd_agent\Crypt\Method\OpenSSL::getIv()
Get an initialiation vector.
Return value
string The IV.
Overrides BaseMethodInterface::getIv
1 call to OpenSSL::getIv()
- OpenSSL::encrypt in src/
Crypt/ Method/ OpenSSL.php - Encrypt and encode any list of arguments.
File
- src/
Crypt/ Method/ OpenSSL.php, line 81
Class
- OpenSSL
- Provides OpenSSL encryption functionality.
Namespace
Drupal\drd_agent\Crypt\MethodCode
public function getIv() : string {
if (empty($this->iv)) {
$nonceSize = openssl_cipher_iv_length($this->cipher);
$strong = TRUE;
/** @noinspection CryptographicallySecureRandomnessInspection */
$this->iv = openssl_random_pseudo_bytes($nonceSize, $strong);
if ($strong === FALSE || $this->iv === FALSE) {
$this->logger
->warning('Your systm does not produce secure randomness.');
}
}
return $this->iv;
}