2016-01-28 14:52:40 +01:00
|
|
|
/** @file
|
|
|
|
|
*
|
|
|
|
|
* @par History
|
|
|
|
|
*/
|
2009-12-10 11:54:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "cryptengine.h"
|
|
|
|
|
|
2014-11-01 22:25:33 +01:00
|
|
|
#include "../../clib/logfacility.h"
|
2018-01-29 21:55:48 +01:00
|
|
|
#include "crypt.h"
|
|
|
|
|
#include "cryptkey.h"
|
2014-11-01 22:25:33 +01:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
namespace Pol
|
|
|
|
|
{
|
|
|
|
|
namespace Crypt
|
|
|
|
|
{
|
|
|
|
|
CCryptBase* create_nocrypt_engine()
|
|
|
|
|
{
|
|
|
|
|
return new CCryptNoCrypt();
|
|
|
|
|
}
|
2009-12-10 11:54:00 +00:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
CCryptBase* create_crypt_old_blowfish_engine( unsigned int uiKey1, unsigned int uiKey2 )
|
|
|
|
|
{
|
|
|
|
|
return new CCryptBlowfishOld( uiKey1, uiKey2 );
|
|
|
|
|
}
|
2009-12-15 13:16:25 +00:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
CCryptBase* create_crypt_1_25_36_engine( unsigned int uiKey1, unsigned int uiKey2 )
|
|
|
|
|
{
|
|
|
|
|
return new CCrypt12536( uiKey1, uiKey2 );
|
|
|
|
|
}
|
2009-12-15 13:16:25 +00:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
CCryptBase* create_crypt_blowfish_engine( unsigned int uiKey1, unsigned int uiKey2 )
|
|
|
|
|
{
|
|
|
|
|
return new CCryptBlowfish( uiKey1, uiKey2 );
|
|
|
|
|
}
|
2009-12-10 11:54:00 +00:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
CCryptBase* create_crypt_twofish_engine( unsigned int uiKey1, unsigned int uiKey2 )
|
|
|
|
|
{
|
|
|
|
|
return new CCryptTwofish( uiKey1, uiKey2 );
|
|
|
|
|
}
|
2009-12-10 11:54:00 +00:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
CCryptBase* create_crypt_blowfish_twofish_engine( unsigned int uiKey1, unsigned int uiKey2 )
|
|
|
|
|
{
|
|
|
|
|
return new CCryptBlowfishTwofish( uiKey1, uiKey2 );
|
|
|
|
|
}
|
2009-12-10 11:54:00 +00:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
CCryptBase* create_crypt_engine( TCryptInfo& infoCrypt )
|
|
|
|
|
{
|
|
|
|
|
switch ( infoCrypt.eType )
|
|
|
|
|
{
|
|
|
|
|
case CRYPT_NOCRYPT:
|
|
|
|
|
return create_nocrypt_engine();
|
|
|
|
|
case CRYPT_OLD_BLOWFISH:
|
|
|
|
|
return create_crypt_old_blowfish_engine( infoCrypt.uiKey1, infoCrypt.uiKey2 );
|
|
|
|
|
case CRYPT_1_25_36:
|
|
|
|
|
return create_crypt_1_25_36_engine( infoCrypt.uiKey1, infoCrypt.uiKey2 );
|
|
|
|
|
case CRYPT_BLOWFISH:
|
|
|
|
|
return create_crypt_blowfish_engine( infoCrypt.uiKey1, infoCrypt.uiKey2 );
|
|
|
|
|
case CRYPT_TWOFISH:
|
|
|
|
|
return create_crypt_twofish_engine( infoCrypt.uiKey1, infoCrypt.uiKey2 );
|
|
|
|
|
case CRYPT_BLOWFISH_TWOFISH:
|
|
|
|
|
return create_crypt_blowfish_twofish_engine( infoCrypt.uiKey1, infoCrypt.uiKey2 );
|
|
|
|
|
default:
|
|
|
|
|
POLLOG_ERROR << "Unknown ClientEncryptionVersion, using Ignition encryption engine\n";
|
|
|
|
|
return create_nocrypt_engine();
|
2013-12-21 09:10:46 +00:00
|
|
|
}
|
2016-02-19 19:26:35 +01:00
|
|
|
}
|
|
|
|
|
}
|
2018-01-01 21:49:30 +01:00
|
|
|
}
|