zoukankan      html  css  js  c++  java
  • 生成UDS安全算法DLL文件

    使用Visual Studio打开工工程模板,模板在C:UsersPublicDocumentsVectorCANoe10.0 (x64)CANoe Sample ConfigurationsCANDiagnosticsUDSSystemSecurityAccessSourcesKeyGenDll_GenerateKeyEx下,

    打开工程GenerateKeyExImpl.vcproj,提示工程转换点确定

    修改算法

    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] */
    )
    {
    unsigned int key = 0U;
    unsigned int seed = 0U;
    unsigned int i = 0;
    if (iSeedArraySize>iKeyArraySize)
    return KGRE_BufferToSmall;
    // for (unsigned int i=0;i<iSeedArraySize;i++)
    // ioKeyArray[i]=~iSeedArray[i];
    seed = iSeedArray[1];
    seed |= (iSeedArray[0]<<8);

    key = seed + 1;

    ioKeyArray[1] = key & 0xff;
    ioKeyArray[0] = (key>>8)& 0xff;
    oSize=iSeedArraySize;

    return KGRE_Ok;
    }

    在工程属性下 选择生成DLL文件

    点击生成文件,DLL文件在debug文件夹下。

  • 相关阅读:
    SQL SERVER 2005添加用户和编辑sa
    数组型参数和数组的区别
    Oracle数据库建库、建表空间,建用户
    oracle表空间操作详解
    Oracle10g的完全卸载(转载)
    Delphi format的用法
    AnImateWindow用法
    文本文件操作
    TStringList的用法
    Delphi网络函数
  • 原文地址:https://www.cnblogs.com/hkj8808/p/14829999.html
Copyright © 2011-2022 走看看