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

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

?? pubkey.h

?? 研讀AxCrypt對加解密的處理方法
?? H
?? 第 1 頁 / 共 5 頁
字號:
// pubkey.h - written and placed in the public domain by Wei Dai

#ifndef CRYPTOPP_PUBKEY_H
#define CRYPTOPP_PUBKEY_H

/** \file

	This file contains helper classes/functions for implementing public key algorithms.

	The class hierachies in this .h file tend to look like this:
<pre>
                  x1
                 / \
                y1  z1
                 |  |
            x2<y1>  x2<z1>
                 |  |
                y2  z2
                 |  |
            x3<y2>  x3<z2>
                 |  |
                y3  z3
</pre>
	- x1, y1, z1 are abstract interface classes defined in cryptlib.h
	- x2, y2, z2 are implementations of the interfaces using "abstract policies", which
	  are pure virtual functions that should return interfaces to interchangeable algorithms.
	  These classes have "Base" suffixes.
	- x3, y3, z3 hold actual algorithms and implement those virtual functions.
	  These classes have "Impl" suffixes.

	The "TF_" prefix means an implementation using trapdoor functions on integers.
	The "DL_" prefix means an implementation using group operations (in groups where discrete log is hard).
*/

#include "modarith.h"
#include "filters.h"
#include "eprecomp.h"
#include "fips140.h"
#include "argnames.h"
#include <memory>

// VC60 workaround: this macro is defined in shlobj.h and conflicts with a template parameter used in this file
#undef INTERFACE

NAMESPACE_BEGIN(CryptoPP)

//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunctionBounds
{
public:
	virtual ~TrapdoorFunctionBounds() {}

	virtual Integer PreimageBound() const =0;
	virtual Integer ImageBound() const =0;
	virtual Integer MaxPreimage() const {return --PreimageBound();}
	virtual Integer MaxImage() const {return --ImageBound();}
};

//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomizedTrapdoorFunction : public TrapdoorFunctionBounds
{
public:
	virtual Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const =0;
	virtual bool IsRandomized() const {return true;}
};

//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunction : public RandomizedTrapdoorFunction
{
public:
	Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const
		{return ApplyFunction(x);}
	bool IsRandomized() const {return false;}

	virtual Integer ApplyFunction(const Integer &x) const =0;
};

//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomizedTrapdoorFunctionInverse
{
public:
	virtual ~RandomizedTrapdoorFunctionInverse() {}

	virtual Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const =0;
	virtual bool IsRandomized() const {return true;}
};

//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunctionInverse : public RandomizedTrapdoorFunctionInverse
{
public:
	virtual ~TrapdoorFunctionInverse() {}

	Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const
		{return CalculateInverse(rng, x);}
	bool IsRandomized() const {return false;}

	virtual Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const =0;
};

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

//! message encoding method for public key encryption
class CRYPTOPP_NO_VTABLE PK_EncryptionMessageEncodingMethod
{
public:
	virtual ~PK_EncryptionMessageEncodingMethod() {}

	virtual bool ParameterSupported(const char *name) const {return false;}

	//! max size of unpadded message in bytes, given max size of padded message in bits (1 less than size of modulus)
	virtual unsigned int MaxUnpaddedLength(unsigned int paddedLength) const =0;

	virtual void Pad(RandomNumberGenerator &rng, const byte *raw, unsigned int inputLength, byte *padded, unsigned int paddedBitLength, const NameValuePairs &parameters) const =0;

	virtual DecodingResult Unpad(const byte *padded, unsigned int paddedBitLength, byte *raw, const NameValuePairs &parameters) const =0;
};

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

//! _
template <class TFI, class MEI>
class CRYPTOPP_NO_VTABLE TF_Base
{
protected:
	virtual const TrapdoorFunctionBounds & GetTrapdoorFunctionBounds() const =0;

	typedef TFI TrapdoorFunctionInterface;
	virtual const TrapdoorFunctionInterface & GetTrapdoorFunctionInterface() const =0;

	typedef MEI MessageEncodingInterface;
	virtual const MessageEncodingInterface & GetMessageEncodingInterface() const =0;
};

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

//! _
template <class BASE>
class CRYPTOPP_NO_VTABLE PK_FixedLengthCryptoSystemImpl : public BASE
{
public:
	unsigned int MaxPlaintextLength(unsigned int ciphertextLength) const
		{return ciphertextLength == FixedCiphertextLength() ? FixedMaxPlaintextLength() : 0;}
	unsigned int CiphertextLength(unsigned int plaintextLength) const
		{return plaintextLength <= FixedMaxPlaintextLength() ? FixedCiphertextLength() : 0;}

	virtual unsigned int FixedMaxPlaintextLength() const =0;
	virtual unsigned int FixedCiphertextLength() const =0;
};

