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

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

?? win32filestore.c

?? IBE是一種非對稱密碼技術
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* Copyright 2003-2006, Voltage Security, all rights reserved.
 */
#include "vibe.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "vsstore.h"
#include "voltfile.h"
#include "defaultstore.h"
#include "volti18n.h"
#include "derhelp.h"
#include "algid.h"
#include "errorctx.h"

#define VOLT_EXTRA_PASS_ITERATION_COUNT  32000
#define PASS_FILE_STRING (unsigned char *)"passwordfile"
#define PASS_FILE_STRING_LEN 12
#define VOLT_EXTRA_PASS_SALT_BIN_LEN  18
#define VOLT_EXTRA_PASS_SALT_LEN      24
#define VOLT_EXTRA_PASS_HMAC_LEN      28
#define VOLT_EXTRA_PASS_FILE_LEN      73
#define VOLT_EXTRA_PASS_REG_SIZE \
                  3*(VOLT_EXTRA_PASS_SALT_LEN+VOLT_EXTRA_PASS_HMAC_LEN)

#if VOLT_OS == VOLT_WINDOWS_32

#include <tchar.h>

/* Get the salt, iteration count, digest algorithm, and password HMAC
 * from the appropriate file, or indicate there is no HMAC and salt.
 * (Note that there is another routine that gets salt and HMAC from the
 * registry).
 * <p>If there is a file, the function will allocate buffers for the
 * salt, algID, and HMAC. It is the responsibility of the caller to
 * free those buffers. If there is no file, the function will not
 * allocate buffers for these values and will return NULL pointers.
 * <p>If there is a file containing the password info, the function
 * will return the file handle at the address given by
 * fileHandleReturn. (This function will not check the validity of the
 * fileHandleReturn arg). Upon return, the file pointer was reset to
 * the beginning of the file.
 * <p>NOTE!!! It is the caller's responsibility to close the file.
 * <p>If there is no file, the function will place no information into
 * the salt buffer, not allocate any buffers, set fileHandleReturn
 * to NULL, and will return 0.
 * <p>Whether or not there is a file, the function will return the
 * file name. It is either the name of the file that exists or the name
 * of the file that should exist. The function will allocate the memory
 * to hold the file name and place into that memory a NULL-terminated
 * string. It is the responsibility of the caller to free the memory.
 *
 * @param ctx The storage ctx that contains all the info to find the
 * file.
 * @param iterationCount Where the function will deposit the iteration
 * count.
 * @param digestAlgId The address where the function will deposit the
 * pointer to the allocated memory containing the algID of the digest.
 * @param digestAlgIdLen Where the function will deposit the length, in
 * bytes, of the digest alg ID.
 * @param salt Where the function will deposit a pointer to the
 * allocated space that contains the salt.
 * @param saltLen Where the function will deposit the length of the
 * salt.
 * @param hmac Where the function will deposit a pointer to the
 * allocated space that contains the HMAC.
 * @param hmacLen Where the function will deposit the length of the
 * HMAC.
 * @param fileNameReturn The address where the function will deposit a
 * pointer to a NULL-terminated string that is the file name.
 * @param fileHandleReturn The address where the function will place
 * the file handle of the file containing the salt and HMAC. If there
 * is no file, the function will place NULL there.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV VoltGetSaltAndHmacFromFile VOLT_PROTO_LIST ((
   VoltStorageCtx *ctx,
   unsigned int *iterationCount,
   unsigned char **digestAlgId,
   unsigned int *digestAlgIdLen,
   unsigned char **salt,
   unsigned int *saltLen,
   unsigned char **hmac,
   unsigned int *hmacLen,
   unsigned char **fileNameReturn,
   VoltFileHandle *fileHandleReturn
));

/* Get the digest Impl based on the algID. If no algID is given, return
 * a default Impl, allocate space to hold the algID of the default
 * digest algorithm, and return that allocated space.
 *
 * @param libCtx
 * @param algId The address where the function will either find the
 * pointer to the existing algID, or deposit the pointer to the newly
 * allocated memory holding the algID of the chosen algorithm.
 * @param algIdLen The address where the function will either find the
 * length, in bytes, of the existing algID, or deposit the length of
 * the newly allocated memory holding the algID of the chosen algorithm.
 * @param DigestImpl The address where the function will deposit the
 * AlgorithmImpl for the digest algorithm represented by the algID.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV VoltGetDigestImpl VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   unsigned char **algId,
   unsigned int *algIdLen,
   VtAlgorithmImpl **DigestImpl
));

/* Build the DER encoding of the PasswordInfo.
 *
 * @param libCtx
 * @param digestAlgId
 * @param digestAlgIdLen
 * @param iterationCount
 * @param salt Buffer containing the salt.
 * @param saltLen The length, in bytes, of the salt.
 * @param hmac
 * @param hmacLen
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV VoltBuildPasswordInfoAlloc VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   unsigned char *digestAlgId,
   unsigned int digestAlgIdLen,
   unsigned int iterationCount,
   unsigned char *salt,
   unsigned int saltLen,
   unsigned char *hmac,
   unsigned int hmacLen,
   unsigned char **passwordInfo,
   unsigned int *passwordInfoLen
));

/* Get the salt and password HMAC from the registry, or indicate there
 * is no passworad and salt. (Note that there is another routine that
 * gets the values from a file).
 * <p>The salt is the Base64 encoding of 18 bytes of random data. The
 * password HMAC is the Base64 encoding of the result of an HMAC with
 * SHA-1.
 * <p>The caller passes a buffer that is at least
 * VOLT_EXTRA_PASS_SALT_LEN + VOLT_EXTRA_PASS_HMAC_LEN bytes big. This
 * function does not check the validity of the buffer, it is the
 * responsibility of the caller not to make a mistake.
 * <p>The function will place the salt into the first
 * VOLT_EXTRA_PASS_SALT_LEN bytes of the buffer and the password HMAC
 * into the next VOLT_EXTRA_PASS_HMAC_LEN bytes of the buffer.
 * <p>If there are registry entries containing the password info, the
 * function will set the valueLen to the number of bytes placed into
 * the buffer.
 * <p>If there is no password info in the registry, the function will
 * place no information into the buffer, set valueLen to 0, and will
 * return 0.
 *
 * @param ctx The storage ctx that contains all the info to find the
 * registry info.
 * @param buffer The buffer into which the function will place the salt
 * and HMAC.
 * @param valueLen The address where the function will deposit the
 * number of bytes placed into the buffer (0 means no info in the
 * registry).
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV VoltGetSaltAndHmacFromRegistry VOLT_PROTO_LIST ((
   VoltStorageCtx *ctx,
   unsigned char *buffer,
   unsigned int *valueLen
));

/* The buffer contains the salt and password HMAC. Store them in the
 * registry.
 * <p>The first VOLT_EXTRA_PASS_SALT_LEN bytes in the buffer are the
 * salt bytes, the next VOLT_EXTRA_PASS_HMAC_LEN bytes are the password
 * HMAC.
 *
 * @param ctx The storage ctx for which the password info is being
 * stored.
 * @param buffer Contains the data to store.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV VoltStoreSaltAndHmacInRegistry VOLT_PROTO_LIST ((
   VoltStorageCtx *ctx,
   unsigned char *buffer
));

/* Clear the Hmac value from the registry to indicate that no password is set.
 * this doesn't affect the salt value.
 * @param ctx The storage ctx for which the password info is being
 * stored. 
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV VoltDeleteHmacFromRegistry VOLT_PROTO_LIST ((
  VoltLibCtx *libCtx 
));

/* Find all files encrypted using an old extra password, decrypt them,
 * re-encrypt them using the new extra password, and store the
 * newly-encrypted files.
 * <p>If there is no old password (the oldPassword arg is NULL), just
 * decrypt the files using the Windows protected storage and encrypt them
 * using the new extra password.
 *
 * @param ctx The storage ctx that contains all the info to find the
 * files.
 * @param oldPassword If not NULL, the extra password to use to decrypt
 * files.
 * @param oldPasswordLen The length, in bytes, of the oldPassword.
 * @param password The extra password to use to encrypt the files.
 * @param passwordLen The length, in bytes, of the password.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV VoltReEncryptFiles VOLT_PROTO_LIST ((
   VoltStorageCtx *ctx,
   unsigned char *oldPassword,
   unsigned int oldPasswordLen,
   unsigned char *password,
   unsigned int passwordLen
));

/* This is for client compatible storage
*/
static int VOLT_CALLING_CONV VoltReEncryptFilesClient VOLT_PROTO_LIST ((
   VoltStorageCtx *ctx,
   unsigned char *oldPassword,
   unsigned int oldPasswordLen,
   unsigned char *password,
   unsigned int passwordLen
));

/* Implements VSetExtraPassword
 */
int VOLT_CALLING_CONV VoltWinSetExtraPassword VOLT_PROTO_LIST ((
   VtStorageCtx storageCtx,
   Pointer info
));

/* Implements VSetExtraPassword
 */
int VOLT_CALLING_CONV VoltWinClientSetExtraPassword VOLT_PROTO_LIST ((
   VtStorageCtx storageCtx,
   Pointer info
));

/* Compute the salt and then use the password and salt to compute the
 * password HMAC. Or, if the salt is already computed, use the given
 * salt and compute the password HMAC. This will compute the salt and
 * HMAC following the method of the original client code.
 * <p>The caller passes in a flag indicating whether the salt is
 * computed or not. The flag is either VOLT_COMPUTE_SALT or
 * VOLT_USE_SALT.
 * <p>If the salt is not computed, the caller passes in a buffer big
 * enough to hold the result (24 bytes). If the salt is computed, the
 * caller passes in the actual salt. The salt is 24 bytes long, it is
 * the Base64 encoding of a 18-byte random value. This function does
 * not check an existing salt to make sure it is valid.
 * <p>The caller passes in a passwordHmac buffer which must be (at
 * least) 28 bytes long. The HMAC value is actually the Base64 of the
 * HMAC with SHA-1 of the key, salt, password (the key is a fixed
 * value).
 *
 * @param libCtx
 * @param random
 * @param flag Indicates whether the function should compute a new salt
 * or use the material in the salt buffer as the salt.
 * @param password The password used to compute the HMAC.
 * @param passwordLen The length, in bytes, of the password (this does
 * not include a NULL-terminating character).
 * @param salt A buffer, either contains an existing salt, or where the
 * computed salt will be placed.
 * @param passwordHmac A buffer, where the computed HMAC will be placed.
 * @param passwordHmacLen Points to size of buffer, result returned at
 * address.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV ComputePasswordValuesClient VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VtRandomObject random,
   unsigned int flag,
   unsigned char *password,
   unsigned int passwordLen,
   unsigned char *salt,
   unsigned char *passwordHmac,
   unsigned int *passwordHmacLen
));

/* Generate a random salt and use the password and salt to compute the
 * password HMAC. Or, if the salt is already computed, use the given
 * salt and password to compute the password HMAC. This will compute
 * the HMAC following the "toolkit method".
 * <p>The HMAC is acually HMAC with digest, the digest being variable.
 * For now, we support only SHA-1.
 * <p>The caller passes in a flag indicating whether the salt is
 * computed or not. The flag is either VOLT_COMPUTE_SALT or
 * VOLT_USE_SALT.
 * <p>If the flag is COMPUTE_SALT, the caller passes in a buffer big
 * enough to hold the result (saltLen bytes). If the flag is USE_SALT,
 * the caller passes in the actual salt. The salt is s random value.
 * This function does not check the validity of the salt args.
 * <p>The caller must also pass in an algorithm object set to perform
 * the digest desired.
 * <p>The function will allocate the memory to hold the result, the
 * caller must free the memory (hence the word Alloc in the name). The
 * caller passes the address of a pointer, the function will go to that
 * address and deposit a pointer to the allocated memory.
 *
 * @param libCtx
 * @param random
 * @param flag Indicates whether the function should compute a new salt
 * or use the material in the salt buffer as the salt.
 * @param DigestImpl An AlgorithmImpl to use to build the HMAC object
 * (assume the associated info is NULL).
 * @param password The password used to compute the HMAC.
 * @param passwordLen The length, in bytes, of the password (this does
 * not include a NULL-terminating character).
 * @param salt A buffer, either contains an existing salt, or where the
 * computed salt will be placed.
 * @param saltLen The length of the salt (if it is in the buffer), or
 * the length the salt should be.
 * @param passwordHmac Where the function will deposit the pointer to
 * the allocated memory holding the result.
 * @param passwordHmacLen Where the function will deposit the length of
 * the passwordHmac.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV ComputePasswordHmacAlloc VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   VtRandomObject random,
   unsigned int flag,
   VtAlgorithmImpl *DigestImpl,
   unsigned char *password,
   unsigned int passwordLen,
   unsigned char *salt,
   unsigned int saltLen,
   unsigned char **passwordHmac,
   unsigned int *passwordHmacLen
));

#define VOLT_COMPUTE_SALT  0
#define VOLT_USE_SALT      1

/* Check the directoryName, is it . or .. or a subdirecotry. The
 * direcotry name will be in wide chars.
 * <p>If the directoryName is . or .., set directoryLen to 0. If not,
 * set directoryLen to the number of bytes that make up the name. Note
 * that the number of bytes is not the number of characters. This count
 * will NOT include any NULL-terminating characters.
 *
 * @param libCtx
 * @param directoryName
 * @param directoryLen The address where the function will deposit
 * either a 0 (the directory is . or ..) or the number of bytes that
 * make up the directory name.
 * @return an int, 0 if the function completed successfully or a
 * non-zero error code.
 */
