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

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

?? pubkey.h

?? 此文件是實現加解密算法的函數庫
?? H
?? 第 1 頁 / 共 4 頁
字號:
// 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 "integer.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)

Integer NR_EncodeDigest(unsigned int modulusBits, const byte *digest, unsigned int digestLen);
Integer DSA_EncodeDigest(unsigned int modulusBits, const byte *digest, unsigned int digestLen);

template <typename STANDARD>
struct CryptoStandardTraits
{
	typedef typename STANDARD::EncryptionPaddingAlgorithm EncryptionPaddingAlgorithm;

	template <class H> class SignaturePaddingAlgorithm {};
	template <class H> class DecoratedHashingAlgorithm {};
};

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

//! .
class 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 RandomizedTrapdoorFunction : public TrapdoorFunctionBounds
{
public:
	virtual Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const =0;
};

//! .
class TrapdoorFunction : public RandomizedTrapdoorFunction
{
public:
	Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const
		{return ApplyFunction(x);}

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

//! .
class RandomizedTrapdoorFunctionInverse
{
public:
	virtual ~RandomizedTrapdoorFunctionInverse() {}

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

//! .
class TrapdoorFunctionInverse : public RandomizedTrapdoorFunctionInverse
{
public:
	virtual ~TrapdoorFunctionInverse() {}

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

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

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

//! .
class PK_PaddingAlgorithm
{
public:
	virtual ~PK_PaddingAlgorithm() {}

	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 =0;

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

	virtual bool IsReversible() const {return true;}
};

//! .
class PK_NonreversiblePaddingAlgorithm : public PK_PaddingAlgorithm
{
	DecodingResult Unpad(const byte *padded, unsigned int paddedBitLength, byte *raw) const {assert(false); return DecodingResult();}
	bool IsReversible() const {return false;}
};

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

//! .
template <class TFI>
class TF_Base
{
protected:
	unsigned int PaddedBlockByteLength() const {return BitsToBytes(PaddedBlockBitLength());}

	virtual const TrapdoorFunctionBounds & GetTrapdoorFunctionBounds() const =0;
	virtual const PK_PaddingAlgorithm & GetPaddingAlgorithm() const =0;
	virtual unsigned int PaddedBlockBitLength() const =0;

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

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

//! .
template <class INTERFACE, class BASE>
class TF_CryptoSystemBase : public INTERFACE, protected BASE
{
public:
	unsigned int FixedMaxPlaintextLength() const {return GetPaddingAlgorithm().MaxUnpaddedLength(PaddedBlockBitLength());}
	unsigned int FixedCiphertextLength() const {return GetTrapdoorFunctionBounds().MaxImage().ByteCount();}

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

//! .
class TF_DecryptorBase : public TF_CryptoSystemBase<PK_FixedLengthDecryptor, TF_Base<TrapdoorFunctionInverse> >
{
public:
	DecodingResult FixedLengthDecrypt(const byte *cipherText, byte *plainText) const;
};

//! .
class TF_EncryptorBase : public TF_CryptoSystemBase<PK_FixedLengthEncryptor, TF_Base<RandomizedTrapdoorFunction> >
{
public:
	void Encrypt(RandomNumberGenerator &rng, const byte *plainText, unsigned int plainTextLength, byte *cipherText) const;
};

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

//! .
class DigestSignatureSystem
{
public:
	virtual unsigned int MaxDigestLength() const =0;
	virtual unsigned int DigestSignatureLength() const =0;
};

//! .
class DigestSigner : virtual public DigestSignatureSystem, public PrivateKeyAlgorithm
{
public:
	virtual void SignDigest(RandomNumberGenerator &rng, const byte *digest, unsigned int digestLen, byte *signature) const =0;
};

//! .
class DigestVerifier : virtual public DigestSignatureSystem, public PublicKeyAlgorithm
{
public:
	virtual bool VerifyDigest(const byte *digest, unsigned int digestLen, const byte *sig) const =0;
};

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

//! .
template <class INTERFACE, class BASE>
class TF_DigestSignatureSystemBase : public INTERFACE, protected BASE
{
public:
	unsigned int MaxDigestLength() const {return GetPaddingAlgorithm().MaxUnpaddedLength(PaddedBlockBitLength());}
	unsigned int DigestSignatureLength() const {return GetTrapdoorFunctionBounds().MaxPreimage().ByteCount();}

protected:
	unsigned int PaddedBlockBitLength() const {return GetTrapdoorFunctionBounds().ImageBound().BitCount()-1;}
};

//! .
class TF_DigestSignerBase : public TF_DigestSignatureSystemBase<DigestSigner, TF_Base<RandomizedTrapdoorFunctionInverse> >
{
public:
	void SignDigest(RandomNumberGenerator &rng, const byte *message, unsigned int messageLength, byte *signature) const;
};

//! .
class TF_DigestVerifierBase : public TF_DigestSignatureSystemBase<DigestVerifier, TF_Base<TrapdoorFunction> >
{
public:
	bool VerifyDigest(const byte *digest, unsigned int digestLen, const byte *sig) const;
};

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

//! .
template <class T1, class T2, class T3>
struct TF_SchemeOptions
{
	typedef T1 AlgorithmInfo;
	typedef T2 Keys;
	typedef typename Keys::PrivateKey PrivateKey;
	typedef typename Keys::PublicKey PublicKey;
	typedef T3 PaddingAlgorithm;
};

//! .
template <class KEYS>
class PublicKeyCopier
{
public:
	virtual void CopyKeyInto(typename KEYS::PublicKey &key) const =0;
};

//! .
template <class KEYS>
class PrivateKeyCopier
{
public:
	virtual void CopyKeyInto(typename KEYS::PublicKey &key) const =0;
	virtual void CopyKeyInto(typename KEYS::PrivateKey &key) const =0;
};

//! .
template <class BASE, class SCHEME_OPTIONS, class KEY>
class TF_ObjectImplBase : public AlgorithmImpl<BASE, typename SCHEME_OPTIONS::AlgorithmInfo>
{
public:
	typedef SCHEME_OPTIONS SchemeOptions;
	typedef KEY KeyClass;

	PublicKey & AccessPublicKey() {return AccessKey();}
	const PublicKey & GetPublicKey() const {return GetKey();}

	PrivateKey & AccessPrivateKey() {return AccessKey();}
	const PrivateKey & GetPrivateKey() const {return GetKey();}

	virtual const KeyClass & GetKey() const =0;
	virtual KeyClass & AccessKey() =0;

	const KeyClass & GetTrapdoorFunction() const {return GetKey();}

protected:
	const PK_PaddingAlgorithm & GetPaddingAlgorithm() const {static typename SCHEME_OPTIONS::PaddingAlgorithm paddingScheme; return paddingScheme;}
	const TrapdoorFunctionBounds & GetTrapdoorFunctionBounds() const {return GetKey();}
	const typename BASE::TrapdoorFunctionInterface & GetTrapdoorFunctionInterface() const {return GetKey();}
};

//! .
template <class BASE, class SCHEME_OPTIONS, class KEY>
class TF_ObjectImplExtRef : public TF_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY>
{
public:
	TF_ObjectImplExtRef(const KEY *pKey = NULL) : m_pKey(pKey) {}
	void SetKeyPtr(const KEY *pKey) {m_pKey = pKey;}

	const KEY & GetKey() const {return *m_pKey;}
	KEY & AccessKey() {throw NotImplemented("TF_ObjectImplExtRef: cannot modify refererenced key");}

	void CopyKeyInto(typename SCHEME_OPTIONS::PrivateKey &key) const {assert(false);}
	void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const {assert(false);}

private:
	const KEY * m_pKey;
};

//! .
template <class BASE, class SCHEME_OPTIONS, class KEY>
class TF_ObjectImpl : public TF_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY>
{
public:
	const KEY & GetKey() const {return m_trapdoorFunction;}
	KEY & AccessKey() {return m_trapdoorFunction;}

private:
	KEY m_trapdoorFunction;
};

//! .
template <class BASE, class SCHEME_OPTIONS>
class TF_PublicObjectImpl : public TF_ObjectImpl<BASE, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PublicKey>, public PublicKeyCopier<SCHEME_OPTIONS>
{
public:
	void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const {key = GetKey();}
};

//! .
template <class BASE, class SCHEME_OPTIONS>
class TF_PrivateObjectImpl : public TF_ObjectImpl<BASE, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PrivateKey>, public PrivateKeyCopier<SCHEME_OPTIONS>
{
public:
	void CopyKeyInto(typename SCHEME_OPTIONS::PrivateKey &key) const {key = GetKey();}
	void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const {key = GetKey();}
};

//! .
template <class SCHEME_OPTIONS>
class TF_DecryptorImpl : public TF_PrivateObjectImpl<TF_DecryptorBase, SCHEME_OPTIONS>
{
};

//! .
template <class SCHEME_OPTIONS>
class TF_EncryptorImpl : public TF_PublicObjectImpl<TF_EncryptorBase, SCHEME_OPTIONS>
{
};

//! .
template <class SCHEME_OPTIONS>
class TF_DigestSignerImpl : public TF_PrivateObjectImpl<TF_DigestSignerBase, SCHEME_OPTIONS>
{
};

//! .
template <class SCHEME_OPTIONS>
class TF_DigestVerifierImpl : public TF_PublicObjectImpl<TF_DigestVerifierBase, SCHEME_OPTIONS>
{
};

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

//! .
template <class H>
class P1363_MGF1
{
public:
	static std::string StaticAlgorithmName() {return std::string("MGF1(") + H::StaticAlgorithmName() + ")";}
	static void GenerateAndMask(byte *output, unsigned int outputLength, const byte *input, unsigned int inputLength);
};

template <class H>
void P1363_MGF1<H>::GenerateAndMask(byte *output, unsigned int outputLength, const byte *input, unsigned int inputLength)
{
	H h;
	ArrayXorSink *sink;
	HashFilter filter(h, sink = new ArrayXorSink(output, outputLength));
	word32 counter = 0;
	while (sink->AvailableSize() > 0)
	{
		filter.Put(input, inputLength);
		filter.PutWord32(counter++);
		filter.MessageEnd();
	}
}

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

//! .
template <class H>
class P1363_KDF2
{
public:
	static void DeriveKey(byte *output, unsigned int outputLength, const byte *input, unsigned int inputLength);
};

template <class H>
void P1363_KDF2<H>::DeriveKey(byte *output, unsigned int outputLength, const byte *input, unsigned int inputLength)
{
	H h;
	ArraySink *sink;
	HashFilter filter(h, sink = new ArraySink(output, outputLength));
	word32 counter = 1;
	while (sink->AvailableSize() > 0)
	{
		filter.Put(input, inputLength);
		filter.PutWord32(counter++);
		filter.MessageEnd();
	}
}

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

//! .
template <class H, class INTERFACE, class DS_INTERFACE>
class PK_SignatureSchemeBase : public INTERFACE
{
public:
	unsigned int SignatureLength() const {return GetDigestSignatureSchemeInterface().DigestSignatureLength();}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品影视av免费| 精品欧美一区二区三区精品久久| 中文字幕一区日韩精品欧美| 丁香一区二区三区| 中文乱码免费一区二区| 大尺度一区二区| 国产精品国产精品国产专区不片 | 久久色在线观看| 国模娜娜一区二区三区| 国产亚洲精品aa| 成人久久久精品乱码一区二区三区| 亚洲国产精品精华液2区45| 成人aa视频在线观看| 亚洲精品视频在线| 欧美日韩高清一区二区三区| 日本vs亚洲vs韩国一区三区二区| 日韩精品中文字幕在线不卡尤物 | 精品国产免费一区二区三区四区| 精品综合久久久久久8888| 国产日韩亚洲欧美综合| 91美女在线看| 久久精品国产免费看久久精品| 久久久久亚洲综合| 日本久久一区二区三区| 久久精品国产亚洲a| 欧美激情艳妇裸体舞| 欧美色图在线观看| 国产一区二区三区最好精华液| 亚洲色图另类专区| 日韩欧美aaaaaa| 色综合天天狠狠| 麻豆精品在线视频| 亚洲日穴在线视频| 91精品欧美久久久久久动漫| 国产成人在线视频网站| 一区二区三区毛片| 日韩三级在线免费观看| 成人a区在线观看| 欧美浪妇xxxx高跟鞋交| 欧美在线观看视频一区二区 | 欧洲精品一区二区| 日韩国产欧美在线播放| 久久午夜色播影院免费高清| 粉嫩一区二区三区性色av| 成人免费在线视频| 欧美情侣在线播放| 韩日av一区二区| 1024国产精品| 欧美一区三区二区| 成人免费视频播放| 亚洲欧美另类久久久精品| 日韩精品一区二区三区在线播放| av欧美精品.com| 日韩电影免费在线看| 国产精品美日韩| 欧美日韩高清在线| 成人激情小说网站| 亚洲国产一区二区a毛片| 中文字幕不卡的av| 欧美日韩成人高清| 99re这里只有精品首页| 国产精品正在播放| 日韩和欧美一区二区三区| 亚洲裸体在线观看| 久久亚洲春色中文字幕久久久| 欧美疯狂做受xxxx富婆| 91老师国产黑色丝袜在线| 成人三级伦理片| 久久99久久精品| 美女精品一区二区| 亚洲国产日韩av| 亚洲女人小视频在线观看| 欧美精品一区二区高清在线观看| 日韩写真欧美这视频| 国产欧美日韩精品一区| 欧美一级片在线看| 7777女厕盗摄久久久| 欧美色倩网站大全免费| 欧美亚洲综合久久| av中文字幕亚洲| 成人18视频日本| 粉嫩av一区二区三区粉嫩| 国产91精品露脸国语对白| 久久99国产精品免费网站| 蜜臀91精品一区二区三区 | 欧美激情一区二区三区| 欧美国产日韩亚洲一区| 日韩欧美视频一区| 精品美女被调教视频大全网站| 欧美精品乱人伦久久久久久| 制服丝袜成人动漫| 91福利视频在线| 欧美三级三级三级爽爽爽| 欧美日韩中文字幕一区二区| 色94色欧美sute亚洲线路一久| 欧美色网站导航| 欧美日韩一级二级| 欧美成人女星排名| 欧美一区二区三区免费视频| 欧美精品一区二区三区很污很色的 | 欧美午夜精品免费| 欧美性生活大片视频| 欧美日韩精品福利| 欧美一区二区在线观看| 久久天天做天天爱综合色| 欧美丝袜自拍制服另类| 色欧美88888久久久久久影院| 狠狠狠色丁香婷婷综合激情 | 97se亚洲国产综合自在线| 日本亚洲视频在线| 一区二区三区四区五区视频在线观看 | 精品日韩欧美一区二区| 337p亚洲精品色噜噜噜| 国产精品一区二区果冻传媒| 国产一区二区三区电影在线观看| 国产一区福利在线| 风间由美性色一区二区三区| 本田岬高潮一区二区三区| 色综合网站在线| 欧美日本一区二区| 精品sm捆绑视频| 国产精品理论在线观看| 亚洲欧洲制服丝袜| 激情六月婷婷久久| 99久久免费精品高清特色大片| 日本韩国欧美国产| 欧美一区二区三区男人的天堂| 欧美日韩和欧美的一区二区| 久久久久久久久久看片| 亚洲图片你懂的| 亚洲成人av一区二区三区| 美女精品一区二区| 成人黄色国产精品网站大全在线免费观看 | 午夜精品久久久久| 看片网站欧美日韩| 9色porny自拍视频一区二区| 欧美日韩国产影片| 久久青草国产手机看片福利盒子 | 国产精品一区二区免费不卡| 成人高清免费观看| 日韩女优毛片在线| 国产精品乱人伦中文| 日本中文在线一区| 成人av在线看| 欧美一二三区在线观看| 欧美国产视频在线| 日韩综合小视频| 成人激情小说网站| 欧美一区二区三区色| 中文字幕亚洲综合久久菠萝蜜| 国产乱码精品一区二区三| 在线区一区二视频| 久久精品男人天堂av| 五月天激情小说综合| 成人晚上爱看视频| 久久精品夜色噜噜亚洲aⅴ| 一卡二卡三卡日韩欧美| 国产91精品入口| 日韩一区二区三区四区| 夜夜嗨av一区二区三区| 91香蕉国产在线观看软件| www国产亚洲精品久久麻豆| 亚洲成人精品在线观看| 不卡一区二区中文字幕| 精品视频在线免费看| 亚洲在线观看免费视频| 成人av手机在线观看| 久久综合狠狠综合久久激情| 日韩 欧美一区二区三区| 欧美一区二区三区公司| 日韩国产在线一| 欧美在线视频你懂得| 日韩一区欧美一区| 国产成人av一区二区三区在线观看| 精品免费国产二区三区| 秋霞电影一区二区| 欧美精品久久天天躁| 亚洲免费在线观看| av一区二区三区| 亚洲男同1069视频| 成人福利在线看| 国产精品久久久久影视| 国产成a人无v码亚洲福利| 国产丝袜在线精品| 国产.精品.日韩.另类.中文.在线.播放| 日韩一区二区免费视频| 日本不卡的三区四区五区| 欧美精品777| 国产在线精品一区二区夜色| 精品乱人伦小说| 久久国产乱子精品免费女| 日韩欧美激情一区| 国产成人午夜高潮毛片| 国产日韩欧美激情| 成人听书哪个软件好| 国产精品视频看| 国产91在线看| 亚洲一区二区高清| 在线观看欧美黄色| 午夜国产精品影院在线观看|