You are here

public static function ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available()

Is AES-256-GCM even available to use?

@psalm-suppress UndefinedFunction @psalm-suppress MixedInferredReturnType @psalm-suppress MixedReturnStatement

Return value

bool

4 calls to ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available()
ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt in vendor/paragonie/sodium_compat/src/Compat.php
Authenticated Encryption with Associated Data: Decryption
ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt in vendor/paragonie/sodium_compat/src/Compat.php
Authenticated Encryption with Associated Data: Encryption
php72compat.php in vendor/paragonie/sodium_compat/lib/php72compat.php
sodium_compat.php in vendor/paragonie/sodium_compat/lib/sodium_compat.php

File

vendor/paragonie/sodium_compat/src/Compat.php, line 302

Class

ParagonIE_Sodium_Compat

Code

public static function crypto_aead_aes256gcm_is_available() {
  if (self::useNewSodiumAPI()) {
    return sodium_crypto_aead_aes256gcm_is_available();
  }
  if (self::use_fallback('crypto_aead_aes256gcm_is_available')) {
    return call_user_func('\\Sodium\\crypto_aead_aes256gcm_is_available');
  }
  if (PHP_VERSION_ID < 70100) {

    // OpenSSL doesn't support AEAD before 7.1.0
    return false;
  }
  if (!is_callable('openssl_encrypt') || !is_callable('openssl_decrypt')) {

    // OpenSSL isn't installed
    return false;
  }
  return (bool) in_array('aes-256-gcm', openssl_get_cipher_methods());
}