static int VOLT_CALLING_CONV SubdirectoryQuery VOLT_PROTO_LIST ((
   VoltLibCtx *libCtx,
   unsigned char *directoryName,
   unsigned int *directoryLen
));

/* Definitions of password info file contents.
 */
typedef struct
{
  Asn1Encoded *digestAlgId;
  ASN1_INTEGER *iterationCount;
  ASN1_OCTET_STRING *salt;
  ASN1_OCTET_STRING *hmac;
} Asn1PasswordInfoFileContents;

DECLARE_ASN1_FUNCTIONS (Asn1PasswordInfoFileContents)

ASN1_SEQUENCE (Asn1PasswordInfoFileContents) =
{
  ASN1_SIMPLE (Asn1PasswordInfoFileContents, digestAlgId, Asn1Encoded),
  ASN1_SIMPLE (Asn1PasswordInfoFileContents, iterationCount, ASN1_INTEGER),
  ASN1_SIMPLE (Asn1PasswordInfoFileContents, salt, ASN1_OCTET_STRING),
  ASN1_SIMPLE (Asn1PasswordInfoFileContents, hmac, ASN1_OCTET_STRING),
} ASN1_SEQUENCE_END (Asn1PasswordInfoFileContents);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一二三区视频| 国产精品一区二区无线| 欧美主播一区二区三区| 免费欧美高清视频| 亚洲自拍另类综合| 成人国产精品免费观看动漫| 九九九久久久精品| 老汉av免费一区二区三区| 精品一区二区国语对白| 韩国av一区二区三区在线观看| 青椒成人免费视频| 麻豆91在线看| 国产精品一级黄| 成人在线综合网| 色噜噜狠狠色综合欧洲selulu| 色噜噜狠狠色综合欧洲selulu| 欧美色欧美亚洲另类二区| 欧美日韩在线亚洲一区蜜芽| 欧美另类z0zxhd电影| 欧美精品九九99久久| 欧美mv日韩mv| 久久久国产精华| 成人欧美一区二区三区| 一区二区激情视频| 久久电影网站中文字幕| 国产呦精品一区二区三区网站| 成人午夜在线免费| 在线免费观看日本欧美| 日韩亚洲欧美成人一区| 国产欧美一区二区精品性色超碰| 专区另类欧美日韩| 日韩中文字幕一区二区三区| 韩国v欧美v日本v亚洲v| 一本色道久久综合狠狠躁的推荐| 欧美日本精品一区二区三区| 精品国产91洋老外米糕| 一区二区中文字幕在线| 日韩中文字幕91| 成人v精品蜜桃久久一区| 欧美日韩午夜影院| 国产欧美日韩在线视频| 亚洲国产综合在线| 国产高清在线观看免费不卡| 一区二区三区av电影 | 亚洲精品中文在线观看| 亚洲视频在线一区观看| 亚洲一区二区美女| 捆绑调教一区二区三区| 成人激情视频网站| 欧美视频一区二区三区在线观看| 欧美一级搡bbbb搡bbbb| 日本一区二区综合亚洲| 在线观看视频一区| 成人动漫视频在线| 欧美一级生活片| 亚洲欧美日韩国产另类专区| 美女一区二区三区| 一本一道综合狠狠老| 精品国产乱码久久久久久浪潮| 亚洲精品乱码久久久久久久久| 久久99在线观看| 欧美影视一区在线| 欧美激情资源网| 久久99精品久久久久久国产越南| 色8久久人人97超碰香蕉987| 2021国产精品久久精品| 日韩电影在线一区二区三区| eeuss鲁片一区二区三区在线看| 欧美大胆人体bbbb| 午夜不卡av在线| 色88888久久久久久影院野外 | 国产精品第四页| 精品影视av免费| 欧美高清视频不卡网| 亚洲日本电影在线| 国产99久久久国产精品免费看| 日韩一区二区高清| 天堂精品中文字幕在线| 日本韩国欧美一区二区三区| 久久老女人爱爱| 蜜乳av一区二区三区| 欧美日韩视频一区二区| 亚洲精品视频在线看| 成人av网址在线| 国产精品国产三级国产| 国产91富婆露脸刺激对白| 26uuuu精品一区二区| 卡一卡二国产精品 | 国产日韩av一区| 国产美女精品在线| 久久日一线二线三线suv| 久久精品久久精品| 26uuu另类欧美亚洲曰本| 美脚の诱脚舐め脚责91| 日韩一区二区视频在线观看| 日韩成人午夜电影| 欧美一级二级三级蜜桃| 日韩国产欧美在线视频| 欧美一级理论性理论a| 午夜视黄欧洲亚洲| 制服丝袜av成人在线看| 青青草视频一区| 精品乱码亚洲一区二区不卡| 黄色日韩网站视频| 国产三级精品视频| 波多野洁衣一区| 1区2区3区欧美| 在线观看亚洲一区| 日韩av一区二区三区| 日韩午夜精品视频| 国产最新精品免费| 国产精品免费网站在线观看| 99视频在线精品| 亚洲午夜在线观看视频在线| 欧美日韩色综合| 看片的网站亚洲| 欧美激情一区二区在线| 91亚洲大成网污www| 一区二区免费看| 日韩一级大片在线观看| 国产乱淫av一区二区三区| 国产精品毛片无遮挡高清| 色综合夜色一区| 日日摸夜夜添夜夜添精品视频| 精品国产凹凸成av人网站| 成人免费视频国产在线观看| 亚洲最大的成人av| 日韩欧美国产高清| 国产成人在线视频免费播放| 成人免费在线播放视频| 欧美疯狂性受xxxxx喷水图片| 国产一区二区三区视频在线播放| 中文字幕一区二区三区乱码在线 | 久久久综合视频| va亚洲va日韩不卡在线观看| 亚洲一区在线电影| 精品乱码亚洲一区二区不卡| 不卡视频一二三四| 午夜欧美2019年伦理| 久久精品一区二区三区不卡 | 一区二区三区在线免费视频| 日韩视频免费观看高清在线视频| 国产美女在线观看一区| 亚洲综合在线电影| 26uuu精品一区二区三区四区在线| 99久久综合国产精品| 日韩国产精品久久久久久亚洲| 国产亚洲女人久久久久毛片| 91麻豆福利精品推荐| 韩国av一区二区三区四区| 一区二区在线观看免费 | 麻豆专区一区二区三区四区五区| 久久精品亚洲精品国产欧美 | 国产一区欧美二区| 中文字幕的久久| 7777精品伊人久久久大香线蕉超级流畅 | 亚洲欧洲韩国日本视频| 91精品国产麻豆国产自产在线| 成人综合婷婷国产精品久久蜜臀 | 国产一区二区0| 亚洲成人av资源| 国产精品视频一二三| 日韩一区二区在线观看视频播放| 91亚洲精品乱码久久久久久蜜桃 | 欧美性一区二区| 高清在线观看日韩| 秋霞午夜av一区二区三区| 日韩毛片一二三区| 久久综合视频网| 91精品国产高清一区二区三区| 99精品在线免费| 国产盗摄一区二区三区| 日本不卡一二三| 亚洲成a人v欧美综合天堂| 亚洲天堂网中文字| 亚洲国产精品t66y| 精品剧情v国产在线观看在线| 精品污污网站免费看| 色综合夜色一区| www.一区二区| 国产成人av一区| 国产一区中文字幕| 麻豆国产欧美日韩综合精品二区 | 毛片不卡一区二区| 午夜av一区二区三区| 有码一区二区三区| 国产精品二三区| 国产精品美女久久久久久久| 精品电影一区二区三区| 欧美成人精精品一区二区频| 欧美日韩欧美一区二区| 欧美四级电影网| 视频一区在线播放| 日韩中文字幕1| 欧美高清hd18日本| 国产精品久久福利| 国产成人午夜片在线观看高清观看| 欧美日韩一区二区不卡| av在线不卡电影| 欧美另类久久久品|