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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? writeenv.c

?? IBE是一種非對稱密碼技術
?? C
?? 第 1 頁 / 共 3 頁
字號:
    /* The state must be INIT or UPDATE.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_CALL_ORDER;
    if ( (obj->state != VOLT_P7_STATE_ENV_WRITE_INIT) &&
         (obj->state != VOLT_P7_STATE_ENV_WRITE_UPDATE) )
      break;

    /* Make sure the total input len is the same as the "predicted" len.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_INPUT_LENGTH;
#if VT_64_BIT_LENGTH == 64
    if (((VtUInt64)inputDataLen + obj->inputLen64) != obj->dataLen64)
#else
    if ((inputDataLen + obj->inputLen) != obj->dataLen)
#endif
      break;

    /* If we reach this point and there is data to process, it is of
     * the appropriate length. How big is WriteUpdate, then how big is
     * DecryptFinal?
     */
    if (inputDataLen != 0)
    {
      /* If the return from this call is not 0, it might be
       * BUFFER_TOO_SMALL. But we'll pass that one along as well.
       */
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VoltP7EnvWriteUpdate (
        pkcs7Obj, random, inputData, inputDataLen,
        message, bufferSize, messageLen);
      if (status != 0)
        break;
    }

    /* If we hit this point, we successfully finished writing the
     * message.
     */
    status = 0;
    obj->state = VOLT_P7_STATE_ENV_WRITE_FINAL;

  } while (0);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, 0, pkcs7Obj, status, 0, errorType,
    (char *)0, "VoltP7EnvWriteFinal", fnctLine, (char *)0)

  return (status);
}

