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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? writesign.c

?? IBE是一種非對(duì)稱密碼技術(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 "p7obj.h"
#include "idobj.h"
#include "derhelp.h"
#include "oidlist.h"
#include "vcert.h"
#include "digest.h"
#include "vtime.h"
#include "surrender.h"
#include "errorctx.h"

/* Set up the OpenSSL ASN.1 templates.
 */
ASN1_SEQUENCE (Asn1P9Attribute) =
{
  ASN1_SIMPLE (Asn1P9Attribute, attrType, Asn1ObjectId),
  ASN1_SET_OF (Asn1P9Attribute, attrValues, Asn1Encoded)
} ASN1_SEQUENCE_END (Asn1P9Attribute);

IMPLEMENT_ASN1_FUNCTIONS (Asn1P9Attribute)

ASN1_SEQUENCE (Asn1IssuerSerial) =
{
  ASN1_SIMPLE (Asn1IssuerSerial, issuerName, Asn1Encoded),
  ASN1_SIMPLE (Asn1IssuerSerial, serialNumber, ASN1_INTEGER)
} ASN1_SEQUENCE_END (Asn1IssuerSerial);

IMPLEMENT_ASN1_FUNCTIONS (Asn1IssuerSerial)

ASN1_SEQUENCE (Asn1SignerInfo) =
{
  ASN1_SIMPLE (Asn1SignerInfo, version, ASN1_INTEGER),
  ASN1_SIMPLE (Asn1SignerInfo, issuerSerial, Asn1IssuerSerial),
  ASN1_SIMPLE (Asn1SignerInfo, digestAlg, Asn1Encoded),
  ASN1_OPT (Asn1SignerInfo, authAttributes, Asn1Encoded),
  ASN1_SIMPLE (Asn1SignerInfo, signatureAlg, Asn1Encoded),
  ASN1_SIMPLE (Asn1SignerInfo, signature, ASN1_OCTET_STRING),
  ASN1_IMP_SET_OF_OPT (Asn1SignerInfo, unauthAttributes, Asn1P9Attribute, 1),
} ASN1_SEQUENCE_END (Asn1SignerInfo);

IMPLEMENT_ASN1_FUNCTIONS (Asn1SignerInfo)

/* Create an Asn1SignerInfo object, then set it with the information
 * found in the signerInfo struct.
 * <p>The caller passes in a VoltP7SignerInfo struct containing key and
 * cert defining the signer. The struct also contains the field where
 * the function will place the created Asn1 object.
 * <p>The struct also contains a filed for the length of the
 * signerInfo. This is the length of the encoded SignerInfo. This length
 * will be an upper bound, the actual length may be shorter.
 *
 * @param p7Obj The object containing the signCtx and other info.
 * @param surrCtx If not NULL a surrender ctx to pass on to subordinate
 * objects.
 * @param random A random object, if needed.
 * @param signerInfo The struct containing the key and cert, also the
 * place where the created Asn1 object and length will be deposited.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV BuildSignerInfoCreate VOLT_PROTO_LIST ((
   VoltPkcs7Object *p7Obj,
   VoltSurrenderCtx *surrCtx,
   VtRandomObject random,
   unsigned char *digestBuf,
   unsigned int digestLen,
   VoltP7SignerInfo *signerInfo
));

/* Build the AuthenticatedAttributes for a SignedData message.
 * <p>Actually, this builds only the following three attributes:
 * pkcs-9-at-contentType, pkcs-9-at-messageDigest, and
 * pkcs-9-at-signingTime.
 * <p>If using AuthenticatedAttributes in a P7 SignedData message, the
 * contentType and messageDigest are required.
 * <p>The input flag contentType must be one of the following.
 * <code>
 * <pre>
 *     VT_PKCS7_DATA
 *     VT_PKCS7_SIGNED_DATA
 *     VT_PKCS7_ENVELOPED_DATA
 *     VT_PKCS7_SIGN_ENV_DATA
 *     VT_PKCS7_DIGESTED_DATA
 *     VT_PKCS7_ENCRYPTED_DATA
 * </pre>
 * </code>
 * <p>This routine will create the DER encoding of the Attributes:
 * <code>
 * <pre>
 *    Attributes ::= SET OF {
 *      Attribute }
 *
 *    Attribute ::= SEQUENCE {
 *      type    OID,
 *      values  SET OF ANY }
 * </pre>
 * </code>
 * <p>For SignedData, the Attributes are Implicit, so the function will
 * make sure the appropriate tag is used.
 * <p>This routine will fill the provided buffer. If no buffer is given
 * or if the buffer is too small, the function will return
 * VT_ERROR_BUFFER_TOO_SMALL and set the authAttrsLen to the needed
 * size.
 *
 * @param p7Obj The object containing info needed, such as signCtx and
 * libCtx.
 * @param contentType A flag indicating what contentType is being
 * signed (Data, SignedData, EnvelopedData, etc.).
 * @param contentDigest The digest of the content, this is what will be
 * the value of the messageDigest attribute.
 * @param contentDigestLen The length, in bytes, of the contentDigest.
 * @param theTime The time to use for signingTime.
 * @param authAttrs The buffer the function will fill with the
 * attributes.
 * @param bufferSize The size, in bytes of the output buffer.
 * @param authAttrsLen The address where this function will deposit the
 * length, in bytes, of the encoding of the attributes.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV BuildAuthAttributes VOLT_PROTO_LIST ((
   VoltPkcs7Object *p7Obj,
   unsigned int contentType,
   unsigned char *contentDigest,
   unsigned int contentDigestLen,
   VtTime *theTime,
   unsigned char *authAttrs,
   unsigned int bufferSize,
   unsigned int *authAttrsLen
));

/* Fix the signature so that the signatureLen is the same as
 * sigBufSize. Do this by prepending 00 bytes in the appropriate
 * places.
 * <p>This particular function operates on DSA signatures only. In the
 * future, we'll have to be able to fix any signature. This function
 * also expects r and s to be 20 bytes. In other words, the signature
 * was created using DSA with a subprime of 160 bits.
 * <p>This function expects the signature to be in the buffer and that the
 * buffer is sigBufSize bytes big. It will go to the address given by
 * signatureLen to find the actual signatureLen, and it will set that
 * value to the new signatureLen.
 *
 * @param libCtx
 * @param signature
 * @param sigBufSize
 * @param signatureLen
 * @return none
 */
static void VOLT_CALLING_CONV FixDsaSignature VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   unsigned char *signature,
   unsigned int sigBufSize,
   unsigned int *signatureLen
));

