⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 certificat.cpp

📁 PKCS#11的微软CSP实现源码
💻 CPP
字号:
// Certificat.cpp: implementation of the CCertificat class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "CertInstall.h"
#include "Certificat.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CCertificat::CCertificat()
{
  m_strContainerName = NULL;
  m_ucValueCert = NULL;
  m_ulValueCertLen = 0;
}

CCertificat::~CCertificat()
{
  /*if (m_strContainerName){ free((char*)m_strContainerName);     m_strContainerName = NULL;}
  if (m_ucValueCert)     { free((unsigned char*)m_ucValueCert); m_ucValueCert = NULL;}
  if (m_strLabel)        { free((char*)m_strLabel);             m_strLabel = NULL;}
  m_ulValueCertLen = 0;*/

}

void CCertificat::setContName(char * strContainerName)
{
  m_strContainerName = (char*)malloc (sizeof(char)*strlen(strContainerName)+1);
  strcpy(m_strContainerName, strContainerName);
}

void CCertificat::setValueCert(unsigned char * ucValueCert, int ulValueCertLen)
{
  m_ulValueCertLen = ulValueCertLen;
  m_ucValueCert = (unsigned char*)malloc(sizeof(unsigned char*)*m_ulValueCertLen);
  memcpy(m_ucValueCert, ucValueCert, m_ulValueCertLen);
}

void CCertificat::setLabel(char * strLabel)
{
  m_strLabel = (char*)malloc (sizeof(char)*strlen(strLabel)+1);
  strcpy(m_strLabel, strLabel);
}

char * CCertificat::getContName()
{
  return m_strContainerName;
}

unsigned char * CCertificat::getValueCert()
{
  return m_ucValueCert;
}

unsigned long CCertificat::getValueCertLen()
{
  return m_ulValueCertLen;
}

char * CCertificat::getLabel()
{
  return m_strLabel;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -