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

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

?? dsa.h

?? IBE是一種非對稱密碼技術
?? H
字號:
/* Copyright 2003-2006, Voltage Security, all rights reserved.
 */

#include "vibecrypto.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "paramobj.h"
#include "algobj.h"
#include "keyobj.h"
#include "mpint.h"
#include "surrender.h"

#ifndef _DSA_H
#define _DSA_H

#ifdef __cplusplus
extern "C" {
#endif

/* Implements VGenerateParameters
 */
int VOLT_CALLING_CONV DSAGenerateParameters VOLT_PROTO_LIST ((
   VtParameterObject paramObj,
   VtRandomObject random
));

/* This function generates prime P, subprime Q, and base G following
 * the instructions in the FIPS 186-2 document. The primes will be
 * chosen such that subprimeQ is a divisor of (primeP - 1).
 * <p>The SEED, hVal, and counter values are returned because the
 * caller may be doing some FIPS work and will need them. The caller
 * must pass a SEED buffer and it must be big enough to hold
 * subprimeSizeBits. This function will not check the arguments, it is
 * the responsibility of the caller to pass a valid SEED buffer (not
 * NULL) that is big enough, along with valid pointers seedLen and
 * counter.
 * <p>The length of the subprime must be less than the length of the
 * prime. The base will be the same size as the prime.
 * <p>The caller can pass a surrender context if one is available (NULL
 * is allowed). The surrFlag is a VT_SURRENDER_FNCT_ flag (such as
 * VT_SURRENDER_FNCT_DSA_PARAM_GEN) indicating who wants the PQG.
 *
 * @param mpCtx The mpCtx to use for multi-precision operations.
 * @param surrCtx This can be NULL, but if not, the surrender ctx to
 * call at various intervals.
 * @param surrFlag A VT_SURRENDER_FNCT_ flag indicating what operation
 * is running, to tell the surrender function who is calling it.
 * @param callNumber The current callNumber of the surrender ctx. The
 * caller should pass the current value at the address given, the
 * function will return the number it eventually reaches at that
 * address.
 * @param primeSizeBits The size, in bits, of the prime to generate.
 * @param subprimeSizeBits The size, in bits, of the subprime to generate.
 * @param random A random object, the source of any random bytes needed.
 * @param primeP Where the resulting prime will be deposited.
 * @param subprimeQ Where the resulting subprime will be deposited.
 * @param baseG Where the resulting base will be deposited.
 * @param hVal Where the resulting FIPS h value will be deposited.
 * @param SEED The buffer into which the FIPS SEED value will be placed.
 * @param seedLen The address where the function will deposit the
 * length, in bytes, of the value deposited into the SEED buffer.
 * @param counter The address where the function will deposit the FIPS
 * counter value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV VoltGeneratePQGFips186 VOLT_PROTO_LIST ((
   VoltMpIntCtx *mpCtx,
   VoltSurrenderCtx *surrCtx,
   unsigned int surrFlag,
   unsigned int *callNumber,
   unsigned int primeSizeBits,
   unsigned int subprimeSizeBits,
   VtRandomObject random,
   VoltMpInt *primeP,
   VoltMpInt *subprimeQ,
   VoltMpInt *baseG,
   VoltMpInt *hVal,
   unsigned char *SEED,
   unsigned int *seedLen,
   unsigned int *counter
));

/* Implements VGenerateKey
 */
int VOLT_CALLING_CONV DSAGenerateKeyPair VOLT_PROTO_LIST ((
   VtKeyObject priKey,
   VtKeyObject pubKey,
   VtRandomObject random
));

/* This function generates the DSA or DH public value given the params
 * and private value: pub = (base ^ pri) mod prime.
 * <p>It allocates a buffer to hold the octet string version of the
 * public value (using the libCtx passed in) and returns the buffer and
 * its length. It is the responsibility of the caller to free up the
 * memory allocated for the public value (that's what the Alloc in the
 * name means).
 * <p>This function does no arg checking, it is the responsibility of
 * the caller not to make mistakes.
 *
 * @param libCtx The library context to use.
 * @param mpCtx The mpCtx to use.
 * @param primeP The prime to use.
 * @param baseG The base to use.
 * @param priVal The private DSA value.
 * @param priValLen The length, in bytes, of the private value.
 * @param pubVal The address where this function will deposit the
 * pointer to the allocated memory containing the generated public
 * value.
 * @param pubValLen The address where this function will deposit the
 * length of the public value.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV VoltGeneratePubValAlloc VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltMpIntCtx *mpCtx,
   VtItem *primeP,
   VtItem *baseG,
   unsigned char *priVal,
   unsigned int priValLen,
   unsigned char **pubVal,
   unsigned int *pubValLen
));

typedef struct
{
  unsigned int primeSizeBits;
} VoltDsaParamGenCtx;

/* This is how params are stored internally.
 */
typedef struct
{
  VoltMpInt *primeP;
  VoltMpInt *subprimeQ;
  VoltMpInt *baseG;
  VtDSAParamInfo paramInfo;
  VtDSAParamFipsInfo fipsInfo;
} VoltDsaParams;

typedef struct
{
  VtMpIntCtx mpCtx;
  unsigned int primeSizeBits;
  VtItem primeP;
  VtItem subprimeQ;
  VtItem baseG;
} VoltDsaKeyGenCtx;

#define VOLT_DSA_PRI_VAL_LEN  20

#define VOLT_DSA_K_VAL_LEN    20

/* This is part of FIPS random x and k generation.
 */
#define VOLT_DSA_XKEY_LEN     32
#define VOLT_DSA_XSEED_LEN    32

/* This is how DSA key data is stored internally.
 * If you build a key and store the key data, it must be this format.
 * That is, if the VOLT_KEY_TYPE_DATA bit in the keyObject->keyType
 * field is set, the keyData must point to this struct.
 * Each of the types, public, private and key pair, must begin with the
 * keyType field, a flag so we can know what the struct is. It will be
 * set to one of the following values.
 *
 *    VOLT_KEY_TYPE_PUBLIC
 *    VOLT_KEY_TYPE_PRIVATE
 *    VOLT_KEY_TYPE_PAIR
 *
 * The public and private key types must look alike from top to bottom,
 * except for the priValX at the bottom. They can both be dereferenced
 * as a public key and the keyItems and params will be in the same
 * place.
 */
typedef struct
{
  unsigned int type;
  VtDSAPriKeyInfo *keyItems;
  VoltMpInt *primeP;
  VoltMpInt *subprimeQ;
  VoltMpInt *baseG;
  VoltMpInt *pubValY;
  VoltMpInt *priValX;
} VoltDsaPrivateKey;

typedef struct
{
  unsigned int type;
  VtDSAPubKeyInfo *keyItems;
  VoltMpInt *primeP;
  VoltMpInt *subprimeQ;
  VoltMpInt *baseG;
  VoltMpInt *pubValY;
} VoltDsaPublicKey;

typedef struct
{
  unsigned int type;
  VtKeyObject pubKey;
  VtKeyObject priKey;
} VoltDsaKeyPair;

/* The random field contains a reference, not an actual object. Users
 * of this struct should not build a random for that field. It will be
 * a reference to the actual random object to use (passed in by the
 * caller or from the libCtx).
 * The tempKey is for when the actual key object passed in is not a
 * regular toolkit DSA private key, but one in which the data is
 * available. We'll build a temp key object to build the required key
 * data.
 */
typedef struct
{
  unsigned int        format;
  VtRandomObject      random;
  VoltDsaPrivateKey  *priKeyData;
  VoltDsaPublicKey   *pubKeyData;
  VtKeyObject         tempKey;
} VoltDsaSignCtx;

/* Sign and verify using DSA. This determines if a pub and pri key are
 * indeed DSA partners. The data to sign and the signature are "thrown
 * away", this function only determines if the keys are indeed partners.
 * <p>If the two are partners, this function will return 0. If the keys
 * are not, the function will return an error code.
 * <p>This routine assumes that the random object is valid.
 *
 * @param libCtx The libCtx to use.
 * @param surrCtx If not NULL, pass it on to signing and verifying
 * objects.
 * @param pubKey The alleged public key.
 * @param priKey The alleged private key.
 * @param random A random object to use as a source of any random bytes
 * if needed.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV VoltTestDsaKeyPair VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VoltSurrenderCtx *surrCtx,
   VtKeyObject pubKey,
   VtKeyObject priKey,
   VtRandomObject random
));

/* Implements VCtxDestroy.
 */
void VOLT_CALLING_CONV DSAParamGenCtxDestroy VOLT_PROTO_LIST ((
   Pointer obj,
   Pointer ctx
));

/* Load these values into the object. This function will copy the
 * references to the MpInt's, it will not copy (clone) them. The caller
 * passes created and set MpInt's to be loaded into the object, the
 * caller should not destroy them unless this routine returns an error.
 * <p>The hVal, SEED, and counter are FIPS values. If hVal is NULL (and
 * SEED is NULL and counter is 0), there are no FIPS values, just load
 * the regular DSA params.
 *
 * @param obj The parameter object to which these values will be added.
 * @param primeP The prime to add.
 * @param subPrimeQ The subprime to add.
 * @param baseG The base to add.
 * @param hVal The FIPS "h" value.
 * @param SEED The FIPS SEED.
 * @param seedLen The length, in bytes, of the SEED.
 * @param counter The FIPS counter.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV AddDSAParametersMpInt VOLT_PROTO_LIST ((
   VoltParameterObject *obj,
   VoltMpInt *primeP,
   VoltMpInt *subprimeQ,
   VoltMpInt *baseG,
   VoltMpInt *hVal,
   unsigned char *SEED,
   unsigned int seedLen,
   unsigned int counter
));

/* Load these values into the object. This function will copy the data,
 * not just references. Therefore, any memory allocated for the VtItem's
 * or their data still belongs to the caller.
 *
 * @param obj The parameter object to which these values will be added.
 * @param primeP The prime to add.
 * @param subPrimeQ The subprime to add.
 * @param baseG The base to add.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV SetDSAParameters VOLT_PROTO_LIST ((
   VoltParameterObject *obj,
   VtItem *primeP,
   VtItem *subprimeQ,
   VtItem *baseG
));

/* Implements VCopyParams.
 */
int VOLT_CALLING_CONV DSACopyParams VOLT_PROTO_LIST ((
   Pointer sourceParamObj,
   Pointer destParamObj
));

/* Implements VGetDigestObject.
 */
int VOLT_CALLING_CONV DSAGetDigestObject VOLT_PROTO_LIST ((
   VoltAlgorithmObject *obj,
   VtAlgorithmObject *digestObj
));

/* Implements VCheckSignatureInput,
 */
int VOLT_CALLING_CONV DSACheckSignatureInput VOLT_PROTO_LIST ((
   VoltAlgorithmObject *obj,
   VoltKeyObject *key,
   VtRandomObject random,
   unsigned char *dataToSign,
   unsigned int dataToSignLen,
   unsigned int *signatureSize
));

/* DSA requires the input data (the data to sign, or the digest of the
 * data to sign) to be 20 bytes long.
 */
#define VOLT_DSA_SIGN_DATA_LEN 20

#define VOLT_DSA_R_VAL_LEN     20
#define VOLT_DSA_S_VAL_LEN     20

/* Implements VSignData.
 */
int VOLT_CALLING_CONV DSASignData VOLT_PROTO_LIST ((
   VoltAlgorithmObject *obj,
   VoltKeyObject *key,
   VtRandomObject random,
   unsigned char *dataToSign,
   unsigned int dataToSignLen,
   unsigned char *signature,
   unsigned int *sigLen
));

/* A "raw" DSA signature (r || s) will be 40 bytes long. The DER of a
 * DSA signature will be anywhere from 46 to 48 bytes long. Actually,
 * it could be smaller than 46, but that will almost never happen.
 */
#define VOLT_RAW_DSA_SIG_LEN  40
#define VOLT_DER_DSA_SIG_LEN  48

/* Implements VVerifyData.
 */
int VOLT_CALLING_CONV DSAVerifyData VOLT_PROTO_LIST ((
   VoltAlgorithmObject *obj,
   VoltKeyObject *key,
   VtRandomObject random,
   unsigned char *dataToVerify,
   unsigned int dataToVerifyLen,
   unsigned char *signature,
   unsigned int sigLen,
   unsigned int *verifyResult
));

/* This routine does the work. It allocates and fills in the contexts.
 * <p>The reason this is public is that Diffie-Hellman code will use
 * this function as well.
 *
 * @param obj The algorithm object to set.
 * @param primeSizeBits The size primeP needs to be.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
int VOLT_CALLING_CONV SetObjectDSAParamGen VOLT_PROTO_LIST ((
   VoltParameterObject *obj,
   unsigned int primeSizeBits
));

/* Implements VCloneObject.
 */
int VOLT_CALLING_CONV VoltCloneDsaPubKey VOLT_PROTO_LIST ((
   Pointer sourceObject,
   Pointer *destObject
));

/* Implements VCloneObject.
 */
int VOLT_CALLING_CONV VoltCloneDsaPriKey VOLT_PROTO_LIST ((
   Pointer sourceObject,
   Pointer *destObject
));

/* Implements VCtxDestroy.
 */
void VOLT_CALLING_CONV DSAParameterDataDestroy VOLT_PROTO_LIST ((
   Pointer obj,
   Pointer ctx
));

/* Implements VCtxDestroy.
 */
void VOLT_CALLING_CONV DSAKeyPairDataDestroy VOLT_PROTO_LIST ((
   Pointer obj,
   Pointer ctx
));

/* Implements VCtxDestroy.
 */
void VOLT_CALLING_CONV DSAKeyDataDestroy VOLT_PROTO_LIST ((
   Pointer obj,
   Pointer ctx
));

/* Implements VCtxDestroy.
 */
void VOLT_CALLING_CONV DSASignCtxDestroy VOLT_PROTO_LIST ((
   Pointer obj,
   Pointer ctx
));

#ifdef __cplusplus
}
#endif