int VoltBuildRecipientData (
   VoltObject *obj,
   VtRandomObject random,
   VtAlgorithmObject base64,
   VtDerCoder *ibeAlg,
   unsigned char *symKeyData,
   unsigned int symKeyDataLen,
   VoltRecipientData *recipientData
   )
{
  int status;
  unsigned int issuerSerialLen, encryptedKeyLen, encodingLen;
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->libraryCtx);
  VoltIdentityObject *idObj;
  Asn1AlgorithmId *algIdObj = (Asn1AlgorithmId *)0;
  unsigned char *issuerSerial = (unsigned char *)0;
  unsigned char *encryptedKey = (unsigned char *)0;
  VoltSurrenderCtx *surrCtx = (VoltSurrenderCtx *)0;
  VtSurrenderCallback surrenderCtx;
  VtDerCoderInfo coderInfo;
  unsigned char ibeAlgId[VoltMaxIBEAlgIDLen];
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    /* Build the IssuerSerial construct.
     */
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VoltBuildIssuerSerialAlloc (
      libCtx, recipientData->idRef, base64, &issuerSerial, &issuerSerialLen);
    if (status != 0)
      break;

    idObj = (VoltIdentityObject *)(recipientData->idRef);

    /* Which IBE alg should we use?
     */
    coderInfo.info.encodeData.libCtx = libCtx;
    coderInfo.info.encodeData.info = (Pointer)0;
    coderInfo.info.encodeData.encoding = ibeAlgId;
    coderInfo.info.encodeData.bufferSize = sizeof (ibeAlgId);
    coderInfo.info.encodeData.encodingLen = &encodingLen;
    VOLT_SET_FNCT_LINE (fnctLine)
    status = ibeAlg (&coderInfo, (Pointer)0, VOLT_DER_TYPE_ENCODE_FLAG);
    if (status != 0)
      break;

    /* To build an object using a DerCoder, we need the algId in the
     * form of an Asn1AlgorithmId.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)   
    status = VT_ERROR_MEMORY;
    algIdObj = Asn1AlgorithmId_new ();
    if (algIdObj == (Asn1AlgorithmId *)0)      
      break;    

    VOLT_SET_FNCT_LINE (fnctLine)
    if (Asn1ObjectId_set (algIdObj->oid, ibeAlgId + 4, encodingLen - 6) != 1)
      break;

    /* To build an object using a DerCoder, we need to start with an
     * empty object.
     */
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VoltCreateObject (
      (VtLibCtx)libCtx, (VoltObject **)&(recipientData->asymEncryptor),
      sizeof (VoltAlgorithmObject), VOLT_OBJECT_TYPE_ALGORITHM);
    if (status != 0)
      break;

    coderInfo.info.decodeData.type = VOLT_DER_TYPE_ALG_ID_FLAG;
    coderInfo.info.decodeData.asn1Object = (Pointer)algIdObj;
    coderInfo.info.decodeData.info = (Pointer)0;
    VOLT_SET_FNCT_LINE (fnctLine)
    status = ibeAlg (
      &coderInfo, (Pointer)&(recipientData->asymEncryptor),
      VOLT_DER_TYPE_DECODE_FLAG);
    if (status != 0)
      break;

    /* If there's a surrender ctx, pass it on to the encryptor.
     */
    if ( ((obj->objectType & VOLT_OBJECT_TYPE_SURRENDER) != 0) &&
         (obj->surrenderCtx != (Pointer)0) )
    {
      surrCtx = (VoltSurrenderCtx *)(obj->surrenderCtx);
      /* Set the encryption object with the surrender ctx, but don't copy
       * the appData, just copy a reference, so we're still using the
       * P7 object's appData.
       */
      surrenderCtx.Surrender = surrCtx->Surrender;
      surrenderCtx.appData = surrCtx->appData;
      surrenderCtx.AppDataCopy = (VtSurrenderAppDataCopy)0;
      surrenderCtx.AppDataFree = (VtSurrenderAppDataFree)0;
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VtSetAlgorithmParam (
        recipientData->asymEncryptor, VtAlgorithmParamSurrenderCallback,
        (Pointer)&surrenderCtx);
      if (status != 0)
        break;
    }

    /* Build the key object from the identity.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtCreateKeyObject (
      (VtLibCtx)libCtx, VtKeyImplMpCtx, (Pointer)(idObj->mpCtx),
      &(recipientData->asymKey));
    if (status != 0)
      break;

    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtBuildIBEPublicKey (
      (VtIdentityObject)idObj, VT_ENCODE_IBCS_2_V_DISTRICT, (VtPolicyCtx)0,
      (VtStorageCtx)0, (VtTransportCtx)0, recipientData->asymKey);
    if (status != 0)
      break;

    /* Encrypt the key data.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtEncryptInit (
      recipientData->asymEncryptor, recipientData->asymKey);
    if (status != 0)
      break;

    /* First, how big is the output.
     * Don't call this routine for now. The function will encrypt the
     * data when determining size, then encrypt again when encrypting
     * into caller-supplied buffer. So calculate "by hand".
     * The length is primeLen + SHA-1 len + dataToEncryptLen. Use max
     * prime len.
     */
