计划安排
总时间:1.12-6.23
总函数(一共23个函数)
//连接设备
SGD_RV SDF_OpenDevice(SGD_HANDLE *phDeviceHandle);
//关闭设备
SGD_RV SDF_CloseDevice(SGD_HANDLE hDeviceHandle);
//打开会话
SGD_RV SDF_OpenSession(SGD_HANDLE hDeviceHandle, SGD_HANDLE *phSessionHandle);
//关闭会话
SGD_RV SDF_CloseSession(SGD_HANDLE hSessionHandle);
//生成随机数
SGD_RV SDF_GenerateRandom(SGD_HANDLE hSessionHandle, SGD_UCHAR* pOutRand, SGD_UINT32 ulRandLen);
//导入根密钥和设备SN码
SGD_RV SDF_ImportRootKeyAndDeviceSN(SGD_HANDLE hSessionHandle,SGD_UINT8 * rootKey,SGD_UINT8 * devSN,SGD_UINT32 len);
//获取设备信息
SGD_RV SDF_GetDeviceInfo(SGD_HANDLE hSessionHandle, DEVICEINFO *pstDeviceInfo);
//产生ECC密钥对并输出
SGD_RV SDF_GenerateKeyPair_ECC(SGD_HANDLE hSessionHandle, SGD_UINT32 uiAlgID, SGD_UINT32 uiKeyBits, ECCrefPublicKey *pucPublicKey, ECCrefPrivateKey *pucPrivateKey);
//导入SM2密钥对,密文形式导入.
SGD_RV SDF_ImportECCKeyPair(SGD_HANDLE hSessionHandle,SGD_UINT32 uiKeyInd,const SGD_UCHAR *pKeyEnc);
//导出SM2公钥,明文返回
SGD_RV SDF_ExportECCPubKey(SGD_HANDLE hSessionHandle,SGD_UINT32 uiKeyInd,SGD_UCHAR *pPubKeyEnc);
//导出SM2私钥,密文形式返回, 密文计算方式与导入时计算方式相同.
SGD_RV SDF_ExportECCPriKey(SGD_HANDLE hSessionHandle,SGD_UINT32 uiKeyInd,SGD_UCHAR *pPriKeyEnc);
//导出SM2密钥对,密文加Hash值方式返回, 密文和Hash值计算方式与导入时相同
SGD_RV SDF_ECCBackUp(SGD_HANDLE hSessionHandle,SGD_UINT32 uiKeyInd,SGD_UCHAR *pEncOut, SGD_UINT32 *nOutLen);
//SM2验签
SGD_RV SDF_InternalSign_ECC(SGD_HANDLE hSessionHandle, SGD_UINT32 uiISKIndex, SGD_UCHAR *pucData, SGD_UINT32 uiDataLength, ECCSignature *pucSignature);
//SM2加密
SGD_RV SDF_InternalVerify_ECC(SGD_HANDLE hSessionHandle, SGD_UINT32 uiISKIndex, SGD_UCHAR *pucData, SGD_UINT32 uiDataLength, ECCSignature *pucSignature);
//SM2加密
SGD_RV SDF_InternalEncrypt_ECC(SGD_HANDLE hSessionHandle, SGD_UINT32 uiIPKIndex, SGD_UINT32 uiAlgID, SGD_UCHAR *pucData, SGD_UINT32 uiDataLength, ECCCipher *pucEncData);
//SM2解密
SGD_RV SDF_InternalDecrypt_ECC(SGD_HANDLE hSessionHandle, SGD_UINT32 uiISKIndex, SGD_UINT32 uiAlgID, ECCCipher *pucEncData, SGD_UCHAR *pucData, SGD_UINT32 *puiDataLength);
//对称算法加密
SGD_RV SDF_Encrypt(SGD_HANDLE hSessionHandle, SGD_UCHAR *pucKey, SGD_UINT32 uiAlgID, SGD_UCHAR *pucIV, SGD_UCHAR *pucData, SGD_UINT32 uiDataLength, SGD_UCHAR *pucEncData, SGD_UINT32 *puiEncDataLength);
//对称算法解密
SGD_RV SDF_Decrypt(SGD_HANDLE hSessionHandle, SGD_UCHAR *pucKey, SGD_UINT32 uiAlgID, SGD_UCHAR *pucIV, SGD_UCHAR *pucEncData, SGD_UINT32 uiEncDataLength, SGD_UCHAR *pucData, SGD_UINT32 *puiDataLength);
//IPSEC数据加密
SGD_RV SDF_Encrypt_IPSEC(SGD_HANDLE hSessionHandle, SGD_UCHAR *pucEncKey, SGD_UINT32 uiAlgID, SGD_UCHAR *pucIV, SGD_UCHAR *HMACKEY, SGD_UINT32 HMACKEYLEN, SGD_UCHAR *pucData, SGD_UINT32 uiDataLen, SGD_UCHAR *pucEncData, SGD_UINT32 *puiEncDataLen);
//IPSEC数据解密
SGD_RV SDF_Decrypt_IPSEC(SGD_HANDLE hSessionHandle, SGD_UCHAR *pucDecKey, SGD_UINT32 uiAlgID, SGD_UCHAR *pucIV, SGD_UCHAR *HMACKEY, SGD_UINT32 HMACKEYLEN, SGD_UCHAR *pucEncData, SGD_UINT32 uiEncDataLen, SGD_UCHAR *pucOutputData, SGD_UINT32 *puiOutputDataLen);
//哈希初始化
SGD_RV SDF_HashInit(SGD_HANDLE hSessionHandle, SGD_UINT32 uiAlgID, ECCrefPublicKey *pucPublicKey, SGD_UCHAR *pucID, SGD_UINT32 uiIDLength);
//哈希
SGD_RV SDF_HashUpdate(SGD_HANDLE hSessionHandle, SGD_UCHAR *pucData, SGD_UINT32 uiDataLength);
//哈希结束
SGD_RV SDF_HashFinal(SGD_HANDLE hSessionHandle, SGD_UCHAR *pucHash, SGD_UINT32 *puiHashLength);
计划一(1.12-1.25)
- 实现打开设备、关闭设备 、打开会话、关闭会话、获取设备信息、生成随机数、导入根密钥和设备SN码6个函数
- 完成翻译任务
计划二(2.24-3.18)
- 完成密钥管理部分:ECC密钥的生成和输出、导入SM2密钥对、导出SM2公钥,明文返回、导出SM2私钥,密文形式返回4个函数
- 并写出测试代码
计划三(3.18-3.24)
- 完成sm2签名部分:sm签名、sm2验签
- 完成相应的测试代码
计划四(3.25-3.31)
- 完成sm2加解密部分:sm2加密、sm2解密
- 完成相应测试代码
计划五(4.1-4.7)
- 完成对称加密:对称算法加密、对称算法解密
- 完成相应测试代码
计划六(4.8-4.14)
- 完成IPSEC部分:IPSEC数据加密、IPSEC数据解密
- 完成相应测试代码
计划七(4.15-4.21)
- 整理已完成的内容资料,准备中期答辩
计划八(4.22-4.28)
- 完成哈希部分:哈希初始化、哈希、哈希结束
- 完成相应测试代码
计划九(4.29-5.5)
- 实现文件操作类接口
计划十(5.6-5.12)
- 实现代码测试图形界面。
计划十一(5.13-5.19)
- 撰写论文,完善论文
计划十二(5.13-5.19)
- 准备演示材料。