mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Throw exception if neither openssl nor mcrypt is available
This commit is contained in:
parent
75a468552d
commit
4b6737800f
3 changed files with 18 additions and 2 deletions
|
|
@ -64,7 +64,14 @@ class Security
|
|||
}
|
||||
|
||||
// Otherwise, use the CryptoCompat class.
|
||||
return base64_encode(\CryptoCompat::encrypt($plaintext, $key));
|
||||
if (function_exists('mcrypt_encrypt'))
|
||||
{
|
||||
return base64_encode(\CryptoCompat::encrypt($plaintext, $key));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception('msg_crypto_not_available');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -102,7 +109,14 @@ class Security
|
|||
}
|
||||
|
||||
// Otherwise, use the CryptoCompat class.
|
||||
return \CryptoCompat::decrypt($ciphertext, $key);
|
||||
if (function_exists('mcrypt_decrypt'))
|
||||
{
|
||||
return \CryptoCompat::decrypt($ciphertext, $key);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception('msg_crypto_not_available');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue