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

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

?? defcertvfy.c

?? IBE是一種非對稱密碼技術
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* Copyright 2003-2006, Voltage Security, all rights reserved.
 */
#include "vibe.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "certvfyctx.h"
#include "certobj.h"
#include "vcert.h"
#include "vfylist.h"
#include "vtime.h"
#include "algobj.h"
#include "sign.h"
#include "digest.h"
#include "surrender.h"
#include "errorctx.h"

/* Implements VVerifyCertElements.
 */
int VOLT_CALLING_CONV DefaultVerifyCertElements VOLT_PROTO_LIST ((
   VtCertVerifyCtx verifyCtx,
   Pointer verifyInfo,
   VtCertObject certToVerify,
   VtVerifyFailureList vfyFailList,
   unsigned int *verifyResult
));

/* Implements VVerifyCertSignature.
 */
int VOLT_CALLING_CONV DefaultVerifyCertSignature VOLT_PROTO_LIST ((
   VtCertVerifyCtx verifyCtx,
   Pointer verifyInfo,
   VtCertObject certToVerify,
   VtStorageCtx storageCtx,
   VtCertObjectList *trustedCerts,
   VtCertObjectList *untrustedCerts,
   VtDerCoder **derCoders,
   unsigned int derCoderCount,
   VtVerifyFailureList vfyFailList,
   unsigned int *verifyResult
));

/* The caller passed in verifyInfo. Check to make sure it is valid
 * VtBasicCertVerifyInfo.
 * <p>This function will also build the internal ASN.1 object if it is
 * not already built.
 *
 * @param libCtx The libCtx to use.
 * @param obj The cert object being verified.
 * @param info The info the caller passed in, the data to check.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV CheckBasicVerifyInfo VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltCertObject *obj,
   Pointer info
));

/* Check to see if the given cert is the one we're looking for.
 * <p>First, check the name, if it doesn't match, forget it.
 * <p>If the name matches, check the signature. The caller passes in a
 * signature and digest, the function will extract the public key from
 * the cert and check the signature. If it does not verify, forget it.
 * <p>If the signature verifies, set the sigVerify arg to True (1).
 * <p>Next, check the elements of the cert. If the elements don't
 * verify, set the elementVerify arg to False (0).
 * <p>The caller passes in a candidate cert. If sigVerify is returned
 * set to True, then the cert matches name and signature. If not,
 * forget about this cert. If elementVerify is returned set to True,
 * the cert is the one we're looking for. If sigVerify is True but
 * elementVerify is False, the caller has to decide what to do with it.
 * Accept it nonetheless? Reject it outright?
 */
static int VOLT_CALLING_CONV IsIssuerCert VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   VtCertVerifyCtx verifyCtx,
   VtBasicCertVerifyInfo *verifyInfo,
   VtVerifyFailureList vfyFailList,
   VtCertInfo *certInfo,
   VtAlgorithmObject verifier,
   unsigned char *name,
   unsigned int nameLen,
   unsigned int digestAlg,
   unsigned char *digest,
   unsigned int digestLen,
   unsigned char *signature,
   unsigned int signatureLen,
   VoltCertObject *candidateCert,
   unsigned int *sigVerify,
   unsigned int *elementVerify
));

int VtCertVerifyImplBasic (
   VtCertVerifyCtx *certVerifyCtx,
   Pointer info,
   unsigned int flag
   )
{
  int status;
  VoltCertVerifyCtx *ctx = (VoltCertVerifyCtx *)(*certVerifyCtx);
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    /* Check the flag, it should be VOLT_CERT_VFY_CTX_SET_TYPE_FLAG.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_TYPE;
    if (flag != VOLT_CERT_VFY_CTX_SET_TYPE_FLAG)
      break;

    /* The associated info should be a null pointer.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_ASSOCIATED_INFO;
    if (info != (Pointer)0)
      break;

    /* This ctx needs no local ctx, so just fill the ctx function
     * pointer fields.
     */
    ctx->LocalCtxDestroy = VoltDefaultCtxDestroy;
    ctx->VerifyCertElements = DefaultVerifyCertElements;
    ctx->VerifyCertSignature = DefaultVerifyCertSignature;

    status = 0;

  } while (0);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, 0, *certVerifyCtx, status, 0, VT_ERROR_TYPE_PRIMARY,
    (char *)0, "VtCertVerifyImplBasic", fnctLine, (char *)0)

  return (status);
}

int DefaultVerifyCertElements (
   VtCertVerifyCtx verifyCtx,
   Pointer verifyInfo,
   VtCertObject certToVerify,
   VtVerifyFailureList vfyFailList,
   unsigned int *verifyResult
   )
{
  int status, count, index;
  unsigned int compareResult, value, valueLen;
  VoltCertVerifyCtx *ctx = (VoltCertVerifyCtx *)verifyCtx;
  VoltCertObject *obj = (VoltCertObject *)certToVerify;
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);
  VtBasicCertVerifyInfo *vInfo;
  Asn1X509Extension *extension;
  unsigned char keyUsageOid[VoltCertExtKeyUsageOidBytesLen] =
    { VoltCertExtKeyUsageOidBytes };
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    *verifyResult = 1;

    /* Check to see if the verifyInfo passed in is what we expect.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = CheckBasicVerifyInfo (libCtx, obj, verifyInfo);
    if (status != 0)
      break;

    vInfo = (VtBasicCertVerifyInfo *)verifyInfo;

    /* Get the validity dates. Compare to the value in the verifyInfo.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VoltCompareTimeValidity (
      libCtx, &(vInfo->usageTime),
      obj->certAsn1->innerCert->validity->base.data,
      (unsigned int)(obj->certAsn1->innerCert->validity->base.length),
      &compareResult);
    if (status != 0)
      break;

    /* If the cert is not within the validity period, put that info
     * into the list.
     */
    if (compareResult != 0)
    {
      *verifyResult = 0;
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VoltAddVerifyListEntry (
        (VoltVerifyFailureList *)vfyFailList,
        VT_VFY_FAIL_REASON_CERT_VALIDITY, certToVerify);
      if (status != 0)
        break;
    }

    /* Now check the keyUsage extension.
     * First, if there are no extensions, there's nothing to check.
     */
    if (obj->certAsn1->innerCert->extensions == (STACK *)0)
      break;

    count = sk_num (obj->certAsn1->innerCert->extensions);

    /* Cycle through the extensions.
     */
    for (index = 0; index < count; ++index)
    {
      extension = (Asn1X509Extension *)sk_value (
        obj->certAsn1->innerCert->extensions, index);
      if (extension->oid->base.length != VoltCertExtKeyUsageOidBytesLen)
        continue;
      if (Z2Memcmp (
        extension->oid->base.data, keyUsageOid,
        VoltCertExtKeyUsageOidBytesLen) == 0)
        break;
    }

    /* If we ran through the list with no matches, this cert has no
     * keyUsage extension.
     */
    if (index >= count)
      break;

    /* The extension is keyUsage. Get the value, it's a bit string. It
     * will be either
     *   03 02 unused x
     *   03 03 unused x x
     */
    valueLen = (unsigned int)(extension->value->data[1]);
    value = (unsigned int)(extension->value->data[3]);
    value <<= 8;
    if (valueLen == 3)
      value += (unsigned int)(extension->value->data[4]);

    /* Are the bits the input keyUsage want to be set, set in the cert?
     */
    value &= vInfo->keyUsage;
    if (value != vInfo->keyUsage)
    {
      /* Some bit in the cert extension was not set.
       */
      *verifyResult = 0;
      VOLT_SET_FNCT_LINE (fnctLine)
      status = VoltAddVerifyListEntry (
        (VoltVerifyFailureList *)vfyFailList,
        VT_VFY_FAIL_REASON_CERT_KEY_USAGE, certToVerify);
      if (status != 0)
        break;
    }

    /* Do we need to check current district?
     */
    if (ctx->checkInfo.flag == VT_CURRENT_DISTRICT_CHECK_IGNORE)
      break;

    VOLT_SET_FNCT_LINE (fnctLine)
    status = VoltCheckCertCurrentDistrict (
      ctx, obj, vfyFailList, &compareResult);
    if (status != 0)
      break;

    if (compareResult == 0)
      *verifyResult = 0;

  } while (0);

  if (status == 0)
    return (0);

  /* If error, make sure the verifyResult is did not verify.
   */
  *verifyResult = 0;

  VOLT_LOG_ERROR_INFO (
    0, verifyCtx, status, 0, 0,
    (char *)0, "DefaultVerifyCertElements", fnctLine, (char *)0)

  return (status);
}

int DefaultVerifyCertSignature (
   VtCertVerifyCtx verifyCtx,
   Pointer verifyInfo,
   VtCertObject certToVerify,
   VtStorageCtx storageCtx,
   VtCertObjectList *trustedCerts,
   VtCertObjectList *untrustedCerts,
   VtDerCoder **derCoders,
   unsigned int derCoderCount,
   VtVerifyFailureList vfyFailList,
   unsigned int *verifyResult
   )
{
  int status;
  unsigned int index, offset, theTag, lengthLen, valueLen, issuerNameLen;
  unsigned int algorithm, bufferSize, digestAlg, digestLen, signatureLen;
  unsigned int indexA, indexB, indexC, indexD, tCount, uCount;
  unsigned int trusted, sigVerify, elementVerify, saveTrusted;
  UInt32 lenLo, lenHi;
  VoltCertVerifyCtx *ctx = (VoltCertVerifyCtx *)verifyCtx;
  VoltCertObject *obj = (VoltCertObject *)certToVerify;
  VoltCertObject *candidate;
  VoltCertObject *saveCert = (VoltCertObject *)0;
  VtCertObject verifyingCert = (VtCertObject)0;
  VtAlgorithmObject digester = (VtAlgorithmObject)0;
  VtAlgorithmObject verifier = (VtAlgorithmObject)0;
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);
  Asn1X509CertToVerify *x509ToVerify = (Asn1X509CertToVerify *)0;
  VtBasicCertVerifyInfo *vInfo;
  unsigned char *issuerName;
  unsigned char *temp;
  unsigned char *signature;
  unsigned char *digest = (unsigned char *)0;
  VoltSurrenderCtx *surrCtx = (VoltSurrenderCtx *)0;
  VtSurrenderCallback surrenderCtx;
  VtBasicCertVerifyInfo newVerifyInfo;
  VtSetAlgIdInfo algIdInfo;
  VtCertInfo certInfo;
  VtDerCoderInfo coderInfo;
  VOLT_DECLARE_ERROR_TYPE (errorType)
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  *verifyResult = 0;
  tCount = 0;
  if (trustedCerts != (VtCertObjectList *)0)
    tCount = trustedCerts->count;
  uCount = 0;
  if (untrustedCerts != (VtCertObjectList *)0)
    uCount = untrustedCerts->count;

  do
  {
    /* Check to see if the verifyInfo passed in is what we expect.
     */
    VOLT_SET_ERROR_TYPE (errorType, 0)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = CheckBasicVerifyInfo (libCtx, obj, verifyInfo);
    if (status != 0)
      break;

    vInfo = (VtBasicCertVerifyInfo *)verifyInfo;

    /* Build the verification object from the signing algID.
     */
    algIdInfo.derCoders = derCoders;
    algIdInfo.derCoderCount = derCoderCount;
    algIdInfo.berEncoding = obj->certAsn1->innerCert->sigAlgId->base.data;
    algIdInfo.maxEncodingLen =
      (unsigned int)(obj->certAsn1->innerCert->sigAlgId->base.length);
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VtCreateAlgorithmObject (
      (VtLibCtx)libCtx, VtAlgorithmImplAlgId, (Pointer)&algIdInfo, &verifier);
    if (status != 0)
      break;

    /* If there's a surrender ctx, get it to pass along to verifiers.
     */
    if ( ((ctx->voltObject.objectType & VOLT_OBJECT_TYPE_SURRENDER) != 0) &&
          (ctx->voltObject.surrenderCtx != (Pointer)0) )
    {
      surrCtx = (VoltSurrenderCtx *)(ctx->voltObject.surrenderCtx);
      /* Set the verifying object with the surrender ctx, but don't copy
       * the appData, just copy a reference, so we're still using the
       * cert request 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 (
        verifier, VtAlgorithmParamSurrenderCallback, (Pointer)&surrenderCtx);
      if (status != 0)
        break;
    }

    /* Get the digest object from the verification object.
     *
     * This feature currently does not work with the FIPS version of
     * the toolkit.
     */
/*    status = VtGetAlgorithmParam (
      verifier, VtAlgorithmParamSigDigestAlgObj, (Pointer *)&getDigester);
    if (status != 0)
      break;
 */

    /* Until the above code is fixed, run through the DerCoder's to get
     * the digest algorithm.
     * First, isolate the OID.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VoltDecodeTagAndLen (
      libCtx, algIdInfo.berEncoding, algIdInfo.maxEncodingLen,
      &theTag, &lengthLen, &lenLo, &lenHi, sizeof (unsigned int));
    if (status != 0)
      break;

    valueLen = (unsigned int)lenLo;

    offset = 1 + lengthLen;
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VoltDecodeTagAndLen (
      libCtx, algIdInfo.berEncoding + offset, algIdInfo.maxEncodingLen - offset,
      &theTag, &lengthLen, &lenLo, &lenHi, sizeof (unsigned int));
    if (status != 0)
      break;

    valueLen = (unsigned int)lenLo;
    offset += 1 + lengthLen;

    coderInfo.info.getAlgData.libCtx = libCtx;
    coderInfo.info.getAlgData.oid = algIdInfo.berEncoding + offset;
    coderInfo.info.getAlgData.oidLen = valueLen;
    coderInfo.info.getAlgData.algorithm = &algorithm;
    coderInfo.info.getAlgData.SymKeyParam = (VtKeyParam *)0;
    coderInfo.info.getAlgData.DigestImpl = (VtAlgorithmImpl *)0;
    for (index = 0; index < derCoderCount; ++index)
    {
      /* Call the DerCoder. If successful, we found what we were
       * looking for.
       */
      status = derCoders[index] (
        &coderInfo, (Pointer)0, VOLT_DER_TYPE_GET_ALG_FLAG);
      if (status == 0)
        break;
    }
    VOLT_SET_ERROR_TYPE (errorType, VT_ERROR_TYPE_PRIMARY)
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_UNKNOWN_BER;
    if (index >= derCoderCount)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本色道久久加勒比精品| 亚洲免费色视频| 热久久一区二区| 欧美日韩大陆一区二区| 蜜臀99久久精品久久久久久软件| 欧美一级一区二区| 久久精品国产99| 国产日产欧产精品推荐色| 成人高清视频在线| 亚洲欧美另类在线| 欧美电影一区二区| 国产一区三区三区| 热久久一区二区| 国产免费观看久久| 在线一区二区三区四区五区| 亚洲成人免费观看| 精品久久久久久综合日本欧美| 国产精品自拍三区| 亚洲免费在线观看| 日韩一区二区三区在线| 国产成人aaa| 国产精品久久久久久久浪潮网站| 91精彩视频在线观看| 蜜桃视频在线观看一区二区| 国产女人aaa级久久久级| 日本高清无吗v一区| 男女男精品网站| 国产精品你懂的| 欧美福利视频一区| 国产福利精品导航| 亚洲成人动漫在线免费观看| 2023国产精华国产精品| 91在线国产观看| 免费久久99精品国产| 国产视频一区在线播放| 欧美午夜在线观看| 国产精品亚洲成人| 亚洲成人免费观看| 国产精品久久久久久户外露出| 欧美手机在线视频| 国产成人精品1024| 日韩精品一区第一页| 国产精品久久久久aaaa樱花| 欧美日韩一本到| 成人毛片老司机大片| 免费成人美女在线观看.| 一区在线中文字幕| 日韩情涩欧美日韩视频| av亚洲精华国产精华| 精品在线一区二区| 亚洲va在线va天堂| 亚洲免费在线观看| 国产精品久久久久婷婷二区次| 欧美成人精品二区三区99精品| 在线观看日韩av先锋影音电影院| 国产真实精品久久二三区| 天天av天天翘天天综合网色鬼国产| 国产精品久久久久天堂| 久久久久久99久久久精品网站| 69堂成人精品免费视频| 色视频一区二区| 99久久久精品| 国产99精品国产| 国产尤物一区二区在线| 美国毛片一区二区三区| 日本视频中文字幕一区二区三区| 亚洲精品菠萝久久久久久久| 国产精品乱码一区二区三区软件 | 国产成人在线视频播放| 日韩精品每日更新| 午夜不卡在线视频| 一区二区三区国产豹纹内裤在线| 国产精品三级在线观看| 国产欧美日韩不卡| 国产目拍亚洲精品99久久精品| 精品国产乱码久久久久久牛牛| 日韩写真欧美这视频| 在线成人av影院| 欧美一区二区三区视频在线观看 | 中文在线资源观看网站视频免费不卡| 日韩一区二区三区观看| 日韩一区二区中文字幕| 欧美一激情一区二区三区| 日韩午夜电影av| 欧美大片在线观看| 久久色.com| 国产欧美日韩综合| 国产欧美一区二区三区在线看蜜臀 | 亚洲第四色夜色| 亚洲激情第一区| 亚洲最新在线观看| 日韩和的一区二区| 久久99国内精品| 国产乱子轮精品视频| 成人动漫一区二区| 91色在线porny| 欧美性生活影院| 欧美妇女性影城| 日韩欧美国产午夜精品| 久久综合九色综合97婷婷| 国产精品美女久久久久久久久 | 国产精品亚洲一区二区三区在线| 精品一区二区三区视频在线观看| 久久99精品国产.久久久久久 | 中文字幕一区av| 一区二区三区日韩欧美| 亚洲成a人v欧美综合天堂下载| 视频在线在亚洲| 国产在线一区二区| av中文字幕在线不卡| 欧美综合一区二区| 精品少妇一区二区三区免费观看| 国产欧美日韩亚州综合| 亚洲日本在线视频观看| 无码av中文一区二区三区桃花岛| 久久se精品一区精品二区| 成人精品视频一区| 欧美三级电影网站| 久久精品视频免费| 亚洲精品欧美专区| 久久超碰97中文字幕| 99久久综合色| 日韩久久久精品| 亚洲欧美怡红院| 麻豆国产精品视频| 一本色道久久综合狠狠躁的推荐| 精品免费一区二区三区| 亚洲精品水蜜桃| 精品一二三四区| 欧美性大战久久久久久久蜜臀| 久久你懂得1024| 亚洲bt欧美bt精品| 风间由美一区二区av101| 欧美午夜影院一区| 国产精品家庭影院| 久久精品国产秦先生| 在线一区二区三区做爰视频网站| 精品国产乱码久久| 午夜精品视频一区| caoporen国产精品视频| 日韩欧美国产电影| 亚洲综合视频在线观看| 成人网在线免费视频| 日韩一级欧美一级| 亚洲一级二级三级在线免费观看| 国产剧情一区二区| 日韩午夜av一区| 石原莉奈在线亚洲三区| 色综合一区二区| 国产精品久久久久毛片软件| 午夜精品福利久久久| 91视频免费观看| 中文字幕国产一区| 国产在线视频一区二区三区| 欧美日本韩国一区二区三区视频| 亚洲天堂av一区| av男人天堂一区| 国产欧美精品一区aⅴ影院 | 亚洲精品国产精品乱码不99| 国产成人精品免费在线| 精品对白一区国产伦| 麻豆成人在线观看| 欧美一级在线免费| 蜜臀av一级做a爰片久久| 欧美女孩性生活视频| 亚洲第一主播视频| 欧美日韩一本到| 午夜久久久久久| 欧美日韩国产综合一区二区| 亚洲国产综合人成综合网站| 色婷婷一区二区三区四区| 中文字幕欧美激情| av成人动漫在线观看| 国产精品伦理一区二区| 成人综合在线观看| 国产精品麻豆视频| 99久精品国产| 亚洲精品视频在线| 欧美三级日本三级少妇99| 亚洲成av人在线观看| 欧美日韩免费在线视频| 午夜欧美电影在线观看| 777久久久精品| 久久国产精品99久久人人澡| 精品av久久707| 国产成人h网站| 亚洲欧美福利一区二区| 欧美视频中文一区二区三区在线观看| 亚洲另类中文字| 欧美精品一二三| 黄色资源网久久资源365| 久久久亚洲欧洲日产国码αv| 国产精品66部| 亚洲免费伊人电影| 6080日韩午夜伦伦午夜伦| 久久成人综合网| 国产精品美女久久久久aⅴ| 色视频一区二区| 麻豆精品视频在线观看视频| 久久久精品中文字幕麻豆发布|