//! _
template <class INTERFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_CryptoSystemBase : public PK_FixedLengthCryptoSystemImpl<INTERFACE>, protected BASE
{
public:
	bool ParameterSupported(const char *name) const {return this->GetMessageEncodingInterface().ParameterSupported(name);}
	unsigned int FixedMaxPlaintextLength() const {return this->GetMessageEncodingInterface().MaxUnpaddedLength(PaddedBlockBitLength());}
	unsigned int FixedCiphertextLength() const {return this->GetTrapdoorFunctionBounds().MaxImage().ByteCount();}

protected:
	unsigned int PaddedBlockByteLength() const {return BitsToBytes(PaddedBlockBitLength());}
	unsigned int PaddedBlockBitLength() const {return this->GetTrapdoorFunctionBounds().PreimageBound().BitCount()-1;}
};

//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_DecryptorBase : public TF_CryptoSystemBase<PK_Decryptor, TF_Base<TrapdoorFunctionInverse, PK_EncryptionMessageEncodingMethod> >
{
public:
	DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, unsigned int ciphertextLength, byte *plaintext, const NameValuePairs &parameters = g_nullNameValuePairs) const;
};

//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_EncryptorBase : public TF_CryptoSystemBase<PK_Encryptor, TF_Base<RandomizedTrapdoorFunction, PK_EncryptionMessageEncodingMethod> >
{
public:
	void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, unsigned int plaintextLength, byte *ciphertext, const NameValuePairs &parameters = g_nullNameValuePairs) const;
};

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

typedef std::pair<const byte *, unsigned int> HashIdentifier;

//! interface for message encoding method for public key signature schemes
class CRYPTOPP_NO_VTABLE PK_SignatureMessageEncodingMethod
{
public:
	virtual ~PK_SignatureMessageEncodingMethod() {}

	virtual unsigned int MaxRecoverableLength(unsigned int representativeBitLength, unsigned int hashIdentifierLength, unsigned int digestLength) const
		{return 0;}

	bool IsProbabilistic() const 
		{return true;}
	bool AllowNonrecoverablePart() const
		{throw NotImplemented("PK_MessageEncodingMethod: this signature scheme does not support message recovery");}
	virtual bool RecoverablePartFirst() const
		{throw NotImplemented("PK_MessageEncodingMethod: this signature scheme does not support message recovery");}

	// for verification, DL
	virtual void ProcessSemisignature(HashTransformation &hash, const byte *semisignature, unsigned int semisignatureLength) const {}

	// for signature
	virtual void ProcessRecoverableMessage(HashTransformation &hash, 
		const byte *recoverableMessage, unsigned int recoverableMessageLength, 
		const byte *presignature, unsigned int presignatureLength,
		SecByteBlock &semisignature) const
	{
		if (RecoverablePartFirst())
			assert(!"ProcessRecoverableMessage() not implemented");
	}

	virtual void ComputeMessageRepresentative(RandomNumberGenerator &rng, 
		const byte *recoverableMessage, unsigned int recoverableMessageLength,
		HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
		byte *representative, unsigned int representativeBitLength) const =0;

	virtual bool VerifyMessageRepresentative(
		HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
		byte *representative, unsigned int representativeBitLength) const =0;

	virtual DecodingResult RecoverMessageFromRepresentative(	// for TF
		HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
		byte *representative, unsigned int representativeBitLength,
		byte *recoveredMessage) const
		{throw NotImplemented("PK_MessageEncodingMethod: this signature scheme does not support message recovery");}

	virtual DecodingResult RecoverMessageFromSemisignature(		// for DL
		HashTransformation &hash, HashIdentifier hashIdentifier,
		const byte *presignature, unsigned int presignatureLength,
		const byte *semisignature, unsigned int semisignatureLength,
		byte *recoveredMessage) const
		{throw NotImplemented("PK_MessageEncodingMethod: this signature scheme does not support message recovery");}

	// VC60 workaround
	struct HashIdentifierLookup
	{
		template <class H> struct HashIdentifierLookup2
		{
			static HashIdentifier Lookup()
			{
				return HashIdentifier(NULL, 0);
			}
		};
	};
};

class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_DeterministicSignatureMessageEncodingMethod : public PK_SignatureMessageEncodingMethod
{
public:
	bool VerifyMessageRepresentative(
		HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
		byte *representative, unsigned int representativeBitLength) const;
};

class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_RecoverableSignatureMessageEncodingMethod : public PK_SignatureMessageEncodingMethod
{
public:
	bool VerifyMessageRepresentative(
		HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
		byte *representative, unsigned int representativeBitLength) const;
};