#endif /* _DSA_H */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲色图一区二区| 欧美午夜精品理论片a级按摩| 亚洲成人7777| 一级特黄大欧美久久久| 亚洲激情六月丁香| 亚洲自拍偷拍av| 亚洲一区二区在线观看视频| 亚洲男人电影天堂| 亚洲国产人成综合网站| 日韩va欧美va亚洲va久久| 免费看欧美女人艹b| 久久99精品国产麻豆婷婷洗澡| 麻豆久久一区二区| 国产夫妻精品视频| 91视频一区二区三区| 日本久久电影网| 欧美日韩亚洲综合一区二区三区| 欧美精品1区2区3区| 精品久久久久久久久久久久久久久| 久久久久高清精品| 亚洲视频1区2区| 日本美女一区二区三区| 久久99在线观看| 成人综合婷婷国产精品久久| 色综合激情久久| 日韩久久免费av| 1000精品久久久久久久久| 亚洲免费电影在线| 美女网站色91| 国产+成+人+亚洲欧洲自线| 色综合久久综合网欧美综合网| 在线观看视频91| 精品99一区二区| 中文字幕亚洲在| 美女一区二区在线观看| voyeur盗摄精品| 日韩一级大片在线| 亚洲欧美一区二区三区极速播放| 夜夜嗨av一区二区三区网页| 久久精品国产精品亚洲精品 | 制服丝袜亚洲播放| 欧美日韩一区精品| 国产欧美一区二区三区沐欲| 午夜精品久久久久久| 成人午夜在线免费| 欧美最猛性xxxxx直播| 日韩欧美在线不卡| 亚洲乱码精品一二三四区日韩在线| 日韩激情一区二区| 色美美综合视频| 欧美高清精品3d| 欧美激情一区二区三区四区| 国产精品综合二区| 欧美日韩精品免费观看视频| 中文字幕免费观看一区| 日日摸夜夜添夜夜添精品视频| 国产成人免费视频网站| 制服丝袜中文字幕一区| 亚洲精品国久久99热| 国产寡妇亲子伦一区二区| 欧美在线免费视屏| 中文字幕日本不卡| 国产成人在线视频网址| 欧美变态tickle挠乳网站| 婷婷六月综合亚洲| 91亚洲精品一区二区乱码| 国产亚洲精品bt天堂精选| 精一区二区三区| 欧美一级免费观看| 亚洲chinese男男1069| 色婷婷久久一区二区三区麻豆| 国产日韩欧美电影| 国产成人亚洲综合a∨婷婷图片| 精品精品国产高清一毛片一天堂| 欧美aaaaa成人免费观看视频| 欧美性大战久久久久久久 | 在线观看一区日韩| 国产精品美日韩| a4yy欧美一区二区三区| 国产精品久久久久影视| 国产成人自拍在线| 国产精品久久久久精k8| 91免费版pro下载短视频| 亚洲人成亚洲人成在线观看图片| 91色.com| 偷拍一区二区三区| 欧美三级日本三级少妇99| 婷婷综合另类小说色区| 日韩一区二区三区精品视频| 狠狠色狠狠色综合系列| 国产欧美精品区一区二区三区 | 日韩一区二区三区四区| 久久精品国产成人一区二区三区| 日韩免费观看高清完整版| 日韩av电影免费观看高清完整版| 日韩欧美三级在线| 不卡一区二区中文字幕| 亚洲视频网在线直播| 欧美精品1区2区| 国内精品伊人久久久久av影院| 亚洲国产成人在线| 欧美午夜影院一区| 国产在线精品一区二区三区不卡| 国产精品视频在线看| 一本色道久久综合狠狠躁的推荐| 午夜亚洲国产au精品一区二区| 欧美v日韩v国产v| 91免费观看视频在线| 青草国产精品久久久久久| 国产午夜亚洲精品理论片色戒| 成人成人成人在线视频| 性久久久久久久久久久久| 精品久久国产字幕高潮| 成人av在线一区二区三区| 亚洲国产视频a| 精品毛片乱码1区2区3区| 99久久精品一区二区| 麻豆一区二区三| 综合分类小说区另类春色亚洲小说欧美 | 亚洲精品成人悠悠色影视| 欧美一级夜夜爽| 91久久奴性调教| 国产精品自在欧美一区| 亚洲国产wwwccc36天堂| 国产精品视频线看| 精品免费视频.| 欧美无乱码久久久免费午夜一区| 成人性视频免费网站| 日韩成人免费电影| 亚洲最新在线观看| 国产精品美女久久久久久| 欧美一区二区三区在线视频| 色综合天天做天天爱| 国产成人综合自拍| 麻豆精品一二三| 性欧美疯狂xxxxbbbb| 综合久久久久久| 久久精品人人做| 欧美电视剧免费全集观看| 欧美日韩欧美一区二区| 91黄视频在线观看| av男人天堂一区| 国产精品888| 国产另类ts人妖一区二区| 日本在线观看不卡视频| 午夜视频在线观看一区二区 | 欧美日韩国产一级片| 成人福利视频网站| 成人在线视频一区| 成人一级片在线观看| 国产91精品免费| 成人深夜福利app| 国产精品一区二区不卡| 波多野结衣在线一区| 成人禁用看黄a在线| 国产不卡在线视频| 国产91在线|亚洲| 国产精品久久久久9999吃药| 在线精品观看国产| av在线这里只有精品| 国产91丝袜在线18| 成人黄色在线看| 99re成人在线| 欧美伊人久久久久久午夜久久久久| 成人午夜私人影院| 97国产一区二区| 欧美三级韩国三级日本三斤| 欧美精品色综合| 精品福利在线导航| 中文字幕成人av| 国产精品福利一区二区三区| ...xxx性欧美| 亚洲国产一区二区三区青草影视| 午夜精品久久久| 国产一区二区三区精品欧美日韩一区二区三区| 国产自产高清不卡| 成人小视频免费在线观看| 在线观看一区不卡| 精品免费视频.| 国产精品成人网| 丝袜美腿高跟呻吟高潮一区| 国产乱色国产精品免费视频| 成人一区在线观看| 欧美日韩三级一区二区| 久久久综合九色合综国产精品| 国产精品久久久久久亚洲毛片| 午夜国产精品影院在线观看| 国产精品一区久久久久| 在线观看av一区| 精品久久人人做人人爽| 亚洲精品高清在线观看| 极品少妇xxxx精品少妇| 91女人视频在线观看| 精品国产一区二区三区忘忧草| 中文字幕在线视频一区| 日韩成人精品在线观看| 91免费观看视频在线| 精品国产免费一区二区三区四区 | 日本高清无吗v一区| 精品奇米国产一区二区三区|