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

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

?? cryptusr.c

?? 提供了很多種加密算法和CA認證及相關服務如CMP、OCSP等的開發
?? C
?? 第 1 頁 / 共 4 頁
字號:
		}
	return( status );
	}

/****************************************************************************
*																			*
*							User Management Functions						*
*																			*
****************************************************************************/

/* Perform a zeroise */

static int zeroiseUsers( void )
	{
	CRYPT_KEYSET iIndexKeyset;
	RESOURCE_DATA msgData;
	STREAM stream;
	static const BYTE zeroUserData[] = { 0x30, 0x00 };
	BYTE buffer[ KEYSET_BUFFERSIZE ];
	void *bufPtr = buffer;
	int length, status;

	/* Open the index file and read the index entries from it.  We open it in
	   exclusive mode and keep it open to ensure that noone else can access 
	   it while the zeroise is occurring */
	status = openUserKeyset( &iIndexKeyset, "index", 
							 CRYPT_IKEYOPT_EXCLUSIVEACCESS );
	if( cryptStatusError( status ) )
		/* If there's no index file present, we're already in the zeroised 
		   state */
		return( ( status == CRYPT_ERROR_NOTFOUND ) ? CRYPT_OK : status );
	status = readUserData( iIndexKeyset, CRYPT_IATTRIBUTE_USERINDEX,
						   &bufPtr, &length, 0 );
	if( cryptStatusError( status ) )
		{
		krnlSendNotifier( iIndexKeyset, RESOURCE_IMESSAGE_DECREFCOUNT );
		if( bufPtr != buffer )
			free( bufPtr );
		return( status );
		}

	/* Step through each entry clearing the user info for it */
	sMemConnect( &stream, bufPtr, length );
	while( stell( &stream ) < length )
		{
		STREAM fileStream;
		char userFilePath[ MAX_PATH_LENGTH + 128 ];	/* Protection for Windows */
		char userFileName[ 16 ];
		long fileRef;

		/* Get the file reference for this user */
		readSequence( &stream, NULL );
		readUniversal( &stream );
		readUniversal( &stream );
		readUniversal( &stream );
		status = readShortInteger( &stream, &fileRef );
		if( cryptStatusError( status ) )
			continue;

		/* Erase the given user keyset */
		sprintf( userFileName, "u%06x", fileRef );
		fileBuildCryptlibPath( userFilePath, userFileName, FALSE );
		status = sFileOpen( &fileStream, userFilePath, 
							FILE_READ | FILE_WRITE | FILE_EXCLUSIVE_ACCESS );
		if( cryptStatusError( status ) )
			continue;
		fileClearToEOF( &fileStream );
		sFileClose( &fileStream );
		fileUnlink( userFilePath );
		}
	sMemDisconnect( &stream );
	if( bufPtr != buffer )
		free( bufPtr );

	/* Erase the index file by setting zero-length user index info, which
	   results in an empty keyset which is erased on close */
	setResourceData( &msgData, ( void * ) zeroUserData, 2 );
	status = krnlSendMessage( iIndexKeyset, RESOURCE_IMESSAGE_SETATTRIBUTE_S, 
							  &msgData, CRYPT_IATTRIBUTE_USERINDEX );
	krnlSendNotifier( iIndexKeyset, RESOURCE_IMESSAGE_DECREFCOUNT );
	
	return( status );
	}

/* Create a user object keyset */

static int createUserKeyset( CRYPT_KEYSET *iCreatedKeyset, 
							 USER_INFO *userInfoPtr )
	{
	CRYPT_KEYSET iIndexKeyset, iUserKeyset;
	BOOLEAN newIndex = FALSE;
	BYTE buffer[ KEYSET_BUFFERSIZE ];
	void *bufPtr = buffer;
	char userFileName[ 16 ];
	int fileRef, length, status;

	/* Clear return value */
	*iCreatedKeyset = CRYPT_ERROR;

	/* Try and open the config file.  If we can't open it and the return 
	   status is something other than an indication that the file is in use,
	   it means the file doesn't exist so we try and create it instead.
	   Performing the create is safe because the stream subsystem will
	   either return an appropriate error code to indicate that the file is 
	   locked by another thread/process or will block until it becomes 
	   unlocked, depending on how the OS implements file locking */
	status = openUserKeyset( &iIndexKeyset, "index", 
							 CRYPT_IKEYOPT_EXCLUSIVEACCESS );
	if( cryptStatusError( status ) && status != CRYPT_ERROR_BUSY )
		{
		status = openUserKeyset( &iIndexKeyset, "index", 
								 CRYPT_KEYOPT_CREATE );
		newIndex = TRUE;
		}
	if( cryptStatusError( status ) )
		return( status );	

	/* If there's index data present, read it and make sure the new user 
	   isn't already present */
	if( !newIndex )
		{
		/* Read the index entries from the keyset */
		status = readUserData( iIndexKeyset, CRYPT_IATTRIBUTE_USERINDEX,
							   &bufPtr, &length, MAX_USERINDEX_SIZE );
		if( cryptStatusError( status ) )
			{
			krnlSendNotifier( iIndexKeyset, RESOURCE_IMESSAGE_DECREFCOUNT );
			if( bufPtr != buffer )
				free( bufPtr );
			return( status );
			}

		/* Check whether this user is present in the index */
		status = findUser( bufPtr, length, USERID_NAME, userInfoPtr->userName, 
						   userInfoPtr->userNameLength );
		if( !cryptStatusError( status ) )
			{
			krnlSendNotifier( iIndexKeyset, RESOURCE_IMESSAGE_DECREFCOUNT );
			if( bufPtr != buffer )
				free( bufPtr );
			return( CRYPT_ERROR_DUPLICATE );
			}

		/* Make sure the userID is unique */
		do
			{
			status = findUser( bufPtr, length, USERID_USERID, 
							   userInfoPtr->userID, KEYID_SIZE );
			if( !cryptStatusError( status ) )
				getNonce( userInfoPtr->userID, KEYID_SIZE );
			}
		while( !cryptStatusError( status ) );
		}
	else
		/* No users present yet, use the first user entry */
		fileRef = length = 0;

	/* Create the user keyset */
	sprintf( userFileName, "u%06x", fileRef );
	status = openUserKeyset( &iUserKeyset, userFileName, 
							 CRYPT_KEYOPT_CREATE );
	if( cryptStatusError( status ) )
		{
		krnlSendNotifier( iIndexKeyset, RESOURCE_IMESSAGE_DECREFCOUNT );
		if( bufPtr != buffer )
			free( bufPtr );
		return( status );
		}

	/* Update the index file */
	status = insertIndexEntry( userInfoPtr, bufPtr, &length );
	if( cryptStatusOK( status ) )
		{
		RESOURCE_DATA msgData;

		setResourceData( &msgData, bufPtr, length );
		status = krnlSendMessage( iIndexKeyset, 
								  RESOURCE_IMESSAGE_SETATTRIBUTE_S, &msgData, 
								  CRYPT_IATTRIBUTE_USERINDEX );
		}
	if( cryptStatusError( status ) )
		/* We couldn't update the index file, delete the newly-created user
		   keyset (since we haven't written anything to it, it's zero-length
		   so it's deleted automatically on close) */
		krnlSendNotifier( iUserKeyset, RESOURCE_IMESSAGE_DECREFCOUNT );
	else
		{
		userInfoPtr->fileRef = fileRef;
		*iCreatedKeyset = iUserKeyset;
		}
	krnlSendNotifier( iIndexKeyset, RESOURCE_IMESSAGE_DECREFCOUNT );

	/* Clean up */
	if( bufPtr != buffer )
		free( bufPtr );
	return( status );
	}

/* Set/change the password for a user object */

static int setPassword( USER_INFO *userInfoPtr, const char *password, 
						const int passwordLength )
	{
	CRYPT_KEYSET iUserKeyset;
	int status;

	/* No-one can ever directly set the default SO password */
	if( passwordLength == PRIMARYSO_PASSWORD_LENGTH && \
		( !memcmp( password, PRIMARYSO_PASSWORD, 
				   PRIMARYSO_PASSWORD_LENGTH ) || \
		  !memcmp( password, PRIMARYSO_ALTPASSWORD, 
				   PRIMARYSO_PASSWORD_LENGTH ) ) )
		return( CRYPT_ERROR_WRONGKEY );

	/* If we're setting the password for the primary SO in the zeroised
	   state, create a new user keyset and SO authentication key and write
	   the details to the keyset */
	if( userInfoPtr->fileRef == -1 )
		{
		status = createUserKeyset( &iUserKeyset, userInfoPtr );
		assert( ( cryptStatusError( status ) && userInfoPtr->fileRef == -1 ) || \
				( cryptStatusOK( status ) && userInfoPtr->fileRef == 0 ) );
		if( cryptStatusOK( status ) )
			{
			/* Since this user is created implicitly, there's no userID set 
			   by an explicit create so we set it now.  Since this is 
			   effectively a self-created user we also set the creatorID to 
			   the userID */
			getNonce( userInfoPtr->userID, KEYID_SIZE );
			memcpy( userInfoPtr->creatorID, userInfoPtr->userID, 
					KEYID_SIZE );
			status = createSOKey( iUserKeyset, userInfoPtr, 
								  password, passwordLength );
			}
		if( cryptStatusOK( status ) )
			status = writeUserInfo( iUserKeyset, userInfoPtr, 
									userInfoPtr->iCryptContext );

/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/*status = createCAKey( iUserKeyset, userInfoPtr, password, passwordLength );*/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
		}
	else
		{
		char userFileName[ 16 ];

		/* Open an existing user keyset */
		sprintf( userFileName, "u%06x", userInfoPtr->fileRef );
		status = openUserKeyset( &iUserKeyset, userFileName, 
								 CRYPT_KEYOPT_NONE );
		}
	if( cryptStatusError( status ) )
		return( status );

	/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
	/* set state = USER_INITED */
	/* write MAC( ??? ) to user file - needs PKCS #15 changes */
	/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/

	/* Close the keyset and commit the changes */
	krnlSendNotifier( iUserKeyset, RESOURCE_IMESSAGE_DECREFCOUNT );

	/* The password has been set, we're now in the user inited state */
	userInfoPtr->state = USER_STATE_USERINITED;
	return( CRYPT_OK );
	}

/****************************************************************************
*																			*
*							General User Object Functions					*
*																			*
****************************************************************************/

/* Handle a message sent to a user object */

static int userMessageFunction( const CRYPT_USER cryptUser,
								const RESOURCE_MESSAGE_TYPE message,
								void *messageDataPtr, const int messageValue )
	{
	USER_INFO *userInfoPtr;

	getCheckInternalResource( cryptUser, userInfoPtr, OBJECT_TYPE_USER );

	/* Process destroy object messages */
	if( message == RESOURCE_MESSAGE_DESTROY )
		{
		/* Clean up any user-related crypto objects if necessary */
		if( userInfoPtr->iCryptContext != CRYPT_ERROR )
			krnlSendNotifier( userInfoPtr->iCryptContext,
							  RESOURCE_IMESSAGE_DECREFCOUNT );
		if( userInfoPtr->iKeyset != CRYPT_ERROR )
			krnlSendNotifier( userInfoPtr->iKeyset,
							  RESOURCE_IMESSAGE_DECREFCOUNT );

		/* Clean up the config options */
		endOptions( userInfoPtr->configOptions );

		/* Delete the objects locking variables and the object itself */
		unlockResource( userInfoPtr );
		deleteResourceLock( userInfoPtr );
		zeroise( userInfoPtr, sizeof( USER_INFO ) );
		free( userInfoPtr );

		return( CRYPT_OK );
		}

	/* Process attribute get/set/delete messages */
	if( isAttributeMessage( message ) )
		{
		char userFileName[ 16 ];
		void *data;
		int length, status;

		if( messageValue == CRYPT_USERINFO_PASSWORD )
			{
			RESOURCE_DATA *msgData = messageDataPtr;

			status = setPassword( userInfoPtr, msgData->data, 
								  msgData->length );
			unlockResourceExit( userInfoPtr, status );
			}
		if( messageValue == CRYPT_USERINFO_CAKEY_CERTSIGN || \
			messageValue == CRYPT_USERINFO_CAKEY_CRLSIGN || \
			messageValue == CRYPT_USERINFO_CAKEY_OCSPSIGN )
			{
			const int objectHandle = *( int * ) messageDataPtr;
			const int requiredKeyUsage = \
				( messageValue == CRYPT_USERINFO_CAKEY_CERTSIGN ) ? \
					CRYPT_KEYUSAGE_KEYCERTSIGN : \
				( messageValue == CRYPT_USERINFO_CAKEY_CRLSIGN ) ? \
					CRYPT_KEYUSAGE_CRLSIGN : \
					( CRYPT_KEYUSAGE_DIGITALSIGNATURE | \
					  CRYPT_KEYUSAGE_NONREPUDIATION );
			int value;

			/* Make sure we've been given a signing key */
			status = krnlSendMessage( objectHandle, RESOURCE_IMESSAGE_CHECK, 
									  NULL, RESOURCE_MESSAGE_CHECK_PKC_SIGN );
			if( cryptStatusError( status ) )
				return( CRYPT_ARGERROR_NUM1 );

			/* Make sure the object has an initialised cert of the correct 
			   type associated with it */
			status = krnlSendMessage( objectHandle, 
									  RESOURCE_IMESSAGE_GETATTRIBUTE, 
									  &value, CRYPT_CERTINFO_IMMUTABLE );
			if( cryptStatusError( status ) || !value )
				return( CRYPT_ARGERROR_NUM1 );
			status = krnlSendMessage( objectHandle, 
									  RESOURCE_IMESSAGE_GETATTRIBUTE,
									  &value, CRYPT_CERTINFO_CERTTYPE );
			if( cryptStatusError( status ) ||
				( value != CRYPT_CERTTYPE_CERTIFICATE && \
				  value != CRYPT_CERTTYPE_CERTCHAIN ) )
				return( CRYPT_ARGERROR_NUM1 );

			/* Make sure the key usage required for this action is 
			   permitted.  OCSP is a bit difficult since the key may or may
			   not have an OCSP extended usage (depending on whether the CA 
			   bothers to set it or not, even if they do they may delegate 
			   the functionality to a short-term generic signing key) and the
			   signing ability may be indicated by either a digital signature
			   flag or a nonrepudiation flag depending on whether the CA
			   considers an OCSP signature to be short or long-term, so we
			   just check for a generic signing ability */
			status = krnlSendMessage( objectHandle, 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
97成人超碰视| 久久久久成人黄色影片| 日韩欧美亚洲一区二区| 国产精品久久久爽爽爽麻豆色哟哟| 玉米视频成人免费看| 国产在线精品免费| 欧美日韩成人综合天天影院| 中文字幕高清一区| 久久草av在线| 欧美色图第一页| 中文字幕中文字幕在线一区| 精品无码三级在线观看视频 | 香蕉久久一区二区不卡无毒影院| 激情久久五月天| 欧美日本韩国一区| 中文字幕综合网| 国产成人在线视频网址| 欧美剧情片在线观看| 亚洲女人的天堂| 成人午夜视频免费看| 欧美r级在线观看| 日本在线不卡视频| 欧美日韩精品一区二区三区四区| 18欧美亚洲精品| 成人中文字幕电影| 国产亚洲欧洲997久久综合| 蜜臀av性久久久久蜜臀aⅴ流畅| 在线观看区一区二| 夜夜揉揉日日人人青青一国产精品 | 欧美大片在线观看一区| 亚洲午夜免费电影| 欧美在线观看一区二区| 一区二区三区在线高清| 91网页版在线| 一区二区三区日韩精品视频| 99久久99久久久精品齐齐| 国产精品乱码妇女bbbb| 国产·精品毛片| 国产精品美女一区二区| 成人av网在线| 亚洲精品免费在线观看| 在线观看亚洲精品视频| 亚洲成人免费av| 久久新电视剧免费观看| 韩国成人福利片在线播放| 精品久久久久一区二区国产| 国模大尺度一区二区三区| 久久久综合激的五月天| 白白色 亚洲乱淫| 亚洲精品日韩专区silk| 欧美日韩精品是欧美日韩精品| 五月天视频一区| 日韩欧美成人一区二区| 国产做a爰片久久毛片 | 一本一道久久a久久精品综合蜜臀 一本一道综合狠狠老 | 成人爱爱电影网址| 亚洲男人天堂av网| 欧美巨大另类极品videosbest| 青青草国产精品97视觉盛宴 | 秋霞av亚洲一区二区三| 国产午夜精品福利| 色欧美88888久久久久久影院| 亚洲午夜久久久久久久久久久 | 成人中文字幕电影| 亚洲一区二区三区在线| 日韩久久精品一区| 波多野洁衣一区| 亚洲高清免费在线| 久久影院午夜片一区| 91在线视频播放地址| 天天影视网天天综合色在线播放| 久久网站最新地址| 色哦色哦哦色天天综合| 国产在线国偷精品免费看| 亚洲丝袜美腿综合| 欧美不卡在线视频| 91黄色小视频| 国产精品综合二区| 一级特黄大欧美久久久| 久久久久久久久久看片| 色猫猫国产区一区二在线视频| 美女视频黄 久久| 亚洲同性gay激情无套| 日韩欧美国产精品| 91国偷自产一区二区开放时间| 国内一区二区在线| 亚洲国产精品精华液网站| 国产精品天美传媒| 日韩精品专区在线影院重磅| 欧亚洲嫩模精品一区三区| 国产剧情在线观看一区二区| 亚洲1区2区3区4区| 成人欧美一区二区三区视频网页| 精品少妇一区二区三区日产乱码 | 韩国午夜理伦三级不卡影院| 一区二区三区小说| 日本一区二区三级电影在线观看| 91精品在线观看入口| 色视频欧美一区二区三区| 国产成人在线影院 | 欧美一卡在线观看| 欧美性一二三区| 99re这里都是精品| 成人免费毛片片v| 国模少妇一区二区三区| 麻豆国产精品一区二区三区 | 欧美午夜精品免费| 91在线看国产| av不卡免费电影| 99这里只有久久精品视频| 国产不卡免费视频| 国产精品 欧美精品| 国产精品亚洲综合一区在线观看| 青青草一区二区三区| 日韩黄色在线观看| 日韩国产在线观看一区| 日日夜夜精品视频免费| 天堂久久久久va久久久久| 亚洲一区二区三区国产| 一区二区免费视频| 亚洲国产视频一区二区| 午夜视频在线观看一区二区三区| 亚洲国产成人91porn| 亚洲成av人片在线观看无码| 手机精品视频在线观看| 日韩av电影天堂| 久99久精品视频免费观看| 麻豆精品国产91久久久久久| 国产一区二区三区四区五区美女| 韩国女主播成人在线| 粉嫩在线一区二区三区视频| 岛国精品在线观看| 91亚洲资源网| 欧美日韩国产一二三| 日韩午夜精品视频| 久久精品夜色噜噜亚洲aⅴ| 国产精品每日更新在线播放网址| 中文字幕亚洲一区二区va在线| 亚洲欧美日韩系列| 婷婷丁香激情综合| 国产一区二区三区蝌蚪| av不卡在线播放| 欧美日本一区二区| 久久久无码精品亚洲日韩按摩| 国产精品二三区| 日日夜夜精品视频天天综合网| 久久精品99国产精品| 成人国产精品视频| 欧美日韩极品在线观看一区| 精品国精品国产| 国产精品成人免费在线| 天天操天天干天天综合网| 国产原创一区二区| 在线看国产一区| 精品国产电影一区二区| 亚洲日本成人在线观看| 免费成人在线网站| av资源网一区| 欧美电视剧免费全集观看| 亚洲男人天堂av网| 激情综合色播激情啊| 色综合天天视频在线观看| 欧美成人一区二区三区| 亚洲欧美色综合| 国内外成人在线| 欧美日韩国产综合一区二区| 国产午夜精品久久久久久免费视| 亚洲国产成人91porn| 成人少妇影院yyyy| 日韩精品专区在线影院观看| 亚洲精品日韩专区silk| 国产电影精品久久禁18| 3d动漫精品啪啪一区二区竹菊| 国产精品理论在线观看| 精品一区二区在线视频| 在线一区二区观看| 中文字幕一区日韩精品欧美| 极品美女销魂一区二区三区免费| 在线日韩av片| 国产精品动漫网站| 国产.欧美.日韩| 亚洲精品在线一区二区| 免费在线观看不卡| 欧美三日本三级三级在线播放| 国产精品美日韩| 国产一区欧美二区| 亚洲欧美国产77777| 国产一区二区三区综合| 制服丝袜日韩国产| 亚洲成人午夜电影| 欧美无砖专区一中文字| 亚洲视频1区2区| av色综合久久天堂av综合| 欧美经典一区二区| 国产一二精品视频| 久久精品综合网| 国产乱码精品一区二区三区av| 久久一日本道色综合| 精品亚洲成a人在线观看| 精品久久久久久久久久久久久久久|