亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? smwrite.c

?? IBE是一種非對(duì)稱(chēng)密碼技術(shù)
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
/* Copyright 2003-2006, Voltage Security, all rights reserved.
 */
#include "vibe.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "securemail.h"
#include "policy.h"
#include "vtime.h"
#include "errorctx.h"

/* Call this function when obj->dataLen is set, but that info has not
 * been passed down to the P7 and B64 objects.
 * <p>Once we know the total length of data that will be passed to the
 * SecureMail object, we can figure out how many bytes will be passed
 * to the P7 signer object. We can then figure out how big the
 * SignedData will be, which will be passed to the P7 enveloper. The
 * result of that will be passed to the Base64 encoder.
 * <p>This function will set the fields inside the writeCtx that hold
 * the lengths of these elements.
 *
 * @param obj The SecureMail object set with the info.
 * @param writeCtx The context with the objects and fields to set.
 * @param random The random object, calls to P7 functions will have
 * this as an arg.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV SetTotalLengths VOLT_PROTO_LIST ((
   VoltSecureMailObject *obj,
   VoltSecureMailWriteCtx *writeCtx,
   VtRandomObject random
));

/* Append the given data to the given VtItem.
 * <p>This function will allocate the data to hold the old info and the
 * new info, copy the old info into the new buffer, then copy the new
 * info after the old info. It will then place any trailingCharacters.
 * <p>The trailingCharacters might be NULL (nothing to append), or
 * maybe they are new line characters, or maybe they are
 * NULL-terminating characters.
 * <p>This function assumes theItem points to a vaild VtItem.
 * <p>The data field of theItem can be NULL. In other words, the call
 * to Append can place the first block of data into theItem.
 * <p>If dataToAppend or trailingCharacters is NULL, then the
 * affiliated length arg (dataToAppendLen and trailingCharactersLen)
 * must be 0.
 * <p>This function does not check the args, it is the responsibility
 * of the caller not to make mistakes.
 */
static int VOLT_CALLING_CONV AppendToVtItem VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   unsigned char *dataToAppend,
   unsigned int dataToAppendLen,
   unsigned char *trailingCharacters,
   unsigned int trailingCharactersLen,
   VtItem *theItem
));

/* This creates an ASCII string (NULL-terminated) version of theNum in
 * decimal.
 * <p>For example, the number 0x0000006B is converted to a string of
 * length 4: 0x31, 0x30, 0x37, 0x00. That is the string "107".
 */
int VOLT_CALLING_CONV ConvertNumToAsciiAlloc VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   UInt32 theNumLo,
   UInt32 theNumHi,
   char **asciiNum,
   unsigned int *asciiNumLen
));

int VoltSecureMailWriteInit (
   VtSecureMailObject secureMailObj,
   VtPolicyCtx policyCtx,
   VtStorageCtx storageCtx,
   VtTransportCtx transportCtx,
   VtRandomObject random
   )
{
  int status;
  unsigned int index, elementLen, newLineLen;
  VoltSecureMailObject *obj = (VoltSecureMailObject *)secureMailObj;
  VoltSecureMailWriteCtx *writeCtx = (VoltSecureMailWriteCtx *)(obj->localCtx);
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);
  VoltPolicyCtx *pCtx;
  VtItem *getItem = (VtItem *)0;
  char *contentType = VOLT_DEFAULT_CONTENT_TYPE;
  VtBase64Info b64Info;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    /* Create the Base64 object. We couldn't create it until we had the
     * new line issue settled.
     */
    if (obj->base64 != (VtAlgorithmObject)0)
      VtDestroyAlgorithmObject (&(obj->base64));

    b64Info.base64BlockSize = 64;
    b64Info.newLineCharacter = VT_BASE64_NEW_LINE_LF;
    if (writeCtx->itemArray[VOLT_WRITE_SM_ITEM_NEW_LINE].len == 2)
      b64Info.newLineCharacter = VT_BASE64_NEW_LINE_CR_LF;
    b64Info.errorCheck = VT_BASE64_NO_ERROR_CHECK;
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtCreateAlgorithmObject (
      (VtLibCtx)libCtx, VtAlgorithmImplBase64, (Pointer)&b64Info,
      &(obj->base64));
    if (status != 0)
      break;

    /* Init the subordinate objects.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtPkcs7WriteInit (
      obj->p7SignedData, policyCtx, storageCtx, transportCtx, random);
    if (status != 0)
      break;

    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtPkcs7WriteInit (
      obj->p7EnvelopedData, policyCtx, storageCtx, transportCtx, random);
    if (status != 0)
      break;

    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtEncodeInit (obj->base64);
    if (status != 0)
      break;

    /* If there's no content type, use the default.
     */
    if (obj->contentInfo.data == (unsigned char *)0)
    {
      VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VT_ERROR_MEMORY;
      obj->contentInfo.data = (unsigned char *)Z2Malloc (
        VOLT_DEFAULT_CONTENT_TYPE_LEN + 1, 0);
      if (obj->contentInfo.data == (unsigned char *)0)
        break;
      Z2Memcpy (
        obj->contentInfo.data, contentType, VOLT_DEFAULT_CONTENT_TYPE_LEN);
      obj->contentInfo.data[VOLT_DEFAULT_CONTENT_TYPE_LEN] = 0;
      obj->contentInfo.len = VOLT_DEFAULT_CONTENT_TYPE_LEN;
    }

    /* Get elements out of the policy ctx. If there is no policy ctx,
     * we're done.
     */
    if (policyCtx == (VtPolicyCtx)0)
      break;

    pCtx = (VoltPolicyCtx *)policyCtx;

    /* Get any header.
     */
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    index = VOLT_POLICY_GET_SECURE_MAIL_HEADER;
    status = pCtx->PolicyGetInfoAlloc (
      policyCtx, VOLT_POLICY_GET_SECURE_MAIL_HEADER,
      (Pointer)&index, (Pointer *)&getItem);
    if (status != 0)
      break;

    if (getItem != (VtItem *)0)
    {
      if ( (getItem->data != (unsigned char *)0) && (getItem->len != 0) )
      {
        VOLT_SET_FNCT_LINE (fnctLine)
        status = VoltCopyItemDataAlloc (
          obj->voltObject.libraryCtx, 0, 0, getItem,
          &(writeCtx->itemArray[VOLT_WRITE_SM_ITEM_HEADER]));
        if (status != 0)
          break;
      }

      /* Free the getItem data so we can use the variable again.
       */
      pCtx->PolicyGetInfoFree (policyCtx, (Pointer)getItem);
      getItem = (VtItem *)0;
    }

    /* Get any footer.
     */
    // For now, leave this out. The current client does not work the
    // way we want it to, so we'll put this in when we decide how to do
    // everything just the way we want.
//    status = pCtx->PolicyGetInfoAlloc (
//      policyCtx, VOLT_POLICY_GET_CONTENT_FOOTER, (Pointer)0,
//      (Pointer *)&getItem);
//    if (status != 0)
//      break;

    newLineLen = writeCtx->itemArray[VOLT_WRITE_SM_ITEM_NEW_LINE].len;
    if (getItem != (VtItem *)0)
    {
      /* Copy the footer with a new line at the front.
       */
      if ( (getItem->data != (unsigned char *)0) && (getItem->len != 0) )
      {
        VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
        VOLT_SET_FNCT_LINE (fnctLine)
        status = VT_ERROR_MEMORY;
        writeCtx->itemArray[VOLT_WRITE_SM_ITEM_CONTENT_FOOTER].data =
          (unsigned char *)Z2Malloc (
          getItem->len + newLineLen, VOLT_MEMORY_SENSITIVE);
        if (writeCtx->itemArray[VOLT_WRITE_SM_ITEM_CONTENT_FOOTER].data ==
          (unsigned char *)0)
          break;
        Z2Memcpy (
          writeCtx->itemArray[VOLT_WRITE_SM_ITEM_CONTENT_FOOTER].data,
          writeCtx->itemArray[VOLT_WRITE_SM_ITEM_NEW_LINE].data, newLineLen);
        Z2Memcpy (
          writeCtx->itemArray[VOLT_WRITE_SM_ITEM_CONTENT_FOOTER].data +
          newLineLen, getItem->data, getItem->len);
        writeCtx->itemArray[VOLT_WRITE_SM_ITEM_CONTENT_FOOTER].len =
          getItem->len + newLineLen;
        status = 0;
      }
    }

    /* Sum up the preliminary and trailing lengths.
     */
    for (index = VOLT_WRITE_SM_HEAD_INDEX_START;
         index <= VOLT_WRITE_SM_HEAD_INDEX_END; ++index)
    {
      /* Add in the length of the actual data to write out.
       * If there is data to write out, add a newLine.
       */
      elementLen = writeCtx->itemArray[index].len;
      if (elementLen != 0)
        elementLen += newLineLen;
      writeCtx->prelimLen += elementLen;
    }

    for (index = VOLT_WRITE_SM_FOOT_INDEX_START;
         index <= VOLT_WRITE_SM_FOOT_INDEX_END; ++index)
    {
      /* Add in the length of the actual data to write out.
       * If there is data to write out, add a newLine.
       */
      elementLen = writeCtx->itemArray[index].len;
      if (elementLen != 0)
        elementLen += newLineLen;
      writeCtx->trailLen += elementLen;
    }

    obj->state = VOLT_SECURE_MAIL_STATE_WRITE_INIT;

  } while (0);

  if (getItem != (VtItem *)0)
    pCtx->PolicyGetInfoFree (policyCtx, (Pointer)getItem);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, 0, secureMailObj, status, 0, errorType,
    (char *)0, "VoltSecureMailWriteInit", fnctLine, (char *)0)

  return (status);
}

