资源简介
飞天诚信epass3000 usbkey开发包,飞天诚信epass3000,飞天诚信epass3000
代码片段和文件信息
#include
#include
#include
#include “../../include/cryptoki_ft.h“
#include “enumobj.h“
using namespace std;
EnumObj::EnumObj()
{
m_pSlotList = NULL_PTR;
m_pApplication = new char[255];
memset(m_pApplication 0 255);
strcpy((char*)m_pApplication “Enum object App“);
m_hSession = NULL_PTR;
}
EnumObj::~EnumObj()
{
if(m_hSession)
{
C_CloseSession(m_hSession);
m_hSession = NULL_PTR;
}
delete[] (char *)m_pApplication;
if(m_pSlotList)
{
delete[] m_pSlotList;
m_pSlotList = NULL_PTR;
}
}
CK_RV EnumObj::Connect()
{
if(m_hSession) return CKR_OK;
CK_RV rv;
CK_ULONG ulCount = 0;
rv = C_GetSlotList(TRUE NULL_PTR &ulCount);
if(CKR_OK != rv )
{
printf(“\nCan‘t Acquire the Inoformation of Token.Error Code 0x%08X.\n“ rv);
return rv;
}
if(0 >= ulCount)
{
printf(“\nCan‘t Connect to Token.Make Sure You have inserted USB Token.\n“);
return CKR_GENERAL_ERROR;
}
m_pSlotList = (CK_SLOT_ID_PTR)new CK_SLOT_ID[ulCount];
if (! m_pSlotList)
{
printf(“\nCan‘t allocate enough memory\n“);
return CKR_HOST_MEMORY;
}
rv = C_GetSlotList(TRUE m_pSlotList &ulCount);
if(CKR_OK != rv )
{
printf(“\nCan‘t Acquire the Inoformation of Token.Error Code 0x%08X.\n“ rv);
return rv;
}
if(0 >= ulCount)
{
printf(“\nCan‘t Connect to Token.Make Sure You have inserted Token.\n“);
return CKR_HOST_MEMORY;
}
rv = C_OpenSession(
m_pSlotList[0] CKF_RW_SESSION | CKF_SERIAL_SESSION
&m_pApplication NULL_PTR &m_hSession);
if(CKR_OK != rv )
{
printf(“\nCan‘t Connect to Token.Error Code 0x%08X.\n“ rv);
delete[] m_pSlotList;
m_pSlotList = NULL_PTR;
return rv;
}
else
{
printf(“Success connect to Token\n“);
return CKR_OK;
}
}
void EnumObj::StartOP()
{
printf(“\n================================================“);
}
void EnumObj::Enum()
{
CK_object_CLASS dataClass = CKO_CERTIFICATE;
bool IsToken=true;
CK_ATTRIBUTE pTempl[] =
{
{CKA_CLASS &dataClass sizeof(CKO_CERTIFICATE)}
{CKA_TOKEN &IsToken sizeof(true)}
};
C_FindobjectsInit(m_hSession pTempl 2);
CK_object_HANDLE hCKObj;
CK_ULONG ulRetCount = 0;
CK_RV ckrv = 0;
int numObj=0;
do
{
ckrv = C_Findobjects(m_hSession &hCKObj 1 &ulRetCount);
if(CKR_OK != ckrv)
{
break;
}
if(1 != ulRetCount)
break;
CK_ATTRIBUTE pAttrTemp[] =
{
{CKA_CLASS NULL 0}
{CKA_CERTIFICATE_TYPENULL0}
{CKA_LABEL NULL 0}
{CKA_SUBJECTNULL0}
{CKA_IDNULL0}
{CKA_VALUENULL0}
};
ckrv = C_GetAttributeValue(m_hSession hCKObj pAttrTemp 6);
if(ckrv != CKR_OK)
{
break;
}
pAttrTemp[0].pValue = new char[pAttrTemp[0].ulValueLen];
pAttrTemp[1].pValue = new char[pAttrTemp[1].ulValueLen];
pAttrTemp[2].pValue = new char[pAttrTemp[2].ulValueLen+1];
pAttrTemp[3].pValue = new char[pAttrTemp[3].ulValueLen+1];
pAttrTemp[4].
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-05-14 11:10 ePass3000\
目录 0 2010-09-27 11:59 ePass3000\Linux1.1\
目录 0 2010-09-27 11:59 ePass3000\Linux1.1\doc\
文件 54582 2009-07-15 17:08 ePass3000\Linux1.1\doc\ePass3000_Hardware_Desc
文件 155217 2009-07-15 17:08 ePass3000\Linux1.1\doc\ePass3000_RunTime_Package_Installation_Guide.pdf
文件 1217672 2009-08-10 09:37 ePass3000\Linux1.1\doc\ePassNG_User_Manual.pdf
目录 0 2010-09-27 11:59 ePass3000\Linux1.1\include\
文件 2065 2009-07-02 10:13 ePass3000\Linux1.1\include\auxiliary.h
文件 1705 2009-07-02 10:13 ePass3000\Linux1.1\include\cryptoki_ft.h
文件 1436 2009-07-02 10:13 ePass3000\Linux1.1\include\cryptoki_linux.h
文件 2505 2009-07-02 10:13 ePass3000\Linux1.1\include\notifymsg.h
文件 9578 2009-07-02 10:13 ePass3000\Linux1.1\include\pkcs11.h
文件 29258 2009-07-02 10:13 ePass3000\Linux1.1\include\pkcs11f.h
文件 54529 2009-07-02 10:13 ePass3000\Linux1.1\include\pkcs11t.h
目录 0 2010-09-27 11:59 ePass3000\Linux1.1\redist\
文件 3717322 2009-08-10 17:31 ePass3000\Linux1.1\redist\EnterSafe-ePass3000-1.1.0.090810.x86.tar.gz
目录 0 2010-09-27 11:59 ePass3000\Linux1.1\sample\
目录 0 2010-09-27 11:59 ePass3000\Linux1.1\sample\EnumObj\
文件 132 2009-07-02 10:13 ePass3000\Linux1.1\sample\EnumObj\Makefile
文件 22347 2009-07-02 10:13 ePass3000\Linux1.1\sample\EnumObj\enumobj.cpp
文件 389 2009-07-02 10:13 ePass3000\Linux1.1\sample\EnumObj\enumobj.h
文件 1403 2009-07-02 10:13 ePass3000\Linux1.1\sample\EnumObj\main.cpp
目录 0 2010-09-27 11:59 ePass3000\Linux1.1\sample\ExportCert\
文件 140 2009-07-02 10:13 ePass3000\Linux1.1\sample\ExportCert\Makefile
文件 4712 2009-08-04 14:47 ePass3000\Linux1.1\sample\ExportCert\exportcert.cpp
文件 298 2009-07-02 10:13 ePass3000\Linux1.1\sample\ExportCert\exportcert.h
文件 451 2009-07-02 10:13 ePass3000\Linux1.1\sample\ExportCert\main.cpp
目录 0 2010-09-27 11:59 ePass3000\Linux1.1\sample\GetPinInfo\
文件 2373 2009-07-02 10:13 ePass3000\Linux1.1\sample\GetPinInfo\GetPinInfo.cpp
文件 301 2009-07-02 10:13 ePass3000\Linux1.1\sample\GetPinInfo\GetPinInfo.h
文件 136 2009-07-02 10:13 ePass3000\Linux1.1\sample\GetPinInfo\Makefile
............此处省略354个文件信息
评论
共有 条评论