2021-06-27 21:25:29 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: Crypto.hpp
|
|
|
|
Date: 2021-6-12
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
2021-09-18 20:10:25 +00:00
|
|
|
#include <tomcrypt.h>
|
|
|
|
#include <Extensions/LTC/LTCExtensions.hpp>
|
|
|
|
#include <Crypto.hpp>
|
|
|
|
|
|
|
|
namespace Aurora::Crypto
|
|
|
|
{
|
|
|
|
static int PaddingToType(EPaddingType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case EPaddingType::ePaddingNone:
|
|
|
|
return 0;
|
|
|
|
case EPaddingType::ePKCS_1_5:
|
|
|
|
return LTC_PKCS_1_V1_5;
|
|
|
|
case EPaddingType::ePKCS_1_5_NA1:
|
|
|
|
return LTC_PKCS_1_V1_5_NA1;
|
|
|
|
case EPaddingType::ePKCS_OAEP:
|
|
|
|
return LTC_PKCS_1_OAEP;
|
|
|
|
case EPaddingType::ePKCS_1_PSS:
|
|
|
|
return LTC_PKCS_1_PSS;
|
|
|
|
default:
|
|
|
|
return 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int HashMethodToId(EHashType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case EHashType::eTiger_24_192:
|
|
|
|
return ::Crypto::gHashTiger;
|
|
|
|
case EHashType::eSHA1_20_160:
|
|
|
|
return ::Crypto::gHashSha1;
|
|
|
|
case EHashType::eSHA2_32_256:
|
|
|
|
return ::Crypto::gHashSha256;
|
|
|
|
case EHashType::eSHA2_64_512:
|
|
|
|
return ::Crypto::gHashSha512;
|
|
|
|
default:
|
|
|
|
return 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|