/*    status = VtEncryptFinal (
      recipientData->asymEncryptor, random, symKeyData, symKeyDataLen,
      (unsigned char *)0, 0, &encryptedKeyLen);
    if (status == 0)
      status = VT_ERROR_GENERAL;
    if (status != VT_ERROR_BUFFER_TOO_SMALL)
      break;
*/
    encryptedKeyLen = 276 + symKeyDataLen;

    /* Build the buffer into which we'll place the encrypted key.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_MEMORY;
    encryptedKey = (unsigned char *)Z2Malloc (encryptedKeyLen, 0);
    if (encryptedKey == (unsigned char *)0)
      break;

    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtEncryptFinal (
      recipientData->asymEncryptor, random, symKeyData, symKeyDataLen,
      encryptedKey, encryptedKeyLen, &encryptedKeyLen);
    if (status != 0)
      break;

    /* Create the ASN.1 object that is the recipientInfo.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_MEMORY;
    recipientData->recipInfo = Asn1RecipientInfo_new ();
    if (recipientData->recipInfo == (Asn1RecipientInfo *)0)
      break;

    /* Set fields we can set.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    if (ASN1_INTEGER_set (recipientData->recipInfo->version, 0) != 1)
      break;

    VOLT_SET_FNCT_LINE (fnctLine)
    if (Asn1Encoded_set (
      recipientData->recipInfo->issuerSerial,
      issuerSerial, issuerSerialLen) != 1)
      break;

    VOLT_SET_FNCT_LINE (fnctLine)
    if (Asn1Encoded_set (
      recipientData->recipInfo->keyEncAlg, ibeAlgId,
      encodingLen) != 1)
      break;

    VOLT_SET_FNCT_LINE (fnctLine)
    if (ASN1_OCTET_STRING_set (
      recipientData->recipInfo->encryptedKey,
      encryptedKey, encryptedKeyLen) != 1)
      break;

    /* How long will the RecipientInfo be?
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_INPUT;
    recipientData->recipInfoLen = i2d_Asn1RecipientInfo (
      recipientData->recipInfo, (unsigned char **)0);
    if (recipientData->recipInfoLen == 0)
      break;

    status = 0;

  } while (0);

  if (issuerSerial != (unsigned char *)0)
    Z2Free (issuerSerial);
  if (encryptedKey != (unsigned char *)0)
    Z2Free (encryptedKey);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, 0, obj, status, 0, errorType,
    (char *)0, "VoltBuildRecipientData", fnctLine, (char *)0)

  return (status);
}

static int VoltBuildIssuerSerialAlloc (
   VoltLibCtx *libCtx,
   VtIdentityObject identity,
   VtAlgorithmObject base64,
   unsigned char **issuerSerial,
   unsigned int *issuerSerialLen
   )
{
  int status;
  unsigned int offset, totalLen;
  unsigned int encodingLen, attrLen, setLen, rdnLen, seqLen;
  VoltIdentityObject *idObj = (VoltIdentityObject *)identity;
  unsigned char *buffer = (unsigned char *)0;
  unsigned char idAtNameOid[VoltIdAtNameOidBytesLen + 2] =
    { 0x06, VoltIdAtNameOidBytesLen, VoltIdAtNameOidBytes };
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtEncodeInit (base64);
    if (status != 0)
      break;

    /* How big does the output buffer need to be?
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtEncodeFinal (
      base64, (VtRandomObject)0, idObj->encoding.data,
      idObj->encoding.len, (unsigned char *)0, 0, &encodingLen);
    if (status == 0)
      status = VT_ERROR_INVALID_INPUT;
    if (status != VT_ERROR_BUFFER_TOO_SMALL)
      break;

    /* How big will the 0c len <data> be?
     */
    totalLen =
      VoltDetermineDerLengthLen ((UInt32)encodingLen, (UInt32)0) +
      1 + encodingLen;

    /* How big will the Attribute sequence be?
     *   30 len
     *      06 03 55 04 29
     *      0c len <data>
     */
    attrLen = totalLen + 5;
    totalLen += VoltDetermineDerLengthLen ((UInt32)attrLen, (UInt32)0) + 6;

    /* How big will the SET OF be?
     */
    setLen = totalLen;
    totalLen += VoltDetermineDerLengthLen ((UInt32)setLen, (UInt32)0) + 1;

    /* How big will the SEQUENCE OF RDN be?
     */
    rdnLen = totalLen;
    totalLen += VoltDetermineDerLengthLen ((UInt32)rdnLen, (UInt32)0) + 1;

    /* The totalLen is the total SEQUENCE (which contains the SEQ OF
     * and an INTEGER).
     */
    seqLen = totalLen + 3;
    totalLen += VoltDetermineDerLengthLen ((UInt32)seqLen, (UInt32)0) + 4;

    /* Allocate the space.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_MEMORY;
    buffer = (unsigned char *)Z2Malloc (totalLen, 0);
    if (buffer == (unsigned char *)0)
      break;

    /* Place the first SEQ.
     */
    offset = VoltWriteDerTagAndLen (buffer, 0x30, (UInt32)seqLen, (UInt32)0);

    /* Place the RDN SEQ OF.
     */
    offset += VoltWriteDerTagAndLen (
      buffer + offset, 0x30, (UInt32)rdnLen, (UInt32)0);

    /* Place the SET OF.
     */
    offset += VoltWriteDerTagAndLen (
      buffer + offset, 0x31, (UInt32)setLen, (UInt32)0);

    /* Place the SEQUENCE (for Attribute).
     */
    offset += VoltWriteDerTagAndLen (
      buffer + offset, 0x30, (UInt32)attrLen, (UInt32)0);

    /* Place the OID.
     */
    Z2Memcpy (buffer + offset, idAtNameOid, sizeof (idAtNameOid));
    offset += sizeof (idAtNameOid);

    /* Place the PrintableString tag and length.
     */
    offset += VoltWriteDerTagAndLen (
      buffer + offset, 0x13, (UInt32)encodingLen, (UInt32)0);

    /* Place the Base64 encoded ID.
     */
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtEncodeFinal (
      base64, (VtRandomObject)0, idObj->encoding.data,
      idObj->encoding.len, buffer + offset, totalLen - offset, &encodingLen);
    if (status == VT_ERROR_BUFFER_TOO_SMALL)
      status = VT_ERROR_INVALID_INPUT;
    if (status != 0)
      break;

    offset += encodingLen;

    /* Finally, place the 02 01 01.
     */
    buffer[offset] = 2;
    buffer[offset + 1] = 1;
    buffer[offset + 2] = 1;

    *issuerSerial = buffer;
    *issuerSerialLen = totalLen;

  } while (0);

  /* If success, we're done.
   */
  if (status == 0)
    return (0);

  /* If error, free up any memory.
   */
  if (buffer != (unsigned char *)0)
    Z2Free (buffer);

  VOLT_LOG_ERROR_INFO (
    libCtx, identity, status, 0, errorType,
    (char *)0, "VoltBuildIssuerSerialAlloc", fnctLine, (char *)0)

  return (status);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产视频一区二区三区在线观看| 白白色亚洲国产精品| 91在线观看地址| 一区二区三区日韩欧美精品| 在线观看一区二区视频| 国产a级毛片一区| 欧美精品九九99久久| 91视频免费看| 久久久午夜电影| 国产麻豆精品视频| 日韩精品一区二| 日本sm残虐另类| 日韩色视频在线观看| 日韩在线a电影| 在线观看一区日韩| 日本欧洲一区二区| 欧美浪妇xxxx高跟鞋交| 日韩va欧美va亚洲va久久| 在线不卡中文字幕播放| 日本欧美大码aⅴ在线播放| 中文字幕一区二区三区蜜月| 午夜免费久久看| 成人黄色综合网站| 色综合色综合色综合| 欧美日韩中文字幕精品| 欧美日韩高清在线| 亚洲精品日韩综合观看成人91| 国产人妖乱国产精品人妖| 国产三级精品视频| 老司机精品视频导航| 欧美色综合网站| 中文字幕一区在线| 成人激情小说网站| 国产三级一区二区三区| 国产自产2019最新不卡| 欧美成人一区二区三区| 美日韩一区二区| 日韩一级片在线播放| 蜜臀av国产精品久久久久| 4438亚洲最大| 久久精品国产在热久久| 精品国内二区三区| 国产在线麻豆精品观看| 制服丝袜在线91| 秋霞电影网一区二区| 精品国产露脸精彩对白| 国产高清精品在线| 国产精品久久久久久久久免费丝袜| 久久久精品中文字幕麻豆发布| 成人综合在线观看| 97久久人人超碰| 91在线免费播放| 欧美96一区二区免费视频| 成人激情图片网| 国产成人精品免费视频网站| 国内精品免费**视频| 亚洲午夜羞羞片| 欧美日韩mp4| 91丝袜呻吟高潮美腿白嫩在线观看| 在线观看91精品国产麻豆| 精品午夜久久福利影院| heyzo一本久久综合| 中国av一区二区三区| 色综合久久久久久久| 1024国产精品| 成人一区二区在线观看| 亚洲欧美国产高清| 欧美一区二区三区视频免费播放| 国产综合久久久久久鬼色| 国产精品视频一二三| 欧美日韩你懂的| 国产激情视频一区二区三区欧美| 最近日韩中文字幕| 欧美精品日韩一区| 成人免费精品视频| 婷婷综合在线观看| 国产精品嫩草影院av蜜臀| 欧美日韩精品三区| 国产精品夜夜爽| 日日摸夜夜添夜夜添精品视频| 欧美精品一区二区三区一线天视频| 成人毛片在线观看| 日本一区中文字幕| 日韩理论片中文av| 精品少妇一区二区三区视频免付费 | 在线不卡的av| 成人激情电影免费在线观看| 日韩在线卡一卡二| 亚洲综合久久av| 国产亚洲精久久久久久| 精品污污网站免费看| 成年人国产精品| 狠狠狠色丁香婷婷综合久久五月| 亚洲猫色日本管| 日韩视频在线你懂得| 丰满亚洲少妇av| 亚洲va韩国va欧美va精品| 精品成人一区二区三区| 91免费版pro下载短视频| 美女网站色91| 一区二区三区美女| 国产日韩一级二级三级| 欧美乱熟臀69xxxxxx| 中文字幕国产精品一区二区| 日韩视频一区二区三区在线播放| 日本福利一区二区| 26uuuu精品一区二区| 成人中文字幕电影| 欧美亚洲综合色| 精品久久久久久无| 亚洲色图.com| 日韩精品电影在线观看| 成人综合在线网站| 欧美影院精品一区| 欧美日韩亚洲综合| 久久久综合九色合综国产精品| 国产精品你懂的在线| 国产盗摄视频一区二区三区| 欧美区在线观看| 日韩一区欧美一区| 国产欧美日韩精品一区| 国产成人av一区| 国产精品一二三区在线| 粉嫩一区二区三区在线看| 国产麻豆91精品| 成+人+亚洲+综合天堂| 国产成人免费视频网站| 成人永久看片免费视频天堂| 国产成人午夜视频| 99在线精品免费| 欧美在线一区二区三区| 制服丝袜亚洲精品中文字幕| 欧美一区二区视频网站| 2020国产精品自拍| 国产精品人妖ts系列视频| 亚洲免费成人av| 亚洲午夜久久久久久久久久久| 手机精品视频在线观看| 国内一区二区视频| 成人h动漫精品一区二| 欧美最猛黑人xxxxx猛交| 欧美大度的电影原声| 久久久一区二区三区| 中文字幕日韩欧美一区二区三区| 亚洲永久精品大片| 激情综合色丁香一区二区| av高清不卡在线| 7777精品伊人久久久大香线蕉的 | 久久久久久久久久久电影| 国产精品嫩草影院av蜜臀| 亚洲一二三四在线观看| 精品中文字幕一区二区小辣椒 | 亚洲综合成人在线| 亚洲电影你懂得| 狠狠狠色丁香婷婷综合久久五月| 91丨porny丨最新| 日韩精品一区二区三区三区免费| 中文字幕一区二区三区不卡| 日本成人超碰在线观看| 国产精品一区二区你懂的| 色哟哟欧美精品| 亚洲国产美国国产综合一区二区| 欧美一二三区精品| 91在线视频18| 国产精品久久久久久一区二区三区| 粉嫩av一区二区三区粉嫩| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产亚洲一区二区在线观看| 成人国产视频在线观看| 亚洲444eee在线观看| 亚洲在线观看免费视频| 偷窥少妇高潮呻吟av久久免费| 三级久久三级久久| 久久成人久久鬼色| 一区二区三区四区视频精品免费| 欧美一卡二卡在线观看| 91女神在线视频| 欧美精品久久久久久久久老牛影院| 在线欧美日韩国产| 欧美电视剧免费观看| 56国语精品自产拍在线观看| 一本大道久久a久久综合| 99re视频精品| 国产亚洲欧美中文| 另类小说图片综合网| 欧美视频在线观看一区二区| 国产精品久久久久久亚洲毛片 | 久久一区二区视频| 日日噜噜夜夜狠狠视频欧美人| 91在线观看美女| 中文字幕在线播放不卡一区| 高清国产午夜精品久久久久久| 日韩视频免费观看高清完整版 | 日韩三级精品电影久久久 | 亚洲欧美一区二区在线观看| 国产成人啪午夜精品网站男同| 日韩一卡二卡三卡| 美腿丝袜一区二区三区| 91精品欧美久久久久久动漫| 五月天欧美精品|