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

📄 zdmread.c

📁 voltage 公司提供的一个开发Ibe的工具包
💻 C
字号:
/* Copyright 2003-2005, Voltage Security, all rights reserved.
 */
#include "vibe.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "securemail.h"
#include "zdm.h"

int VoltOldZDMReadInit (
   VtZDMObject zdmObj
   )
{
  VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;

  return (VoltZDMReadInit ((VtSecureMailObject)(zObj->localCtx)));
}

int VoltOldZDMReadUpdate (
   VtZDMObject zdmObj,
   unsigned char *message,
   unsigned int messageLen,
   unsigned int *bytesRead,
   unsigned char *outputData,
   unsigned int bufferSize,
   unsigned int *outputDataLen
   )
{
  VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;

  if ((bytesRead == (unsigned int*)0) || (outputDataLen == (unsigned int*)0))
    return VT_ERROR_NULL_ARG;
    
  return (VoltSecureMailReadUpdate (
    (VtSecureMailObject)(zObj->localCtx), message, messageLen, bytesRead,
    outputData, bufferSize, outputDataLen));
}

int VoltOldZDMReadFinal (
   VtZDMObject zdmObj,
   unsigned char *message,
   unsigned int messageLen,
   unsigned int *bytesRead,
   unsigned char *outputData,
   unsigned int bufferSize,
   unsigned int *outputDataLen
   )
{
  VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;

  if ((bytesRead == (unsigned int*)0) || (outputDataLen == (unsigned int*)0))
    return VT_ERROR_NULL_ARG;
    
  return (VoltSecureMailReadFinal (
    (VtSecureMailObject)(zObj->localCtx), message, messageLen, bytesRead,
    outputData, bufferSize, outputDataLen));
}

int VoltOldZDMVerify (
   VtZDMObject zdmObj,
   VtPolicyCtx policyCtx,
   VtStorageCtx storageCtx,
   VtTransportCtx transportCtx,
   VtCertVerifyCtx certVerifyCtx,
   Pointer verifyCtxInfo,
   VtVerifyStack verifyStack,
   unsigned int *verifyResult
   )
{
  VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;

  return (VoltSecureMailVerify (
    (VtSecureMailObject)(zObj->localCtx), policyCtx, storageCtx,
    transportCtx, certVerifyCtx, verifyCtxInfo, verifyStack, verifyResult));
}

int VoltZDMReadInit (
   VtSecureMailObject secureMailObj
   )
{
  int status;
  VoltSecureMailObject *obj = (VoltSecureMailObject *)secureMailObj;

  do
  {
    /* The state must be VOLT_SECURE_MAIL_STATE_READ_SET, if not,
     * we're not allowed to call ReadInit.
     */
    status = VT_ERROR_INVALID_CALL_ORDER;
    if (obj->state != VOLT_ZDM_STATE_READ_SET)
      break;

    /* Init the subordinate objects.
     */
    status = VtPkcs7ReadInit (obj->p7SignedData);
    if (status != 0)
      break;

    status = VtPkcs7ReadInit (obj->p7EnvelopedData);
    if (status != 0)
      break;

    status = VtDecodeInit (obj->base64);
    if (status != 0)
      break;

    obj->state = VOLT_ZDM_STATE_READ_INIT;

  } while (0);

  return (status);
}

⌨️ 快捷键说明

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