飞天诚信epass3000 usbkey开发包


飞天诚信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(“
Can‘t Acquire the Inoformation of Token.Error Code 0x%08X.
“ rv);
return rv;
}
if(0 >= ulCount)
{
printf(“
Can‘t Connect to Token.Make Sure You have inserted USB Token.
“);
return CKR_GENERAL_ERROR;
}

m_pSlotList = (CK_SLOT_ID_PTR)new CK_SLOT_ID[ulCount];
if (! m_pSlotList) 
{
printf(“
Can‘t allocate enough memory
“);
return CKR_HOST_MEMORY;
}

rv = C_GetSlotList(TRUE m_pSlotList &ulCount);
if(CKR_OK != rv )
{
printf(“
Can‘t Acquire the Inoformation of Token.Error Code 0x%08X.
“ rv);
return rv;
}
if(0 >= ulCount)
{
printf(“
Can‘t Connect to Token.Make Sure You have inserted Token.
“);
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(“
Can‘t Connect to Token.Error Code 0x%08X.
“ rv);
delete[] m_pSlotList;
m_pSlotList = NULL_PTR;
return rv;
}
else
{
printf(“Success connect to Token
“);
return CKR_OK;
}
}

void EnumObj::StartOP()
{
printf(“
================================================“);
}

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  ePass3000Linux1.1
     目录           0  2010-09-27 11:59  ePass3000Linux1.1doc
     文件       54582  2009-07-15 17:08  ePass3000Linux1.1docePass3000_Hardware_Description.pdf
     文件      155217  2009-07-15 17:08  ePass3000Linux1.1docePass3000_RunTime_Package_Installation_Guide.pdf
     文件     1217672  2009-08-10 09:37  ePass3000Linux1.1docePassNG_User_Manual.pdf
     目录           0  2010-09-27 11:59  ePass3000Linux1.1include
     文件        2065  2009-07-02 10:13  ePass3000Linux1.1includeauxiliary.h
     文件        1705  2009-07-02 10:13  ePass3000Linux1.1includecryptoki_ft.h
     文件        1436  2009-07-02 10:13  ePass3000Linux1.1includecryptoki_linux.h
     文件        2505  2009-07-02 10:13  ePass3000Linux1.1include
otifymsg.h
     文件        9578  2009-07-02 10:13  ePass3000Linux1.1includepkcs11.h
     文件       29258  2009-07-02 10:13  ePass3000Linux1.1includepkcs11f.h
     文件       54529  2009-07-02 10:13  ePass3000Linux1.1includepkcs11t.h
     目录           0  2010-09-27 11:59  ePass3000Linux1.1
edist
     文件     3717322  2009-08-10 17:31  ePass3000Linux1.1
edistEnterSafe-ePass3000-1.1.0.090810.x86.tar.gz
     目录           0  2010-09-27 11:59  ePass3000Linux1.1sample
     目录           0  2010-09-27 11:59  ePass3000Linux1.1sampleEnumObj
     文件         132  2009-07-02 10:13  ePass3000Linux1.1sampleEnumObjMakefile
     文件       22347  2009-07-02 10:13  ePass3000Linux1.1sampleEnumObjenumobj.cpp
     文件         389  2009-07-02 10:13  ePass3000Linux1.1sampleEnumObjenumobj.h
     文件        1403  2009-07-02 10:13  ePass3000Linux1.1sampleEnumObjmain.cpp
     目录           0  2010-09-27 11:59  ePass3000Linux1.1sampleExportCert
     文件         140  2009-07-02 10:13  ePass3000Linux1.1sampleExportCertMakefile
     文件        4712  2009-08-04 14:47  ePass3000Linux1.1sampleExportCertexportcert.cpp
     文件         298  2009-07-02 10:13  ePass3000Linux1.1sampleExportCertexportcert.h
     文件         451  2009-07-02 10:13  ePass3000Linux1.1sampleExportCertmain.cpp
     目录           0  2010-09-27 11:59  ePass3000Linux1.1sampleGetPinInfo
     文件        2373  2009-07-02 10:13  ePass3000Linux1.1sampleGetPinInfoGetPinInfo.cpp
     文件         301  2009-07-02 10:13  ePass3000Linux1.1sampleGetPinInfoGetPinInfo.h
     文件         136  2009-07-02 10:13  ePass3000Linux1.1sampleGetPinInfoMakefile
............此处省略354个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)