mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
Small fixes
This commit is contained in:
parent
e77bafca1e
commit
18242368be
29 changed files with 16 additions and 35724 deletions
|
|
@ -16,8 +16,6 @@ class Utils
|
|||
|
||||
static $Cookies = null;
|
||||
|
||||
static $RSA = null;
|
||||
|
||||
static $RsaKey = null;
|
||||
|
||||
/**
|
||||
|
|
@ -45,52 +43,6 @@ class Utils
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Crypt_RSA|null
|
||||
*/
|
||||
static public function CryptRSA()
|
||||
{
|
||||
if (null === \RainLoop\Utils::$RSA)
|
||||
{
|
||||
if (!\defined('_phpseclib_'))
|
||||
{
|
||||
\set_include_path(\get_include_path().PATH_SEPARATOR.APP_VERSION_ROOT_PATH.'app/libraries/phpseclib');
|
||||
define('_phpseclib_', true);
|
||||
}
|
||||
|
||||
if (!\class_exists('Crypt_RSA', false))
|
||||
{
|
||||
include_once 'Crypt/RSA.php';
|
||||
if (!\defined('CRYPT_RSA_MODE') && \defined('CRYPT_RSA_MODE_INTERNAL'))
|
||||
{
|
||||
\define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
||||
}
|
||||
}
|
||||
|
||||
if (\class_exists('Crypt_RSA'))
|
||||
{
|
||||
$oRsa = new \Crypt_RSA();
|
||||
|
||||
$oRsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1);
|
||||
$oRsa->setPrivateKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_PKCS1);
|
||||
$oRsa->setPrivateKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_PKCS1);
|
||||
|
||||
$sPrivateKey = \file_exists(APP_PRIVATE_DATA.'rsa/private') ?
|
||||
\file_get_contents(APP_PRIVATE_DATA.'rsa/private') : '';
|
||||
|
||||
if (!empty($sPrivateKey))
|
||||
{
|
||||
$oRsa->loadKey($sPrivateKey, CRYPT_RSA_PRIVATE_FORMAT_PKCS1);
|
||||
$oRsa->loadKey($oRsa->getPublicKey(), CRYPT_RSA_PUBLIC_FORMAT_PKCS1);
|
||||
|
||||
\RainLoop\Utils::$RSA = $oRsa;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return \RainLoop\Utils::$RSA;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue