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

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

?? cryptmis.c

?? 提供了很多種加密算法和CA認證及相關服務如CMP、OCSP等的開發(fā)
?? C
?? 第 1 頁 / 共 3 頁
字號:
#define BINARY_LINESIZE	48

/* Basic single-char en/decode functions */

#define encode(data)	binToAscii[ data ]
#define decode(data)	asciiToBin[ data ]

/* The headers and trailers used for base64-encoded certificate objects.
   Since the zero-th value is a non-value, we include a dummy entry at the
   start */

static const char *headerTbl[] = {
	NULL,
	"-----BEGIN CERTIFICATE-----" EOL,
	"-----BEGIN ATTRIBUTE CERTIFICATE-----" EOL,
	"-----BEGIN CERTIFICATE CHAIN-----" EOL,
	"-----BEGIN NEW CERTIFICATE REQUEST-----" EOL,
	"-----BEGIN CRL-----"  EOL
	};
static const char *trailerTbl[] = {
	NULL,
	"-----END CERTIFICATE-----" EOL,
	"-----END ATTRIBUTE CERTIFICATE-----" EOL,
	"-----END CERTIFICATE CHAIN-----" EOL,
	"-----END NEW CERTIFICATE REQUEST-----" EOL,
	"-----END CRL-----" EOL
	};

/* Check whether a data item has a header which identifies it as some form of
   PEM-style encoded certificate object and return the start position of the
   encoded data.  Since there are so many variants possible, we don't perform
   a very strict check because there'll always be some new variants which
   isn't handled.  The exact object type can be determined by the lower-level
   routines */

int base64checkHeader( const char *data, const int dataLength )
	{
	STREAM stream;
	char buffer[ 64 ];
	int ch, i;

	sMemConnect( &stream, data, dataLength );

	/* Sometimes the object can be preceded by a few blank lines - we're
	   fairly lenient with this */
	do
		ch = sgetc( &stream );
	while( ch == '\r' || ch == '\n' );
	buffer[ 0 ] = ch;

	/* We always have to start with 5 dashes and 'BEGIN '.  After this there
	   can be all sorts of stuff, but it has to end with another five dashes
	   and a newline */
	if( cryptStatusError( sread( &stream, buffer + 1, 10 ) ) || \
		memcmp( buffer, "-----BEGIN ", 11 ) )
		{
		sMemDisconnect( &stream );
		return( 0 );
		}
	for( i = 0; i < 40; i++ )
		if( sgetc( &stream ) == '-' )
			break;
	if( i == 40 )
		{
		sMemDisconnect( &stream );
		return( 0 );
		}
	if( cryptStatusError( sread( &stream, buffer, 4 ) ) || \
		memcmp( buffer, "----", 4 ) )
		{
		sMemDisconnect( &stream );
		return( 0 );
		}
	ch = sgetc( &stream );
	if( ch != '\n' )
		{
		if( ch == '\r' )
			{
			if( sgetc( &stream ) != '\n' )
				sungetc( &stream );
			}
		else
			{
			sMemDisconnect( &stream );
			return( 0 );
			}
		}

	/* Return the start position of the payload */
	i = stell( &stream );
	sMemDisconnect( &stream );
	return( cryptStatusError( i ) ? 0 : i );
	}

/* Check whether a data item has a header which identifies it as some form of
   S/MIME certificate data.  This gets quite complex because there are many
   possible variations in the headers.  Some early S/MIME agents used a
   content type of "application/x-pkcs7-mime",
   "application/x-pkcs7-signature", and "application/x-pkcs10", while newer
   ones use the same without the "x-" at the start.  Older agents would put
   the filename in the Content-Type "name" parameter while newer ones put it
   in the optional Content-Disposition "filename" parameter (actually for
   backwards-compatibility most newer ones tend to include both).  The
   Content-Description is optional.  The general header format (all
   whitespace is optional) is:

	Content-Type: application/{x-} \
		pkcs7-mime{; name=|; smime-type= \
					 enveloped-data|signed-data|certs-only}
		pkcs7-signature{; name=}
		pkcs10{; name=}
	Content-Disposition: attachment{; filename=}
	Content-Transfer-Encoding: base64
	Content-Description: S/MIME {Cryptographic Signature|???}

   The result is that we have to create a somewhat nontrivial parser to
   handle all the variations.

   In addition Netscape have their own MIME data types for certificates:

	Content-Type: application/x-x509-{user-cert|ca-cert|email-cert}

   (probably with other bits as well, details unknown) which we also handle,
   although the exact cert type is ignored since it's up to the cert handling
   routines to sort this out via authenticated attributes rather than using
   the unauthenticated MIME content type */

/* Various nonspecific parsing routines */

static void skipWhitespace( STREAM *stream )
	{
	int ch;

	do
		ch = sgetc( stream );
	while( ch == ' ' || ch == '\t' );
	sungetc( stream );
	}

static void skipEOL( STREAM *stream )
	{
	int ch;

	/* Skip a LF or CR with optional LF */
	ch = sgetc( stream );
	if( ch == '\n' )
		return;
	if( ch == '\r' && \
		sgetc( stream ) == '\n' )
		return;
	sungetc( stream );
	}

static BOOLEAN skipToNextToken( STREAM *stream )
	{
	int ch = sgetc( stream );

	/* If this is the end of the line, don't to anything */
	if( ch == '\r' || ch == '\n' )
		{
		sungetc( stream );
		return( TRUE );
		}

	/* Skip to the start of the next token after the current one.  This
	   parses ";{ }{EOL }}" */
	if( ch != ';' )
		return( FALSE );
	skipWhitespace( stream );
	ch = sgetc( stream );
	if( ch != '\r' && ch != '\n' )
		{
		sungetc( stream );
		return( TRUE );
		}
	skipEOL( stream );		/* Line is continued, skip EOL and whitespace */
	ch = sgetc( stream );
	if( ch != ' ' && ch != '\t' )
		return( FALSE );	/* Should have whitespace after continuation */
	skipWhitespace( stream );

	return( TRUE );
	}

static BOOLEAN skipCurrentToken( STREAM *stream )
	{
	BOOLEAN isQuoted = FALSE;
	int ch = sgetc( stream );

	while( ch != '\n' && ch != '\r' )
		{
		if( !isQuoted && ch == ';' )
			{
			/* If we reach an unquoted semicolon, we're at the end of the
			   token */
			sungetc( stream );
			return( skipToNextToken( stream ) );
			}
		if( ch == '"' )
			isQuoted = !isQuoted;
		ch = sgetc( stream );
		}
	sungetc( stream );

	return( isQuoted ? FALSE : skipToNextToken( stream ) );
	}

static BOOLEAN skipLine( STREAM *stream )
	{
	BOOLEAN continuation;
	int ch = sgetc( stream );

	/* MIME headers can be continued over multiple lines.  If there's a
	   semicolon at the end of the current line, we continue to the next
	   one */
	do
		{
		continuation = FALSE;
		while( ch != '\r' && ch != '\n' )
			{
			if( ( ch & 0x7F ) < ' ' )
			continuation = ( ch == ';' );
			ch = sgetc( stream );
			}
		if( continuation )
			{
			sungetc( stream );
			if( !skipToNextToken( stream ) )
				return( FALSE );
			ch = sgetc( stream );
			}
		}
	while( continuation );
	sungetc( stream );

	/* Check for a single EOL */
	skipEOL( stream );
	return( TRUE );
	}

/* Parse the various MIME header lines */

static BOOLEAN parseContentType( STREAM *stream )
	{
	char buffer[ 64 ];
	int ch;

	/* Look for "application/{x-}pkcs{7-mime|7-signature|10}" */
	skipWhitespace( stream );
	if( cryptStatusError( sread( stream, buffer, 12 ) ) || \
		memcmp( buffer, "application/", 12 ) )
		return( FALSE );
	if( sgetc( stream ) == 'x' )
		{
		/* Skip old-style "x-" header */
		if( sgetc( stream ) != '-' )
			return( FALSE );
		
		/* Check for one of the Netscape cert types */
		if( sgetc( stream ) == 'x' )
			{
			/* "x509-"*/
			if( cryptStatusError( sread( stream, buffer, 4 ) ) || \
				memcmp( buffer, "509-", 4 ) )
				return( FALSE );
			return( skipLine( stream ) );
			}
		sungetc( stream );
		}
	else
		sungetc( stream );
	if( cryptStatusError( sread( stream, buffer, 4 ) ) || \
		memcmp( buffer, "pkcs", 4 ) )
		return( FALSE );
	ch = sgetc( stream );
	if( ch == '7' )
		{
		if( sgetc( stream ) != '-' )
			return( FALSE );
		ch = sgetc( stream );
		if( ch != 'm' && ch != 's' )
			return( FALSE );
		if( ch == 'm' )
			{
			/* "pkcs7-mime" */
			if( cryptStatusError( sread( stream, buffer, 4 ) ) || \
				memcmp( buffer, "mime", 4 ) )
				return( FALSE );
			}
		else
			/* "pkcs7-signature" */
			if( cryptStatusError( sread( stream, buffer, 8 ) ) || \
				memcmp( buffer, "ignature", 8 ) )
				return( FALSE );
		}
	else
		if( ch == '1' )
			{
			/* "pkcs10" */
			if( sgetc( stream ) != '0' )
				return( FALSE );
			}
		else
			return( FALSE );
	if( !skipToNextToken( stream ) )
		return( FALSE );
	ch = sgetc( stream );
	if( ch == '\n' || ch == '\r' )
		{
		/* If that's all there is, return */
		sungetc( stream );
		skipEOL( stream );
		return( TRUE );
		}

	/* Check for an optional old-style name attribute */
	if( ch == 'n' )
		{
		/* name= */
		if( cryptStatusError( sread( stream, buffer, 4 ) ) || \
			memcmp( buffer, "ame=", 4 ) )
			return( FALSE );
		skipWhitespace( stream );
		if( !skipCurrentToken( stream ) )
			return( FALSE );
		ch = sgetc( stream );
		sungetc( stream );
		if( ch == '\n' || ch == '\r' )
			{
			/* If that's all there is, return */
			skipEOL( stream );
			return( TRUE );
			}
		}

	/* Check for an SMIME type */
	if( cryptStatusError( sread( stream, buffer, 11 ) ) || \
		memcmp( buffer, "smime-type=", 11 ) )
		return( FALSE );
	skipWhitespace( stream );
	ch = sgetc( stream );
	if( ch == 's' )
		{
		/* signed-data */
		if( cryptStatusError( sread( stream, buffer, 10 ) ) || \
			memcmp( buffer, "igned-data", 10 ) )
			return( FALSE );
		}
	else
		{
		/* certs-only */
		if( ch != 'c' )
			return( FALSE );
		if( cryptStatusError( sread( stream, buffer, 9 ) ) || \
			memcmp( buffer, "erts-only", 9 ) )
			return( FALSE );
		}

	return( skipLine( stream ) );
	}

static BOOLEAN parseContentDisposition( STREAM *stream )
	{
	char buffer[ 64 ];
	int ch;

	/* Look for "attachment" */
	skipWhitespace( stream );
	ch = sgetc( stream );
	if( ch == 'a' )
		{
		/* attachment */
		if( cryptStatusError( sread( stream, buffer, 9 ) ) || \
			memcmp( buffer, "ttachment", 9 ) )
			return( FALSE );
		}
	else
		{
		/* inline */
		if( ch != 'i' )
			return( FALSE );
		if( cryptStatusError( sread( stream, buffer, 5 ) ) || \
			memcmp( buffer, "nline", 5 ) )
			return( FALSE );
		}
	return( TRUE );
	}

static BOOLEAN parseContentTransferEncoding( STREAM *stream )
	{
	char buffer[ 64 ];

	/* Look for "base64" */
	skipWhitespace( stream );
	if( cryptStatusError( sread( stream, buffer, 6 ) ) || \
		memcmp( buffer, "base64", 6 ) )
		return( FALSE );
	return( skipLine( stream ) );
	}

/* Check an S/MIME header.  Returns the length of the header */

int smimeCheckHeader( const char *data, const int dataLength )
	{
	STREAM stream;
	BOOLEAN seenType = FALSE, seenDisposition = FALSE;
	BOOLEAN seenDescription = FALSE, seenTransferEncoding = FALSE;
	BOOLEAN dataOK = TRUE;
	char buffer[ 64 ];
	int ch;

	sMemConnect( &stream, data, dataLength );

	/* Sometimes the object can be preceded by a few blank lines - we're
	   fairly lenient with this */
	do
		ch = sgetc( &stream );
	while( ch == '\r' || ch == '\n' );

	/* Make sure there's a MIME content-type header there */
	if( ch != 'C' )
		{
		sMemDisconnect( &stream );
		return( 0 );
		}
	while( ch != '\r' && ch != '\n' )
		{
		/* Check for the different types of content header which are
		   allowed */
		if( cryptStatusError( sread( &stream, buffer, 7 ) ) || \
			memcmp( buffer, "ontent-", 7 ) )
			dataOK = FALSE;
		ch = sgetc( &stream );
		if( ch != 'D' && ch != 'T' )
			dataOK = FALSE;
		if( ch == 'D' )
			{
			ch = sgetc( &stream );
			if( ch == 'i' )
				{
				/* "Disposition:" */
				if( cryptStatusError( sread( &stream, buffer, 10 ) ) || \
					memcmp( buffer, "sposition:", 10 ) || seenDisposition )
					dataOK = FALSE;
				seenDisposition = TRUE;
				if( dataOK )
					dataOK = parseContentDisposition( &stream );
				}
			else
				{
				/* "Description:" */
				if( ch != 'e' )
					dataOK = FALSE;
				if( cryptStatusError( sread( &stream, buffer, 10 ) ) || \
					memcmp( buffer, "scription:", 10 ) || seenDescription )
					dataOK = FALSE;
				seenDescription = TRUE;
				if( dataOK )
					dataOK = skipLine( &stream );
				}
			}
		else
			{
			ch = sgetc( &stream );
			if( ch == 'y' )
				{
				/* "Type:" */
				if( cryptStatusError( sread( &stream, buffer, 4 ) ) || \
					memcmp( buffer, "ype:", 4 ) || seenType )
					dataOK = FALSE;
				seenType = TRUE;
				if( dataOK )
					dataOK = parseContentType( &stream );
				}
			else
				{
				/* "Transfer-Encoding:" */
				if( ch != 'r' )
					dataOK = FALSE;
				if( cryptStatusError( sread( &stream, buffer, 16 ) ) || \
					memcmp( buffer, "ansfer-Encoding:", 16 ) || \
					seenTransferEncoding )
					dataOK = FALSE;
				seenTransferEncoding = TRUE;
				if( dataOK )
					dataOK = parseContentTransferEncoding( &stream );
				}
			}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产综合色视频| 国产精品久久久久久久久果冻传媒| 高清久久久久久| caoporn国产一区二区| 欧美视频一区二区三区在线观看| 91精品国产综合久久精品麻豆| 成人福利视频网站| 欧美疯狂做受xxxx富婆| 综合电影一区二区三区| 美女一区二区视频| 日本伦理一区二区| 欧美极品美女视频| 免费一级欧美片在线观看| 在线亚洲一区二区| 欧美国产精品一区| 91丨国产丨九色丨pron| 精品久久久网站| 亚洲成av人**亚洲成av**| 国产成人一级电影| 日韩女同互慰一区二区| 日本成人在线看| 欧美日韩国产影片| 亚洲一卡二卡三卡四卡无卡久久| 成人高清在线视频| 五月婷婷另类国产| 欧美日本不卡视频| 国产精品 日产精品 欧美精品| 亚洲日本乱码在线观看| 91精品国产乱| 播五月开心婷婷综合| 性欧美疯狂xxxxbbbb| 久久精品无码一区二区三区| 久久精品99久久久| 久久先锋影音av鲁色资源网| 精品一区二区三区在线播放| 欧美本精品男人aⅴ天堂| 99综合电影在线视频| 欧美a级理论片| 亚洲精品国久久99热| 色综合久久88色综合天天6| 亚洲丝袜美腿综合| 欧美一区二区高清| 91免费在线播放| 国产一区91精品张津瑜| 国产精品成人一区二区三区夜夜夜| 这里只有精品免费| 色中色一区二区| 国产成人在线看| 久久er精品视频| 天天免费综合色| 亚洲欧美激情小说另类| 91麻豆精品国产91久久久久久久久| 国产98色在线|日韩| 美女看a上一区| 亚洲国产精品人人做人人爽| 日韩欧美区一区二| 欧美高清视频在线高清观看mv色露露十八 | 亚洲成av人片一区二区| 国产精品理论片| 久久久三级国产网站| 91免费小视频| 粉嫩aⅴ一区二区三区四区| 激情五月婷婷综合网| 日本成人在线看| 视频在线在亚洲| 中文无字幕一区二区三区| 99综合电影在线视频| 国产成人精品在线看| 国产一区在线不卡| 国产麻豆成人精品| 国产麻豆视频精品| 国产精品18久久久久| 中文字幕亚洲区| 777色狠狠一区二区三区| 欧美色视频一区| 成人av中文字幕| 欧美高清www午色夜在线视频| 色哟哟一区二区在线观看| 91一区一区三区| 91在线一区二区| 精品一区免费av| 极品少妇一区二区三区精品视频| 麻豆精品一区二区| 国产一区二区在线影院| 国产高清成人在线| 成人精品国产福利| 国产欧美一区二区三区网站| 欧美自拍丝袜亚洲| 欧美精品乱码久久久久久| 欧美人妖巨大在线| 精品久久一区二区| 国产三级欧美三级日产三级99| 国产欧美日韩在线视频| 亚洲欧美在线视频| 亚洲国产综合色| 老司机午夜精品| 成人免费高清在线| 国产精品自拍在线| 91丨国产丨九色丨pron| **欧美大码日韩| 一区二区免费视频| 国产日韩欧美综合一区| 国产精品国产三级国产a| 亚洲一区视频在线观看视频| 免费精品视频最新在线| 国产91对白在线观看九色| 99国产精品国产精品久久| 欧美视频一区二区在线观看| 精品久久久影院| 亚洲欧美偷拍卡通变态| 美国欧美日韩国产在线播放| 成人精品视频一区二区三区| 欧美在线观看视频一区二区| 日韩欧美一级二级| 成人免费在线观看入口| 日本美女一区二区| 99国产麻豆精品| 日韩一区二区精品| 91精品视频网| 国产精品久久久久久久久免费丝袜| 亚洲一区二区在线免费看| 国产精品影视在线观看| 欧美影视一区在线| 国产日韩欧美a| 图片区小说区区亚洲影院| 国产91精品一区二区麻豆网站| 本田岬高潮一区二区三区| 在线电影欧美成精品| 26uuu久久综合| 国产成人免费9x9x人网站视频| 91免费观看在线| 精品粉嫩超白一线天av| 欧美一区二区三级| 综合久久久久久| 国产精品影音先锋| 欧美一区二区精美| 亚洲电影一区二区三区| 91网址在线看| 国产日产欧产精品推荐色| 日韩激情视频在线观看| 色先锋资源久久综合| 国产精品丝袜久久久久久app| 蜜臀av亚洲一区中文字幕| 欧美系列亚洲系列| 日韩理论片一区二区| 国产91高潮流白浆在线麻豆| 欧美成人video| 男人的天堂亚洲一区| 在线免费观看一区| 亚洲女人小视频在线观看| 高清在线成人网| 久久久久久97三级| 国产综合久久久久影院| 日韩精品一区二区三区四区| 午夜精品久久久久影视| 在线观看日韩一区| 一区二区三区在线免费观看| a在线欧美一区| 欧美国产日本视频| 成人午夜av影视| 国产精品免费丝袜| 成人av在线一区二区| 国产精品午夜久久| 成人性生交大片免费看中文 | 日韩黄色片在线观看| 欧美日韩亚洲综合一区| 亚洲小少妇裸体bbw| 欧美色爱综合网| 爽好久久久欧美精品| 91精品国产综合久久久久久| 日韩在线a电影| 日韩一区二区影院| 久久99国产精品麻豆| 久久伊99综合婷婷久久伊| 国产福利不卡视频| 国产精品乱码久久久久久| 波多野结衣中文一区| 亚洲乱码中文字幕| 欧美日韩高清一区| 日本不卡的三区四区五区| 日韩欧美不卡一区| 国产成人精品1024| 中文字幕av一区二区三区免费看| 99re6这里只有精品视频在线观看| 亚洲男人天堂av网| 欧美日韩高清影院| 狠狠色综合色综合网络| 国产精品午夜免费| 91国产免费看| 久久99精品久久久久久久久久久久| 久久婷婷国产综合精品青草| 成人精品视频一区二区三区| 亚洲黄网站在线观看| 欧美一区二区观看视频| 国产69精品一区二区亚洲孕妇| 国产精品高潮呻吟久久| 欧美日韩中文另类| 国产99久久久国产精品免费看 | 日韩国产在线一| 国产天堂亚洲国产碰碰|