int VoltSecureMailWriteUpdate (
   VtSecureMailObject secureMailObj,
   VtRandomObject random,
   unsigned char *inputData,
   unsigned int inputDataLen,
   unsigned char *message,
   unsigned int bufferSize,
   unsigned int *messageLen
   )
{
  int status;
  unsigned int index, offset, elementLen, newLineLen, preliminaryLen;
  unsigned int contentReportLen, signedDataLen, envelopedDataLen, b64Len;
#if VT_64_BIT_LENGTH == 64
  VtUInt64 msgLen;
#else
  unsigned int msgLen;
#endif
  unsigned char *newLine;
  unsigned char *sBuffer = (unsigned char *)0;
  unsigned char *eBuffer = (unsigned char *)0;
  VoltSecureMailObject *obj = (VoltSecureMailObject *)secureMailObj;
  VoltSecureMailWriteCtx *writeCtx = (VoltSecureMailWriteCtx *)(obj->localCtx);
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);
  VtItem *preP7 = &(writeCtx->itemArray[VOLT_WRITE_SM_PRE_PKCS7]);
  VoltEncodeDecodeSizeInfo encodeDecodeSizeInfo;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    /* How big is the output going to be?
     */
    if (obj->state == VOLT_SECURE_MAIL_STATE_WRITE_INIT)
    {
      /* If the state is INIT, we have not set the lengths of the P7
       * objects yet.
       */
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = SetTotalLengths (obj, writeCtx, random);
      if (status != 0)
        break;
    }

    /* If the state is INIT_LEN, we've set the lengths of the P7
     * objects, but we still haven't written out any preliminary info.
     * We also need to send to the Sign object the content report.
     * If the state is not INIT_LEN, it must be UPDATE, we can call
     * UPDATE only after Init or another Update call.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_CALL_ORDER;
    preliminaryLen = 0;
    contentReportLen = 0;
    if (obj->state == VOLT_SECURE_MAIL_STATE_WRITE_INIT_LEN)
    {
      preliminaryLen = writeCtx->prelimLen;
      contentReportLen =
        writeCtx->itemArray[VOLT_WRITE_SM_ITEM_CONTENT_REPORT].len;
    }
    else if (obj->state != VOLT_SECURE_MAIL_STATE_WRITE_UPDATE)
    {
      break;
    }

    /* Make sure the inputLen is valid.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_INPUT_LENGTH;
#if VT_64_BIT_LENGTH == 64
    if ((obj->inputLen64 + (VtUInt64)inputDataLen) > obj->dataLen64)
#else
    if ((obj->inputLen + inputDataLen) > obj->dataLen)
#endif
      break;

    /* How long will the SignedData be?
     * The variable contentReportLen contains the length of
     * contentReport, unless we've already written it out, in which
     * case, that variable is set to 0.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_INPUT_LENGTH;
    signedDataLen = inputDataLen + contentReportLen;
    if (signedDataLen < inputDataLen)
      break;

    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtPkcs7WriteUpdate (
      obj->p7SignedData, random, (unsigned char *)0, signedDataLen,
      (unsigned char *)0, 0, &signedDataLen);
    if (status == 0)
      status = VT_ERROR_GENERAL;
    if (status != VT_ERROR_BUFFER_TOO_SMALL)
      break;

    /* How long will the envelopedData be?
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtPkcs7WriteUpdate (
      obj->p7EnvelopedData, random, (unsigned char *)0, signedDataLen,
      (unsigned char *)0, 0, &envelopedDataLen);
    if (status == 0)
      status = VT_ERROR_GENERAL;
    if (status != VT_ERROR_BUFFER_TOO_SMALL)
      break;

    /* How long will the Base64 be?
     */
    encodeDecodeSizeInfo.dataToProcess = (unsigned char *)0;