int VoltP7SignWriteInit (
   VtPkcs7Object pkcs7Obj,
   VtPolicyCtx policyCtx,
   VtStorageCtx storageCtx,
   VtTransportCtx transportCtx,
   VtRandomObject random
   )
{
  int status;
  unsigned int index;
  VoltPkcs7Object *obj = (VoltPkcs7Object *)pkcs7Obj;
  VoltPkcs7WriteSignCtx *signCtx = (VoltPkcs7WriteSignCtx *)(obj->localCtx);
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);
  VoltP7SignerInfo *currentSignerInfo;
  VtCertObject nextCert = (VtCertObject)0;
  VtItem *getCertData = (VtItem *)0;
  VtKeyObject *obtainKey;
  VtCertObject *obtainCert;
  VoltSurrenderCtx *surrCtx = (VoltSurrenderCtx *)0;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    if ( ((obj->voltObject.objectType & VOLT_OBJECT_TYPE_SURRENDER) != 0) &&
         (obj->voltObject.surrenderCtx != (Pointer)0) )
      surrCtx = (VoltSurrenderCtx *)(obj->voltObject.surrenderCtx);

    /* The state must be VOLT_P7_STATE_SIGN_WRITE_SET, if not, we're
     * not allowed to call WriteInit.
     */
    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_SIGN_WRITE_SET)
      break;

    /* This implementation does not work without signers.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_P7_OBJ;
    if (signCtx->signerInfosCount == 0)
      break;

    /* Get the signing time.
     */
    VtGetTime ((VtLibCtx)libCtx, &(signCtx->signingTime));

    /* For each of the signers, get the private key and cert. This
     * implementation of P7 requires a cert for each signer.
     */
    status = 0;
    for (index = 0; index < signCtx->signerInfosCount; ++index)
    {
      currentSignerInfo = &(signCtx->signerInfos[index]);

      if ( (currentSignerInfo->priKeyRef == (VtKeyObject)0) &&
           (currentSignerInfo->priKey != (VtKeyObject)0) )
        currentSignerInfo->priKeyRef = currentSignerInfo->priKey;

      /* Check to see if we already have a key and cert.
       */
      obtainKey = (VtKeyObject *)0;
      obtainCert = (VtCertObject *)0;
      if (currentSignerInfo->priKeyRef == (VtKeyObject)0)
        obtainKey = &(currentSignerInfo->priKey);
      if (currentSignerInfo->cert.data == (unsigned char *)0)
        obtainCert = &nextCert;

      /* If there's no DSA private key and/or cert, get them. If we
       * already have them, no need. We don't need the IBE private key.
       */
      if ( (obtainKey != (VtKeyObject *)0) ||
           (obtainCert != (VtCertObject *)0) )
      {
        VOLT_SET_ERROR_TYPE (errorType, 0)
        VOLT_SET_FNCT_LINE (fnctLine)
        status = VoltP7GetKeysAndCert (
          surrCtx, currentSignerInfo->signerId, random, policyCtx, storageCtx,
          transportCtx, obtainCert, (VtKeyObject *)0, obtainKey);
        if (status != 0)
          break;
      }

      /* Get the cert data.
       */
      if (obtainCert != (VtCertObject *)0)
      {
        VOLT_SET_ERROR_TYPE (errorType, 0)
        VOLT_SET_FNCT_LINE (fnctLine)
        status = VtGetCertParam (
          nextCert, VtCertParamX509DerData, (Pointer *)&getCertData);
        if (status != 0)
          break;

        /* Copy the cert data.
         */
        VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
        VOLT_SET_FNCT_LINE (fnctLine)
        status = VT_ERROR_MEMORY;
        if (currentSignerInfo->cert.data != (unsigned char *)0)
          Z2Free (currentSignerInfo->cert.data);
        currentSignerInfo->cert.data = Z2Malloc (getCertData->len, 0);
        if (currentSignerInfo->cert.data == (unsigned char *)0)
          break;
        Z2Memcpy (
          currentSignerInfo->cert.data, getCertData->data, getCertData->len);
        currentSignerInfo->cert.len = getCertData->len;
        status = 0;
      }

      if (obtainKey != (VtKeyObject *)0)
        currentSignerInfo->priKeyRef = currentSignerInfo->priKey;

      /* We only needed this object to get the data. Destroy it so
       * the next iteration will have a NULL.
       */
      VtDestroyCertObject (&nextCert);

      /* Now that we have the key and cert, build the Asn1SignerInfo
       * object.
       */
      VOLT_SET_ERROR_TYPE (errorType, 0)
      VOLT_SET_FNCT_LINE (fnctLine)
      status = BuildSignerInfoCreate (
        obj, surrCtx, random, signCtx->digest, signCtx->digestSize,
        currentSignerInfo);
      if (status != 0)
        break;

      signCtx->totalSignerInfoLen += currentSignerInfo->signerInfoLen;
      signCtx->totalCertLen += currentSignerInfo->cert.len;
    }

    /* Count up the extra certs.
     */
    for (index = 0; index < signCtx->extraCertsCount; ++index)
      signCtx->totalCertLen += signCtx->extraCerts[index].len;

  } while (0);

  if (status == 0)
    obj->state = VOLT_P7_STATE_SIGN_WRITE_INIT;

  VtDestroyCertObject (&nextCert);

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

  return (status);
}

int VoltP7SignWriteUpdate (
   VtPkcs7Object pkcs7Obj,
   VtRandomObject random,
   unsigned char *inputData,
   unsigned int inputDataLen,
   unsigned char *message,
   unsigned int bufferSize,
   unsigned int *messageLen
   )
{
  int status;
  unsigned int offset;
#if VT_64_BIT_LENGTH == 64
  VtUInt64 outputLen, contentLen, contentInfoLen, signedDataLen;
  VtUInt64 explicitLen, totalLen;
#else
  unsigned int outputLen, contentLen, contentInfoLen, signedDataLen;
  unsigned int explicitLen, totalLen;
#endif
  VoltPkcs7Object *obj = (VoltPkcs7Object *)pkcs7Obj;
  VoltPkcs7WriteSignCtx *signCtx = (VoltPkcs7WriteSignCtx *)(obj->localCtx);
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久亚洲国产美女国产盗摄| 欧美日本高清视频在线观看| 天天av天天翘天天综合网色鬼国产| 一区二区不卡在线视频 午夜欧美不卡在| 久久久影院官网| 久久天天做天天爱综合色| 久久久久久久久久久99999| xfplay精品久久| 久久亚洲春色中文字幕久久久| 日韩三区在线观看| 2023国产精品自拍| 中文字幕不卡三区| 亚洲三级久久久| 一区av在线播放| 亚洲国产综合在线| 日韩精品色哟哟| 精品一区二区三区的国产在线播放| 九九视频精品免费| 国产91精品欧美| av网站免费线看精品| 在线亚洲+欧美+日本专区| 欧美日韩国产小视频在线观看| 91精品国产手机| 久久新电视剧免费观看| 国产精品久久国产精麻豆99网站| 尤物视频一区二区| 肉丝袜脚交视频一区二区| 免费成人av资源网| 国产成人综合精品三级| 91首页免费视频| 在线综合视频播放| 久久综合色婷婷| 成人欧美一区二区三区小说 | 欧美一级片免费看| xnxx国产精品| 亚洲精品视频自拍| 久久国产精品免费| av男人天堂一区| 666欧美在线视频| 国产精品系列在线| 91小视频在线观看| 欧美午夜视频网站| 精品国产伦一区二区三区免费| 国产精品美女久久久久久2018 | 亚洲不卡在线观看| 国产精品77777| 欧洲另类一二三四区| 精品日韩在线观看| 亚洲精品国产视频| 久久精品久久综合| 色综合中文综合网| 色综合久久久久| 日韩视频免费直播| 亚洲三级久久久| 国内精品在线播放| 欧美性猛交xxxxxx富婆| 久久久久青草大香线综合精品| 亚洲欧美福利一区二区| 激情欧美一区二区三区在线观看| 色婷婷精品大在线视频| 久久色.com| 五月婷婷色综合| 99国产精品一区| 欧美精品一区二区三区四区| 亚洲综合免费观看高清完整版| 精品夜夜嗨av一区二区三区| 在线免费观看成人短视频| 国产欧美视频在线观看| 男人操女人的视频在线观看欧美| 99久久精品99国产精品 | 免费黄网站欧美| 在线一区二区三区四区五区 | 国产欧美一区二区精品忘忧草| 日韩激情av在线| 色诱亚洲精品久久久久久| 欧美精彩视频一区二区三区| 琪琪久久久久日韩精品| 欧洲精品视频在线观看| 国产精品高潮久久久久无| 国产一区二区三区在线观看精品 | 99久久伊人久久99| 国产午夜亚洲精品午夜鲁丝片 | 91网站在线播放| 中文字幕欧美区| 国产乱人伦偷精品视频免下载| 91精品国产91综合久久蜜臀| 一区二区三区在线观看动漫| 懂色av中文一区二区三区| 精品成人一区二区三区| 日韩av不卡一区二区| 欧美日韩免费不卡视频一区二区三区| 国产精品国产三级国产普通话三级 | 六月丁香综合在线视频| 欧美一区二区大片| 日韩精品亚洲专区| 69堂亚洲精品首页| 亚洲成人久久影院| 欧美自拍偷拍午夜视频| 一级日本不卡的影视| 色一区在线观看| 亚洲欧美乱综合| 91麻豆.com| 一区二区三区影院| 在线免费观看一区| 亚洲第一狼人社区| 欧美日韩三级一区| 日韩av网站在线观看| 欧美一区二区三区免费| 日韩一区精品字幕| 欧美成人在线直播| 国产一区在线精品| 中文字幕av一区二区三区| 高潮精品一区videoshd| 中文字幕日韩一区二区| 91色porny蝌蚪| 亚洲国产一区二区三区青草影视| 欧美三级蜜桃2在线观看| 日韩电影在线一区二区三区| 欧美一区二区三区精品| 精品亚洲欧美一区| 国产精品视频在线看| 91香蕉视频黄| 日韩专区在线视频| 久久无码av三级| 91丨porny丨户外露出| 亚洲国产精品自拍| 精品成人在线观看| 99视频在线精品| 亚洲福利视频一区| 2021国产精品久久精品| 成人污污视频在线观看| 一区二区三区91| 日韩三级.com| 成人黄色777网| 性欧美大战久久久久久久久| 精品久久久久香蕉网| 成人ar影院免费观看视频| 亚洲永久精品大片| 欧美大黄免费观看| av综合在线播放| 视频一区欧美日韩| 国产欧美一区二区精品忘忧草| 91丨porny丨户外露出| 日本免费在线视频不卡一不卡二 | 奇米影视一区二区三区| 中文字幕乱码日本亚洲一区二区| 91精品1区2区| 卡一卡二国产精品 | 亚洲一区日韩精品中文字幕| 日韩精品一区国产麻豆| 成人av在线一区二区| 日本强好片久久久久久aaa| 国产片一区二区三区| 3atv一区二区三区| 成人美女在线观看| 日本不卡视频在线观看| 中文字幕中文乱码欧美一区二区| 91麻豆精品国产综合久久久久久| 国产aⅴ综合色| 日日摸夜夜添夜夜添精品视频| 国产精品久久久久影视| 日韩欧美不卡在线观看视频| 色综合久久中文综合久久牛| 国内精品伊人久久久久av一坑| 玉米视频成人免费看| 国产日韩成人精品| 日韩欧美亚洲另类制服综合在线| 91在线云播放| 国产福利精品一区| 美女脱光内衣内裤视频久久影院| 亚洲激情在线播放| 国产亚洲欧美一级| 日韩欧美国产不卡| 欧美日韩精品免费| 91在线码无精品| 国产成人亚洲综合色影视| 日韩av一区二区三区| 亚洲自拍另类综合| 亚洲情趣在线观看| 国产精品人妖ts系列视频| 日韩一级在线观看| 在线观看91av| 在线视频你懂得一区| 99久久777色| 高清成人在线观看| 国产一区三区三区| 美女任你摸久久 | 99久久婷婷国产综合精品电影| 国产综合色视频| 美腿丝袜亚洲三区| 日日夜夜免费精品视频| 亚洲一区二区三区视频在线播放 | 久久精品水蜜桃av综合天堂| 日韩精品在线网站| 日韩一级在线观看| 日韩视频免费直播| 日韩欧美久久一区| 日韩精品一区二区三区swag | 亚洲午夜久久久久久久久久久 | 日本高清不卡视频|