📄 zdmread.c
字号:
/* Copyright 2003-2006, Voltage Security, all rights reserved.
*/
#include "vibe.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "securemail.h"
#include "zdm.h"
#include "errorctx.h"
int VoltOldZDMReadInit (
VtZDMObject zdmObj
)
{
int status;
VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;
VOLT_DECLARE_FNCT_LINE (fnctLine)
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltZDMReadInit ((VtSecureMailObject)(zObj->localCtx));
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, zdmObj, status, 0, 0,
(char *)0, "VoltOldZDMReadInit", fnctLine, (char *)0)
return (status);
}
int VoltOldZDMReadUpdate (
VtZDMObject zdmObj,
unsigned char *message,
unsigned int messageLen,
unsigned int *bytesRead,
unsigned char *outputData,
unsigned int bufferSize,
unsigned int *outputDataLen
)
{
int status;
VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_NULL_ARG;
if ((bytesRead != (unsigned int*)0) && (outputDataLen != (unsigned int*)0))
{
VOLT_SET_ERROR_TYPE (errorType, 0)
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltSecureMailReadUpdate (
(VtSecureMailObject)(zObj->localCtx), message, messageLen, bytesRead,
outputData, bufferSize, outputDataLen);
}
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, zdmObj, status, 0, errorType,
(char *)0, "VoltOldZDMReadUpdate", fnctLine, (char *)0)
return (status);
}
int VoltOldZDMReadFinal (
VtZDMObject zdmObj,
unsigned char *message,
unsigned int messageLen,
unsigned int *bytesRead,
unsigned char *outputData,
unsigned int bufferSize,
unsigned int *outputDataLen
)
{
int status;
VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_NULL_ARG;
if ((bytesRead != (unsigned int*)0) && (outputDataLen != (unsigned int*)0))
{
VOLT_SET_ERROR_TYPE (errorType, 0)
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltSecureMailReadFinal (
(VtSecureMailObject)(zObj->localCtx), message, messageLen, bytesRead,
outputData, bufferSize, outputDataLen);
}
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, zdmObj, status, 0, errorType,
(char *)0, "VoltOldZDMReadFinal", fnctLine, (char *)0)
return (status);
}
int VoltOldZDMVerify (
VtZDMObject zdmObj,
VtPolicyCtx policyCtx,
VtStorageCtx storageCtx,
VtTransportCtx transportCtx,
VtCertVerifyCtx certVerifyCtx,
Pointer verifyCtxInfo,
VtVerifyFailureList vfyFailList,
unsigned int *verifyResult
)
{
int status;
VoltZDMObject *zObj = (VoltZDMObject *)zdmObj;
VOLT_DECLARE_FNCT_LINE (fnctLine)
VOLT_SET_FNCT_LINE (fnctLine)
status = VoltSecureMailVerify (
(VtSecureMailObject)(zObj->localCtx), policyCtx, storageCtx,
transportCtx, certVerifyCtx, verifyCtxInfo, vfyFailList, verifyResult);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, zdmObj, status, 0, 0,
(char *)0, "VoltOldZDMVerify", fnctLine, (char *)0)
return (status);
}
int VoltZDMReadInit (
VtSecureMailObject secureMailObj
)
{
int status;
VoltSecureMailObject *obj = (VoltSecureMailObject *)secureMailObj;
VOLT_DECLARE_ERROR_TYPE (errorType)
VOLT_DECLARE_FNCT_LINE (fnctLine)
do
{
/* The state must be VOLT_SECURE_MAIL_STATE_READ_SET, if not,
* we're not allowed to call ReadInit.
*/
VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
VOLT_SET_FNCT_LINE (fnctLine)
status = VT_ERROR_INVALID_CALL_ORDER;
if (obj->state != VOLT_ZDM_STATE_READ_SET)
break;
/* Init the subordinate objects.
*/
VOLT_SET_ERROR_TYPE (errorType, 0)
VOLT_SET_FNCT_LINE (fnctLine)
status = VtPkcs7ReadInit (obj->p7SignedData);
if (status != 0)
break;
VOLT_SET_FNCT_LINE (fnctLine)
status = VtPkcs7ReadInit (obj->p7EnvelopedData);
if (status != 0)
break;
VOLT_SET_FNCT_LINE (fnctLine)
status = VtDecodeInit (obj->base64);
if (status != 0)
break;
obj->state = VOLT_ZDM_STATE_READ_INIT;
} while (0);
VOLT_LOG_ERROR_INFO_COMPARE (
status, 0, secureMailObj, status, 0, errorType,
(char *)0, "VoltZDMReadInit", fnctLine, (char *)0)
return (status);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -