// KeyGeneration.cpp : Defines the entry point for the DLL application.
//
#include <windows.h>
#include "KeyGenAlgoInterfaceEx.h"
typedef unsigned char uint8_t;
typedef char int8_t;
typedef unsigned int uint32_t;
typedef int int32_t;
#define SECURITY_CALCULATE_LEVEL1 1
#define SECURITY_CALCULATE_LEVEL2 2
#define SECURITY_CALCULATE_LEVEL3 3
#define SECURITY_CALCULATE_LEVEL17 17
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
static const uint8_t SeedLength = 4;
static const uint8_t m_leve1_mask[4] = {0x25,0xD4,0xA3,0x67};//extended
//static const uint8_t m_leve1_mask[4] = {0x36,0xB3,0x63,0x36};//extended for test
static const uint8_t m_leve2_mask[4] = {0x82,0x7A,0x6B,0x95};//FBL
void GetKeyBATC(const uint8_t *pSeed,const uint8_t *pConst,uint8_t *pKey)
{
uint8_t Key1[4];
uint8_t Seed2[4];
uint8_t Key2[4];
Key1[0] = pSeed[0]^pConst[0];
Key1[1] = pSeed[1]^pConst[1];
Key1[2] = pSeed[2]^pConst[2];
Key1[3] = pSeed[3]^pConst[3];
//
Seed2[0] = pSeed[3];
Seed2[1] = pSeed[2];
Seed2[2] = pSeed[1];
Seed2[3] = pSeed[0];
//
Key2[0] = Seed2[0]^pConst[0];
Key2[1] = Seed2[1]^pConst[1];
Key2[2] = Seed2[2]^pConst[2];
Key2[3] = Seed2[3]^pConst[3];
//
pKey[0] = Key1[0]+Key2[0];
pKey[1] = Key1[1]+Key2[1];
pKey[2] = Key1[2]+Key2[2];
pKey[3] = Key1[3]+Key2[3];
}
/*******************************/
/*
void UdsSeedtoKey(uint8_t *seed,uint8_t seedLen,uint8_t *key,uint8_t *pKeyLen,SECURITY_CALCULATE_LEVEL securityLevel)
{
uint32_t u32Key;
uint32_t u32Seed;
u32Key = 0x00;
u32Seed = (seed[0]<<24)+(seed[1]<<16)+(seed[2]<<8)+(seed[3]<<0);
if(securityLevel==SECURITY_CALCULATE_LEVEL1)
{
u32Key = uds_calc_key_lv1(u32Seed);
}
else if(securityLevel==SECURITY_CALCULATE_LEVEL3)//FBL
{
u32Key = uds_calc_key_lv3(u32Seed);
}
else if(securityLevel==SECURITY_CALCULATE_LEVEL2)
{
}
key[0] = (uint8_t)(u32Key>>24);
key[1] = (uint8_t)(u32Key>>16);
key[2] = (uint8_t)(u32Key>>8);
key[3] = (uint8_t)(u32Key>>0);
*pKeyLen = 4;
}*/
KEYGENALGO_API VKeyGenResultEx GenerateKeyEx(
const unsigned char* iSeedArray, /* Array for the seed [in] */
unsigned int iSeedArraySize, /* Length of the array for the seed [in] */
const unsigned int iSecurityLevel, /* Security level [in] */
const char* iVariant, /* Name of the active variant [in] */
unsigned char* ioKeyArray, /* Array for the key [in, out] */
unsigned int iKeyArraySize, /* Maximum length of the array for the key [in] */
unsigned int& oSize /* Length of the key [out] */
)
{
//uint32_t u32Key;
//uint32_t u32Seed;
//u32Key = 0x00;
//u32Seed = (iSeedArray[0]<<24)+(iSeedArray[1]<<16)+(iSeedArray[2]<<8)+(iSeedArray[3]<<0);
if(iSecurityLevel==SECURITY_CALCULATE_LEVEL1)
{
GetKeyBATC(iSeedArray,m_leve1_mask,ioKeyArray);
}
else if(iSecurityLevel==SECURITY_CALCULATE_LEVEL3)//FBL
{
GetKeyBATC(iSeedArray,m_leve2_mask,ioKeyArray);
}
else if(iSecurityLevel==SECURITY_CALCULATE_LEVEL17)//FBL
{
GetKeyBATC(iSeedArray,m_leve2_mask,ioKeyArray);
}
else
{
return KGRE_SecurityLevelInvalid;
}
oSize = 4;
return KGRE_Ok;
}
没有合适的资源?快使用搜索试试~ 我知道了~
0x27服务dll基础工程
共21个文件
vcproj:2个
cpp:2个
gif:2个
需积分: 5 1 下载量 30 浏览量
2023-07-13
09:46:37
上传
评论
收藏 13.44MB ZIP 举报
温馨提示
0x27服务dll基础工程
资源推荐
资源详情
资源评论
收起资源包目录
SecurityAccess.zip (21个子文件)
SecurityAccess
Sources
KeyGenDll_GenerateKeyExOpt
GenerateKeyExOpt.rc 2KB
GenerateKeyExOpt.h 2KB
GenerateKeyExOptImpl.vcproj 4KB
GenerateKeyExOpt.cpp 2KB
KeyGenDll_GenerateKeyEx
GenerateKeyExImpl.dsp 4KB
GenerateKeyExImpl.vcxproj.filters 511B
GenerateKeyExImpl.sln 900B
_UpgradeReport_Files
UpgradeReport_Minus.gif 69B
UpgradeReport.xslt 12KB
UpgradeReport.css 3KB
UpgradeReport_Plus.gif 71B
GenerateKeyExImpl.suo 13KB
GenerateKeyExImpl.vcproj 5KB
ipch
generatekeyeximpl-2b60a220
debug
seednkey-3c3aa461.ipch 30.63MB
GenerateKeyExImpl.vcxproj.user 143B
UpgradeLog.XML 4KB
KeyGenAlgoInterfaceEx.h 2KB
GenerateKeyExImpl.cpp 3KB
Debug
GenerateKeyExImpl.sdf 22.64MB
GenerateKeyExImpl.vcxproj 8KB
SeednKey.dll 52KB
共 21 条
- 1
资源评论
何事误红尘
- 粉丝: 907
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功