#if VT_64_BIT_LENGTH == 64
    encodeDecodeSizeInfo.dataToProcessLen =
      (VtUInt64)envelopedDataLen + (VtUInt64)(preP7->len);
#else
    encodeDecodeSizeInfo.dataToProcessLen = envelopedDataLen + preP7->len;
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_INPUT_LENGTH;
    if (encodeDecodeSizeInfo.dataToProcessLen < envelopedDataLen)
      break;
#endif

    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = obj->GetEncodeDecodeSize (
      obj->base64, (VtRandomObject)0, VOLT_CALLER_ENCODE_UPDATE,
      &encodeDecodeSizeInfo);
    if (status != VT_ERROR_BUFFER_TOO_SMALL)
      break;

    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_INPUT_LENGTH;
    msgLen = encodeDecodeSizeInfo.processedDataLen;
#if VT_64_BIT_LENGTH == 64
    msgLen += (VtUInt64)preliminaryLen;
    if (msgLen > (VtUInt64)0xffffffff)
      break;

    *messageLen = (unsigned int)msgLen;
#else
    msgLen += preliminaryLen;
    if (msgLen < preliminaryLen)
      break;

    *messageLen = msgLen;
#endif

    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_BUFFER_TOO_SMALL;
    if (bufferSize < *messageLen)
      break;

    /* If the caller passed NULL input with non-zero inputLen, they
     * just wanted the length, don't process.
     */

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
最新日韩av在线| 成人性色生活片免费看爆迷你毛片| 亚洲精品国产a| 自拍偷拍亚洲综合| 国产精品久久三区| 中文字幕日韩av资源站| 国产精品久久久久久久久动漫| 久久色在线视频| 久久久亚洲午夜电影| 国产丝袜在线精品| 国产精品高潮久久久久无| 国产精品久久久久四虎| 国产精品久久久久久久久动漫 | 91麻豆精品国产| 9191国产精品| 555www色欧美视频| 日韩欧美成人激情| 久久嫩草精品久久久久| 欧美激情中文字幕一区二区| 国产精品久久久久影院| 亚洲三级免费观看| 亚洲成人久久影院| 免费不卡在线视频| 国产乱码字幕精品高清av| 成人午夜电影久久影院| 91丨九色丨蝌蚪富婆spa| 欧美日韩一级片网站| 欧美一区二区福利在线| 久久久青草青青国产亚洲免观| 欧美国产一区在线| 一区二区三区在线播放| 日韩电影免费在线看| 国产精品一区免费视频| 99riav久久精品riav| 欧美日韩在线播放| 欧美精品一区二区三区四区| 中文字幕精品一区二区三区精品| 亚洲三级免费观看| 美女视频黄频大全不卡视频在线播放 | 一区二区三区日韩在线观看| 午夜精品久久久久| 狠狠狠色丁香婷婷综合激情| aaa亚洲精品一二三区| 欧美色老头old∨ideo| 亚洲精品在线三区| 最近日韩中文字幕| 天堂成人国产精品一区| 国产精品99久久久久久宅男| 色综合久久66| 亚洲精品一区二区精华| 亚洲精品日韩综合观看成人91| 日韩精品高清不卡| 成人av网站在线观看免费| 欧美性猛交xxxx乱大交退制版| 日韩精品一区二区三区三区免费| 国产精品家庭影院| 久久99久久精品| 91成人网在线| 国产欧美一区视频| 日本伊人精品一区二区三区观看方式| 国产精品自拍毛片| 欧美日韩亚洲高清一区二区| 欧美国产欧美亚州国产日韩mv天天看完整 | 56国语精品自产拍在线观看| 国产精品久久网站| 国精产品一区一区三区mba桃花 | 欧美日韩国产成人在线免费| 国产欧美精品一区二区三区四区| 天天射综合影视| 一本大道综合伊人精品热热| 久久网站热最新地址| 午夜影院在线观看欧美| 波多野结衣亚洲一区| 欧美一级欧美一级在线播放| 亚洲精品一卡二卡| 粉嫩aⅴ一区二区三区四区五区| 777午夜精品免费视频| 亚洲狼人国产精品| 粉嫩av亚洲一区二区图片| 日韩一级黄色大片| 亚洲国产欧美在线| 91麻豆国产福利精品| 国产欧美日本一区视频| 国内外精品视频| 日韩欧美高清在线| 日韩和欧美一区二区三区| 色菇凉天天综合网| 亚洲欧美综合另类在线卡通| 东方aⅴ免费观看久久av| 精品日韩欧美在线| 日韩国产一二三区| 在线成人小视频| 亚洲综合偷拍欧美一区色| k8久久久一区二区三区 | 激情综合色综合久久| 制服丝袜一区二区三区| 视频一区二区中文字幕| 欧美亚洲动漫精品| 亚洲一级二级在线| 在线亚洲精品福利网址导航| 日韩美女久久久| 99久久精品免费看国产| 中文字幕在线免费不卡| k8久久久一区二区三区 | 无吗不卡中文字幕| 欧美人妖巨大在线| 天堂久久一区二区三区| 欧美一卡在线观看| 蜜臀av性久久久久av蜜臀妖精| 欧美日本精品一区二区三区| 视频一区二区国产| 日韩欧美一二三| 国产真实精品久久二三区| 久久免费国产精品| 国产一区在线观看麻豆| 久久免费看少妇高潮| 不卡一二三区首页| 亚洲欧美另类综合偷拍| 欧美在线制服丝袜| 婷婷综合另类小说色区| 欧美一级淫片007| 国产一二精品视频| 欧美国产精品一区二区三区| 91在线porny国产在线看| 亚洲综合另类小说| 3d动漫精品啪啪| 毛片av中文字幕一区二区| 久久久久国色av免费看影院| 9l国产精品久久久久麻豆| 一区二区欧美视频| 日韩视频一区二区三区在线播放| 国产中文字幕精品| 成人免费在线视频观看| 在线免费不卡视频| 免费看欧美美女黄的网站| 国产午夜精品一区二区三区视频| 99免费精品视频| 日欧美一区二区| 久久综合色之久久综合| 91蝌蚪porny九色| 蜜桃视频一区二区| 亚洲国产成人一区二区三区| 欧洲亚洲国产日韩| 美女高潮久久久| 中文字幕一区二区在线播放| 欧美日韩精品欧美日韩精品| 国产精品一区在线观看乱码| 樱花影视一区二区| 精品国产成人系列| 91网站在线观看视频| 蜜芽一区二区三区| 国产精品乱子久久久久| 欧美日本国产视频| 成人免费看视频| 日本欧美一区二区在线观看| 国产精品天干天干在线综合| 欧美日韩一本到| 国产盗摄精品一区二区三区在线 | 奇米精品一区二区三区在线观看| 亚洲精品一区二区在线观看| 91偷拍与自偷拍精品| 麻豆91免费看| 亚洲精品水蜜桃| 精品欧美一区二区久久 | 久久久99精品久久| 欧美日本精品一区二区三区| 懂色av中文一区二区三区| 午夜在线成人av| 国产精品福利一区二区三区| 日韩欧美激情在线| 91官网在线观看| 成人在线视频首页| 看电视剧不卡顿的网站| 亚洲国产精品久久不卡毛片| 国产精品视频第一区| 欧美成人国产一区二区| 欧美最新大片在线看| 盗摄精品av一区二区三区| 日本最新不卡在线| 亚洲欧美乱综合| 国产精品日韩精品欧美在线| 欧美一级在线免费| 欧美日韩精品一区视频| 91啪在线观看| 成人免费av资源| 国产资源在线一区| 美女网站色91| 日本在线不卡视频一二三区| 亚洲妇女屁股眼交7| 国产精品伦理一区二区| 久久九九全国免费| 久久婷婷成人综合色| 欧美成人精品高清在线播放| 91精品国产色综合久久| 欧美色大人视频| 在线视频综合导航| 色综合一区二区| 94色蜜桃网一区二区三区| thepron国产精品| 成人激情文学综合网|