class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_DSA : public PK_DeterministicSignatureMessageEncodingMethod
{
public:
	void ComputeMessageRepresentative(RandomNumberGenerator &rng, 
		const byte *recoverableMessage, unsigned int recoverableMessageLength,
		HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
		byte *representative, unsigned int representativeBitLength) const;
};

class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_NR : public PK_DeterministicSignatureMessageEncodingMethod
{
public:
	void ComputeMessageRepresentative(RandomNumberGenerator &rng, 
		const byte *recoverableMessage, unsigned int recoverableMessageLength,
		HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
		byte *representative, unsigned int representativeBitLength) const;
};

class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_MessageAccumulatorBase : public PK_MessageAccumulator
{
public:
	PK_MessageAccumulatorBase() : m_empty(true) {}

	virtual HashTransformation & AccessHash() =0;

	void Update(const byte *input, unsigned int length)
	{
		AccessHash().Update(input, length);
		m_empty = m_empty && length == 0;
	}

	SecByteBlock m_recoverableMessage, m_representative, m_presignature, m_semisignature;
	Integer m_k, m_s;
	bool m_empty;
};

template <class HASH_ALGORITHM>
class PK_MessageAccumulatorImpl : public PK_MessageAccumulatorBase, protected ObjectHolder<HASH_ALGORITHM>
{
public:
	HashTransformation & AccessHash() {return this->m_object;}
};

//! _
template <class INTERFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_SignatureSchemeBase : public INTERFACE, protected BASE
{
public:
	unsigned int SignatureLength() const 
		{return this->GetTrapdoorFunctionBounds().MaxPreimage().ByteCount();}
	unsigned int MaxRecoverableLength() const 
		{return this->GetMessageEncodingInterface().MaxRecoverableLength(MessageRepresentativeBitLength(), GetHashIdentifier().second, GetDigestSize());}
	unsigned int MaxRecoverableLengthFromSignatureLength(unsigned int signatureLength) const
		{return this->MaxRecoverableLength();}

	bool IsProbabilistic() const 
		{return this->GetTrapdoorFunctionInterface().IsRandomized() || this->GetMessageEncodingInterface().IsProbabilistic();}
	bool AllowNonrecoverablePart() const 
		{return this->GetMessageEncodingInterface().AllowNonrecoverablePart();}
	bool RecoverablePartFirst() const 
		{return this->GetMessageEncodingInterface().RecoverablePartFirst();}

protected:
	unsigned int MessageRepresentativeLength() const {return BitsToBytes(MessageRepresentativeBitLength());}
	unsigned int MessageRepresentativeBitLength() const {return this->GetTrapdoorFunctionBounds().ImageBound().BitCount()-1;}
	virtual HashIdentifier GetHashIdentifier() const =0;
	virtual unsigned int GetDigestSize() const =0;
};

//! _

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人在线视频首页| 国产精品一线二线三线| 精品国产免费一区二区三区香蕉 | 国产一区二区主播在线| 一区二区三区日韩欧美| 久久九九国产精品| 91精品国产色综合久久不卡蜜臀| 懂色av中文一区二区三区| 天天影视涩香欲综合网 | 日韩一区精品字幕| 亚洲色图清纯唯美| 精品美女一区二区三区| 欧美视频日韩视频| av在线播放一区二区三区| 九色综合狠狠综合久久| 午夜精品福利在线| 一区二区三区精品视频在线| 久久久.com| 精品福利一二区| 欧美一级欧美三级| 8v天堂国产在线一区二区| 在线观看91精品国产入口| 成人av电影在线观看| 国产成人免费高清| 国产精品一区二区在线看| 美女性感视频久久| 日韩高清不卡一区二区| 亚洲妇熟xx妇色黄| 亚洲国产精品久久一线不卡| 樱桃视频在线观看一区| 最新高清无码专区| 亚洲色图欧洲色图| 亚洲欧美色一区| 玉米视频成人免费看| 亚洲精品免费电影| 亚洲一二三专区| 亚洲国产视频一区二区| 亚洲成在人线在线播放| 午夜视频一区二区| 日日噜噜夜夜狠狠视频欧美人| 亚洲一区二区三区三| 亚洲一区二区视频在线| 一区二区三区在线影院| 亚洲综合一区二区精品导航| 一区二区三区.www| 亚洲国产精品久久人人爱| 午夜精品久久久久久久| 奇米888四色在线精品| 久久福利视频一区二区| 国产一区二区导航在线播放| 成人丝袜视频网| 99精品欧美一区| 欧美性猛交xxxx乱大交退制版 | 国产麻豆精品视频| 国产成人精品www牛牛影视| 国产69精品久久99不卡| av不卡免费电影| 在线影视一区二区三区| 777精品伊人久久久久大香线蕉| 91麻豆精品国产自产在线观看一区| 欧美一区二区三区婷婷月色| 精品欧美一区二区三区精品久久 | 欧美精品vⅰdeose4hd| 日韩欧美精品在线视频| 国产女同性恋一区二区| 亚洲欧美另类久久久精品2019| 亚洲一区二区三区小说| 麻豆精品视频在线观看视频| 成人午夜视频免费看| 日本精品免费观看高清观看| 欧美精品xxxxbbbb| 国产女人18毛片水真多成人如厕| 亚洲精品欧美专区| 精品一区二区免费看| eeuss鲁片一区二区三区| 欧美日韩国产一级| 国产午夜亚洲精品午夜鲁丝片 | 欧美高清在线视频| 一区二区三区国产| 国产精品一区二区无线| 在线视频一区二区免费| 欧美mv和日韩mv国产网站| 亚洲视频一二三| 青青草视频一区| 95精品视频在线| 日韩精品最新网址| 亚洲精品一二三四区| 国产美女精品人人做人人爽| 色综合天天性综合| 26uuu另类欧美亚洲曰本| 亚洲综合激情小说| 国产成人亚洲综合a∨婷婷图片 | 久久婷婷综合激情| 亚洲在线视频一区| 成人激情开心网| 日韩欧美三级在线| 亚洲成人免费av| 成人妖精视频yjsp地址| 日韩午夜精品视频| 亚洲成a人片综合在线| 成人自拍视频在线| 欧美一区二区三区色| 亚洲欧洲中文日韩久久av乱码| 国产一区二区免费视频| 日韩一区二区精品在线观看| 一区二区三区在线观看动漫| 国产精品系列在线播放| 日韩视频一区二区三区在线播放 | 亚洲影院久久精品| a在线欧美一区| 久久久综合精品| 久久成人羞羞网站| 日韩一区二区在线观看视频| 亚洲国产毛片aaaaa无费看| 白白色 亚洲乱淫| 久久精品人人爽人人爽| 裸体歌舞表演一区二区| 欧美精品久久天天躁| 亚洲一二三专区| 欧美综合久久久| 夜夜精品视频一区二区 | 欧美日韩在线综合| 一区二区三区自拍| 91麻豆国产福利在线观看| 国产日韩欧美a| 高清久久久久久| 中文字幕不卡一区| 国产福利一区在线观看| 久久久.com| 国产成人在线网站| 日本一区二区三区国色天香 | 99国产精品一区| 日本一区二区免费在线| 懂色中文一区二区在线播放| 欧美国产日韩亚洲一区| 成人性生交大合| 亚洲色大成网站www久久九九| 高潮精品一区videoshd| 中文一区二区在线观看| 成人不卡免费av| 亚洲人快播电影网| 色婷婷国产精品| 亚洲高清一区二区三区| 欧美精品精品一区| 久久精品国产亚洲一区二区三区| 欧美成人精品1314www| 国产美女精品在线| 中文字幕一区二区三区四区| 99国产精品一区| 亚洲成人激情av| 精品国产一区二区三区av性色| 国产米奇在线777精品观看| 国产精品久久毛片av大全日韩| www.日韩在线| 亚洲va欧美va天堂v国产综合| 337p亚洲精品色噜噜狠狠| 免费在线观看日韩欧美| 久久综合精品国产一区二区三区| 国产电影一区二区三区| 亚洲天天做日日做天天谢日日欢 | 天堂久久久久va久久久久| 日韩一区二区麻豆国产| 国产激情一区二区三区桃花岛亚洲| 国产精品久久久久aaaa| 欧洲一区二区三区在线| 另类小说欧美激情| 国产精品毛片无遮挡高清| 欧美在线free| 加勒比av一区二区| 中文字幕五月欧美| 欧美一级生活片| 成人影视亚洲图片在线| 亚洲最色的网站| 精品免费日韩av| 91日韩一区二区三区| 日本在线不卡一区| 国产精品日韩精品欧美在线| 欧美日韩国产综合视频在线观看 | 色婷婷精品久久二区二区蜜臂av| 亚洲a一区二区| 中文欧美字幕免费| 欧美精品一级二级三级| 成人网在线免费视频| 日韩av网站在线观看| 国产精品初高中害羞小美女文| 在线成人av网站| 成人a区在线观看| 麻豆精品国产91久久久久久| 亚洲美女区一区| 国产亚洲欧洲一区高清在线观看| 欧美色精品在线视频| 成人丝袜高跟foot| 久久精品国产精品亚洲综合| 一区二区三区四区av| 久久久亚洲精品石原莉奈| 欧美电影影音先锋| 91官网在线免费观看| 国产成人一级电影| 久久电影国产免费久久电影| 亚洲大片一区二区三区|