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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? asn.h

?? 研讀AxCrypt對(duì)加解密的處理方法
?? H
字號(hào):
#ifndef CRYPTOPP_ASN_H
#define CRYPTOPP_ASN_H

#include "filters.h"
#include "queue.h"
#include <vector>

NAMESPACE_BEGIN(CryptoPP)

// these tags and flags are not complete
enum ASNTag
{
	BOOLEAN 			= 0x01,
	INTEGER 			= 0x02,
	BIT_STRING			= 0x03,
	OCTET_STRING		= 0x04,
	TAG_NULL			= 0x05,
	OBJECT_IDENTIFIER	= 0x06,
	OBJECT_DESCRIPTOR	= 0x07,
	EXTERNAL			= 0x08,
	REAL				= 0x09,
	ENUMERATED			= 0x0a,
	UTF8_STRING			= 0x0c,
	SEQUENCE			= 0x10,
	SET 				= 0x11,
	NUMERIC_STRING		= 0x12,
	PRINTABLE_STRING 	= 0x13,
	T61_STRING			= 0x14,
	VIDEOTEXT_STRING 	= 0x15,
	IA5_STRING			= 0x16,
	UTC_TIME 			= 0x17,
	GENERALIZED_TIME 	= 0x18,
	GRAPHIC_STRING		= 0x19,
	VISIBLE_STRING		= 0x1a,
	GENERAL_STRING		= 0x1b
};

enum ASNIdFlag
{
	UNIVERSAL			= 0x00,
//	DATA				= 0x01,
//	HEADER				= 0x02,
	CONSTRUCTED 		= 0x20,
	APPLICATION 		= 0x40,
	CONTEXT_SPECIFIC	= 0x80,
	PRIVATE 			= 0xc0
};

inline void BERDecodeError() {throw BERDecodeErr();}

class CRYPTOPP_DLL UnknownOID : public BERDecodeErr
{
public:
	UnknownOID() : BERDecodeErr("BER decode error: unknown object identifier") {}
	UnknownOID(const char *err) : BERDecodeErr(err) {}
};

// unsigned int DERLengthEncode(unsigned int length, byte *output=0);
CRYPTOPP_DLL unsigned int DERLengthEncode(BufferedTransformation &out, unsigned int length);
// returns false if indefinite length
CRYPTOPP_DLL bool BERLengthDecode(BufferedTransformation &in, unsigned int &length);

CRYPTOPP_DLL void DEREncodeNull(BufferedTransformation &out);
CRYPTOPP_DLL void BERDecodeNull(BufferedTransformation &in);

CRYPTOPP_DLL unsigned int DEREncodeOctetString(BufferedTransformation &out, const byte *str, unsigned int strLen);
CRYPTOPP_DLL unsigned int DEREncodeOctetString(BufferedTransformation &out, const SecByteBlock &str);
CRYPTOPP_DLL unsigned int BERDecodeOctetString(BufferedTransformation &in, SecByteBlock &str);
CRYPTOPP_DLL unsigned int BERDecodeOctetString(BufferedTransformation &in, BufferedTransformation &str);

// for UTF8_STRING, PRINTABLE_STRING, and IA5_STRING
CRYPTOPP_DLL unsigned int DEREncodeTextString(BufferedTransformation &out, const std::string &str, byte asnTag);
CRYPTOPP_DLL unsigned int BERDecodeTextString(BufferedTransformation &in, std::string &str, byte asnTag);

CRYPTOPP_DLL unsigned int DEREncodeBitString(BufferedTransformation &out, const byte *str, unsigned int strLen, unsigned int unusedBits=0);
CRYPTOPP_DLL unsigned int BERDecodeBitString(BufferedTransformation &in, SecByteBlock &str, unsigned int &unusedBits);

// BER decode from source and DER reencode into dest
CRYPTOPP_DLL void DERReencode(BufferedTransformation &source, BufferedTransformation &dest);

//! Object Identifier
class CRYPTOPP_DLL OID
{
public:
	OID() {}
	OID(unsigned long v) : m_values(1, v) {}
	OID(BufferedTransformation &bt) {BERDecode(bt);}

	inline OID & operator+=(unsigned long rhs) {m_values.push_back(rhs); return *this;}

	void DEREncode(BufferedTransformation &bt) const;
	void BERDecode(BufferedTransformation &bt);

	// throw BERDecodeErr() if decoded value doesn't equal this OID
	void BERDecodeAndCheck(BufferedTransformation &bt) const;

	std::vector<unsigned long> m_values;

private:
	static void EncodeValue(BufferedTransformation &bt, unsigned long v);
	static unsigned int DecodeValue(BufferedTransformation &bt, unsigned long &v);
};

class EncodedObjectFilter : public Filter
{
public:
	enum Flag {PUT_OBJECTS=1, PUT_MESSANGE_END_AFTER_EACH_OBJECT=2, PUT_MESSANGE_END_AFTER_ALL_OBJECTS=4, PUT_MESSANGE_SERIES_END_AFTER_ALL_OBJECTS=8};
	EncodedObjectFilter(BufferedTransformation *attachment = NULL, unsigned int nObjects = 1, word32 flags = 0);

	void Put(const byte *inString, unsigned int length);

	unsigned int GetNumberOfCompletedObjects() const {return m_nCurrentObject;}
	unsigned long GetPositionOfObject(unsigned int i) const {return m_positions[i];}

private:
	BufferedTransformation & CurrentTarget();

	word32 m_flags;
	unsigned int m_nObjects, m_nCurrentObject, m_level;
	std::vector<unsigned int> m_positions;
	ByteQueue m_queue;
	enum State {IDENTIFIER, LENGTH, BODY, TAIL, ALL_DONE} m_state;
	byte m_id;
	unsigned int m_lengthRemaining;
};

//! BER General Decoder
class CRYPTOPP_DLL BERGeneralDecoder : public Store
{
public:
	explicit BERGeneralDecoder(BufferedTransformation &inQueue, byte asnTag);
	explicit BERGeneralDecoder(BERGeneralDecoder &inQueue, byte asnTag);
	~BERGeneralDecoder();

	bool IsDefiniteLength() const {return m_definiteLength;}
	unsigned int RemainingLength() const {assert(m_definiteLength); return m_length;}
	bool EndReached() const;
	byte PeekByte() const;
	void CheckByte(byte b);

	unsigned int TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true);
	unsigned int CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end=ULONG_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const;

	// call this to denote end of sequence
	void MessageEnd();

protected:
	BufferedTransformation &m_inQueue;
	bool m_finished, m_definiteLength;
	unsigned int m_length;

private:
	void Init(byte asnTag);
	void StoreInitialize(const NameValuePairs &parameters) {assert(false);}
	unsigned int ReduceLength(unsigned int delta);
};

//! DER General Encoder
class CRYPTOPP_DLL DERGeneralEncoder : public ByteQueue
{
public:
	explicit DERGeneralEncoder(BufferedTransformation &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED);
	explicit DERGeneralEncoder(DERGeneralEncoder &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED);
	~DERGeneralEncoder();

	// call this to denote end of sequence
	void MessageEnd();

private:
	BufferedTransformation &m_outQueue;
	bool m_finished;

	byte m_asnTag;
};

//! BER Sequence Decoder
class CRYPTOPP_DLL BERSequenceDecoder : public BERGeneralDecoder
{
public:
	explicit BERSequenceDecoder(BufferedTransformation &inQueue, byte asnTag = SEQUENCE | CONSTRUCTED)
		: BERGeneralDecoder(inQueue, asnTag) {}
	explicit BERSequenceDecoder(BERSequenceDecoder &inQueue, byte asnTag = SEQUENCE | CONSTRUCTED)
		: BERGeneralDecoder(inQueue, asnTag) {}
};

//! DER Sequence Encoder
class CRYPTOPP_DLL DERSequenceEncoder : public DERGeneralEncoder
{
public:
	explicit DERSequenceEncoder(BufferedTransformation &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED)
		: DERGeneralEncoder(outQueue, asnTag) {}
	explicit DERSequenceEncoder(DERSequenceEncoder &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED)
		: DERGeneralEncoder(outQueue, asnTag) {}
};

//! BER Set Decoder
class CRYPTOPP_DLL BERSetDecoder : public BERGeneralDecoder
{
public:
	explicit BERSetDecoder(BufferedTransformation &inQueue, byte asnTag = SET | CONSTRUCTED)
		: BERGeneralDecoder(inQueue, asnTag) {}
	explicit BERSetDecoder(BERSetDecoder &inQueue, byte asnTag = SET | CONSTRUCTED)
		: BERGeneralDecoder(inQueue, asnTag) {}
};

//! DER Set Encoder
class CRYPTOPP_DLL DERSetEncoder : public DERGeneralEncoder
{
public:
	explicit DERSetEncoder(BufferedTransformation &outQueue, byte asnTag = SET | CONSTRUCTED)
		: DERGeneralEncoder(outQueue, asnTag) {}
	explicit DERSetEncoder(DERSetEncoder &outQueue, byte asnTag = SET | CONSTRUCTED)
		: DERGeneralEncoder(outQueue, asnTag) {}
};

template <class T>
class ASNOptional : public member_ptr<T>
{
public:
	void BERDecode(BERSequenceDecoder &seqDecoder, byte tag, byte mask = ~CONSTRUCTED)
	{
		byte b;
		if (seqDecoder.Peek(b) && (b & mask) == tag)
			reset(new T(seqDecoder));
	}
	void DEREncode(BufferedTransformation &out)
	{
		if (this->get() != NULL)
			this->get()->DEREncode(out);
	}
};

//! key that can be ASN.1 encoded
/** derived class should override either BERDecodeKey or BERDecodeKey2 */
class CRYPTOPP_DLL ASN1Key : public ASN1CryptoMaterial
{
public:
	virtual OID GetAlgorithmID() const =0;
	virtual bool BERDecodeAlgorithmParameters(BufferedTransformation &bt)
		{BERDecodeNull(bt); return false;}
	virtual bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const
		{DEREncodeNull(bt); return false;}	// see RFC 2459, section 7.3.1
	//! decode subjectPublicKey part of subjectPublicKeyInfo, or privateKey part of privateKeyInfo, without the BIT STRING or OCTET STRING header
	virtual void BERDecodeKey(BufferedTransformation &bt) {assert(false);}
	virtual void BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, unsigned int size)
		{BERDecodeKey(bt);}
	//! encode subjectPublicKey part of subjectPublicKeyInfo, or privateKey part of privateKeyInfo, without the BIT STRING or OCTET STRING header
	virtual void DEREncodeKey(BufferedTransformation &bt) const =0;
};

//! encodes/decodes subjectPublicKeyInfo
class CRYPTOPP_DLL X509PublicKey : virtual public ASN1Key, public PublicKey
{
public:
	void BERDecode(BufferedTransformation &bt);
	void DEREncode(BufferedTransformation &bt) const;
};

//! encodes/decodes privateKeyInfo
class CRYPTOPP_DLL PKCS8PrivateKey : virtual public ASN1Key, public PrivateKey
{
public:
	void BERDecode(BufferedTransformation &bt);
	void DEREncode(BufferedTransformation &bt) const;

	//! decode optional attributes including context-specific tag
	/*! /note default implementation stores attributes to be output in DEREncodeOptionalAttributes */
	virtual void BERDecodeOptionalAttributes(BufferedTransformation &bt);
	//! encode optional attributes including context-specific tag
	virtual void DEREncodeOptionalAttributes(BufferedTransformation &bt) const;

private:
	ByteQueue m_optionalAttributes;
};

// ********************************************************

//! DER Encode Unsigned
/*! for INTEGER, BOOLEAN, and ENUM */
template <class T>
unsigned int DEREncodeUnsigned(BufferedTransformation &out, T w, byte asnTag = INTEGER)
{
	byte buf[sizeof(w)+1];
	unsigned int bc;
	if (asnTag == BOOLEAN)
	{
		buf[sizeof(w)] = w ? 0xff : 0;
		bc = 1;
	}
	else
	{
		buf[0] = 0;
		for (unsigned int i=0; i<sizeof(w); i++)
			buf[i+1] = byte(w >> (sizeof(w)-1-i)*8);
		bc = sizeof(w);
		while (bc > 1 && buf[sizeof(w)+1-bc] == 0)
			--bc;
		if (buf[sizeof(w)+1-bc] & 0x80)
			++bc;
	}
	out.Put(asnTag);
	unsigned int lengthBytes = DERLengthEncode(out, bc);
	out.Put(buf+sizeof(w)+1-bc, bc);
	return 1+lengthBytes+bc;
}

//! BER Decode Unsigned
// VC60 workaround: std::numeric_limits<T>::max conflicts with MFC max macro
// CW41 workaround: std::numeric_limits<T>::max causes a template error
template <class T>
void BERDecodeUnsigned(BufferedTransformation &in, T &w, byte asnTag = INTEGER,
					   T minValue = 0, T maxValue = 0xffffffff)
{
	byte b;
	if (!in.Get(b) || b != asnTag)
		BERDecodeError();

	unsigned int bc;
	BERLengthDecode(in, bc);

	SecByteBlock buf(bc);

	if (bc != in.Get(buf, bc))
		BERDecodeError();

	const byte *ptr = buf;
	while (bc > sizeof(w) && *ptr == 0)
	{
		bc--;
		ptr++;
	}
	if (bc > sizeof(w))
		BERDecodeError();

	w = 0;
	for (unsigned int i=0; i<bc; i++)
		w = (w << 8) | ptr[i];

	if (w < minValue || w > maxValue)
		BERDecodeError();
}

inline bool operator==(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
	{return lhs.m_values == rhs.m_values;}
inline bool operator!=(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
	{return lhs.m_values != rhs.m_values;}
inline bool operator<(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
	{return std::lexicographical_compare(lhs.m_values.begin(), lhs.m_values.end(), rhs.m_values.begin(), rhs.m_values.end());}
inline ::CryptoPP::OID operator+(const ::CryptoPP::OID &lhs, unsigned long rhs)
	{return ::CryptoPP::OID(lhs)+=rhs;}

NAMESPACE_END

#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品美女久久久久久| 全国精品久久少妇| 91原创在线视频| 亚洲丝袜另类动漫二区| 成人av资源在线| 色先锋aa成人| 国产欧美一区二区三区在线老狼| 国产剧情一区二区三区| 国产欧美一区二区三区网站| 成人黄色av电影| 悠悠色在线精品| 日韩网站在线看片你懂的| 韩国毛片一区二区三区| 中文字幕亚洲视频| 欧美日本视频在线| 国产成人激情av| 午夜成人免费视频| 国产日韩成人精品| 欧美视频完全免费看| 性做久久久久久免费观看| 日韩视频在线一区二区| 日本国产一区二区| 麻豆国产欧美日韩综合精品二区| 国产午夜精品美女毛片视频| 欧美日韩国产高清一区| 懂色av一区二区夜夜嗨| 蜜桃视频在线观看一区| 亚洲精品免费在线| 国产欧美一区二区精品婷婷| 欧美性生活一区| 成人久久18免费网站麻豆 | 五月激情丁香一区二区三区| 国产农村妇女精品| 精品粉嫩aⅴ一区二区三区四区| av中文字幕在线不卡| 久久精品国产99| 午夜电影网一区| 亚洲综合精品久久| 一区二区三区资源| 国产精品区一区二区三| 国产亚洲1区2区3区| 欧美r级电影在线观看| 精品国产一区a| 欧美一级片在线观看| 3d成人h动漫网站入口| 欧美日韩免费电影| 久久久久久麻豆| 国产99精品视频| 成人黄色免费短视频| 粉嫩绯色av一区二区在线观看| 国产福利一区在线| 成人黄色大片在线观看| 一本到一区二区三区| 91成人网在线| 欧美精品1区2区3区| 亚洲精品一区二区三区四区高清| 久久久国产午夜精品 | 精品999在线播放| 久久精品无码一区二区三区| 国产精品久久久久久一区二区三区 | 欧美mv和日韩mv国产网站| 91国产免费观看| 韩国在线一区二区| 国产精品一区二区不卡| www.一区二区| 欧美主播一区二区三区| 3d成人动漫网站| 中文子幕无线码一区tr| 蜜臀久久久久久久| 成人精品鲁一区一区二区| 99久久久无码国产精品| 欧美性猛交xxxx乱大交退制版 | 精品电影一区二区三区| 国产精品国产a| 亚洲伊人伊色伊影伊综合网| 久久成人综合网| 91蝌蚪porny九色| 欧美成人高清电影在线| 一区二区三区在线免费| 亚洲一区二区中文在线| 国产一区二区在线看| 欧美日韩亚洲另类| 国产精品素人一区二区| 精品一区二区三区不卡 | 椎名由奈av一区二区三区| 日日摸夜夜添夜夜添精品视频| 成人午夜电影网站| 久久影院视频免费| 日本成人在线一区| 91视频观看免费| 国产精品免费丝袜| 成人丝袜视频网| 国产亚洲欧美中文| 激情久久五月天| 欧美精品一二三| 亚洲一区二区三区爽爽爽爽爽| 91免费观看国产| 一区二区三区成人在线视频| 91免费国产视频网站| 亚洲国产日韩在线一区模特 | 日韩成人伦理电影在线观看| 欧美日韩视频专区在线播放| 亚洲一区二区高清| 色8久久精品久久久久久蜜| 亚洲欧美国产77777| 欧美在线色视频| 青青草原综合久久大伊人精品优势 | 国产成都精品91一区二区三| 久久久久久电影| 91在线观看污| 首页欧美精品中文字幕| 精品美女在线观看| 国产一区二区不卡在线| 亚洲欧美视频在线观看| 在线亚洲人成电影网站色www| 亚洲电影一区二区| 欧美一级免费大片| 国产东北露脸精品视频| 亚洲精品视频自拍| 精品久久久久久久久久久久久久久| 国产真实精品久久二三区| 国产精品每日更新在线播放网址| 色婷婷一区二区| 麻豆精品一二三| 亚洲青青青在线视频| 欧美va亚洲va| 欧美一区二区高清| 欧美日韩一区成人| 国产91高潮流白浆在线麻豆| 亚洲自拍偷拍综合| 国产精品国产三级国产aⅴ入口| 日韩欧美国产小视频| 欧美日韩不卡一区二区| 不卡av电影在线播放| 国产一区在线看| 美女在线观看视频一区二区| 亚洲第一综合色| 亚洲人午夜精品天堂一二香蕉| 久久综合狠狠综合久久激情| 欧美精品亚洲一区二区在线播放| 99久久久国产精品| 国产黄色精品网站| 韩国在线一区二区| 日本午夜精品视频在线观看| 日日欢夜夜爽一区| 婷婷丁香久久五月婷婷| 日韩精品一二三区| 日韩成人伦理电影在线观看| 麻豆视频一区二区| 成人天堂资源www在线| 国产精品一级黄| 韩国精品一区二区| 岛国精品在线播放| av网站一区二区三区| 欧美午夜免费电影| 欧美三级欧美一级| 精品剧情v国产在线观看在线| 91麻豆精品国产自产在线| 日韩亚洲欧美一区二区三区| 日韩免费高清视频| 中文字幕在线不卡一区二区三区| 国产精品伦理在线| 午夜欧美在线一二页| 毛片基地黄久久久久久天堂| 国产成人免费视频| 欧美午夜精品一区| 久久色成人在线| 亚洲综合区在线| 国产成人亚洲综合a∨猫咪| 成人h精品动漫一区二区三区| 欧美唯美清纯偷拍| 久久中文娱乐网| 日本麻豆一区二区三区视频| 在线免费精品视频| 中文字幕色av一区二区三区| 久久精品国产**网站演员| 欧美日韩国产在线观看| 亚洲精品免费在线| 国产精品一区二区男女羞羞无遮挡| 在线观看欧美黄色| 国产精品三级av在线播放| 日韩国产一二三区| 欧美日韩不卡一区二区| 日韩综合小视频| 日韩欧美中文字幕一区| 免费欧美在线视频| 精品裸体舞一区二区三区| 热久久免费视频| 欧美一区二区三区思思人| 日本aⅴ亚洲精品中文乱码| 欧美丝袜第三区| 亚洲国产精品精华液网站| 精品一区二区三区在线播放| 欧美xfplay| av资源站一区| 亚洲成人av中文| 日韩午夜在线观看视频| 久久精品国产精品亚洲精品| 精品国产一二三| 国产成人精品aa毛片|