Back to OpenSSL class

Method isSupported

public bool
isSupported
()
Is this adapter supported?
Returns
  • bool
Class: OpenSSL
Project: Joomla

Method isSupported - Source code

/**
 * Is this adapter supported?
 *
 * @return  boolean
 */
public function isSupported()
{
    if (!\function_exists('openssl_get_cipher_methods')) {
        return false;
    }
    if (!\function_exists('openssl_random_pseudo_bytes')) {
        return false;
    }
    if (!\function_exists('openssl_cipher_iv_length')) {
        return false;
    }
    if (!\function_exists('openssl_encrypt')) {
        return false;
    }
    if (!\function_exists('openssl_decrypt')) {
        return false;
    }
    if (!\function_exists('hash')) {
        return false;
    }
    if (!\function_exists('hash_algos')) {
        return false;
    }
    $algorithms = openssl_get_cipher_methods();
    if (!\in_array('aes-128-cbc', $algorithms)) {
        return false;
    }
    $algorithms = hash_algos();
    if (!\in_array('sha256', $algorithms)) {
        return false;
    }
    return true;
}