Update documentation

pull/548/head
Jeffrey Walton 2017-11-26 02:45:34 -05:00
parent 14e631fd84
commit 4c0bfe4548
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 46 additions and 46 deletions

View File

@ -23,13 +23,13 @@
//! <li>x1, y1, z1 are abstract interface classes defined in cryptlib.h //! <li>x1, y1, z1 are abstract interface classes defined in cryptlib.h
//! <li>x2, y2, z2 are implementations of the interfaces using "abstract policies", which //! <li>x2, y2, z2 are implementations of the interfaces using "abstract policies", which
//! are pure virtual functions that should return interfaces to interchangeable algorithms. //! are pure virtual functions that should return interfaces to interchangeable algorithms.
//! These classes have \p Base suffixes. //! These classes have Base suffixes.
//! <li>x3, y3, z3 hold actual algorithms and implement those virtual functions. //! <li>x3, y3, z3 hold actual algorithms and implement those virtual functions.
//! These classes have \p Impl suffixes. //! These classes have Impl suffixes.
//! </ul> //! </ul>
//! //!
//! \details The \p TF_ prefix means an implementation using trapdoor functions on integers. //! \details The TF_ prefix means an implementation using trapdoor functions on integers.
//! \details The \p DL_ prefix means an implementation using group operations in groups where discrete log is hard. //! \details The DL_ prefix means an implementation using group operations in groups where discrete log is hard.
#ifndef CRYPTOPP_PUBKEY_H #ifndef CRYPTOPP_PUBKEY_H
#define CRYPTOPP_PUBKEY_H #define CRYPTOPP_PUBKEY_H
@ -66,7 +66,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! but difficult to compute in the opposite direction without special knowledge. //! but difficult to compute in the opposite direction without special knowledge.
//! The special knowledge is usually the private key. //! The special knowledge is usually the private key.
//! \details Trapdoor functions only handle messages of a limited length or size. //! \details Trapdoor functions only handle messages of a limited length or size.
//! \p MaxPreimage is the plaintext's maximum length, and \p MaxImage is the //! MaxPreimage is the plaintext's maximum length, and MaxImage is the
//! ciphertext's maximum length. //! ciphertext's maximum length.
//! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(), //! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(),
//! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse() //! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse()
@ -77,11 +77,11 @@ public:
//! \brief Returns the maximum size of a message before the trapdoor function is applied //! \brief Returns the maximum size of a message before the trapdoor function is applied
//! \returns the maximum size of a message before the trapdoor function is applied //! \returns the maximum size of a message before the trapdoor function is applied
//! \details Derived classes must implement \p PreimageBound(). //! \details Derived classes must implement PreimageBound().
virtual Integer PreimageBound() const =0; virtual Integer PreimageBound() const =0;
//! \brief Returns the maximum size of a message after the trapdoor function is applied //! \brief Returns the maximum size of a message after the trapdoor function is applied
//! \returns the maximum size of a message after the trapdoor function is applied //! \returns the maximum size of a message after the trapdoor function is applied
//! \details Derived classes must implement \p ImageBound(). //! \details Derived classes must implement ImageBound().
virtual Integer ImageBound() const =0; virtual Integer ImageBound() const =0;
//! \brief Returns the maximum size of a message before the trapdoor function is applied bound to a public key //! \brief Returns the maximum size of a message before the trapdoor function is applied bound to a public key
//! \returns the maximum size of a message before the trapdoor function is applied bound to a public key //! \returns the maximum size of a message before the trapdoor function is applied bound to a public key
@ -95,7 +95,7 @@ public:
//! \class RandomizedTrapdoorFunction //! \class RandomizedTrapdoorFunction
//! \brief Applies the trapdoor function, using random data if required //! \brief Applies the trapdoor function, using random data if required
//! \details \p ApplyFunction() is the foundation for encrypting a message under a public key. //! \details ApplyFunction() is the foundation for encrypting a message under a public key.
//! Derived classes will override it at some point. //! Derived classes will override it at some point.
//! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(), //! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(),
//! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse() //! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse()
@ -105,23 +105,23 @@ public:
virtual ~RandomizedTrapdoorFunction() {} virtual ~RandomizedTrapdoorFunction() {}
//! \brief Applies the trapdoor function, using random data if required //! \brief Applies the trapdoor function, using random data if required
//! \param rng a \p RandomNumberGenerator derived class //! \param rng a RandomNumberGenerator derived class
//! \param x the message on which the encryption function is applied //! \param x the message on which the encryption function is applied
//! \returns the message \p x encrypted under the public key //! \returns the message x encrypted under the public key
//! \details \p ApplyRandomizedFunction is a generalization of encryption under a public key //! \details ApplyRandomizedFunction is a generalization of encryption under a public key
//! cryptosystem. The \p RandomNumberGenerator may (or may not) be required. //! cryptosystem. The RandomNumberGenerator may (or may not) be required.
//! Derived classes must implement it. //! Derived classes must implement it.
virtual Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const =0; virtual Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const =0;
//! \brief Determines if the encryption algorithm is randomized //! \brief Determines if the encryption algorithm is randomized
//! \returns \p true if the encryption algorithm is randomized, \p false otherwise //! \returns true if the encryption algorithm is randomized, false otherwise
//! \details If \p IsRandomized() returns \p false, then \p NullRNG() can be used. //! \details If IsRandomized() returns false, then NullRNG() can be used.
virtual bool IsRandomized() const {return true;} virtual bool IsRandomized() const {return true;}
}; };
//! \class TrapdoorFunction //! \class TrapdoorFunction
//! \brief Applies the trapdoor function //! \brief Applies the trapdoor function
//! \details \p ApplyFunction() is the foundation for encrypting a message under a public key. //! \details ApplyFunction() is the foundation for encrypting a message under a public key.
//! Derived classes will override it at some point. //! Derived classes will override it at some point.
//! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(), //! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(),
//! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse() //! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse()
@ -131,27 +131,27 @@ public:
virtual ~TrapdoorFunction() {} virtual ~TrapdoorFunction() {}
//! \brief Applies the trapdoor function //! \brief Applies the trapdoor function
//! \param rng a \p RandomNumberGenerator derived class //! \param rng a RandomNumberGenerator derived class
//! \param x the message on which the encryption function is applied //! \param x the message on which the encryption function is applied
//! \details \p ApplyRandomizedFunction is a generalization of encryption under a public key //! \details ApplyRandomizedFunction is a generalization of encryption under a public key
//! cryptosystem. The \p RandomNumberGenerator may (or may not) be required. //! cryptosystem. The RandomNumberGenerator may (or may not) be required.
//! \details Internally, \p ApplyRandomizedFunction() calls \p ApplyFunction() \a //! \details Internally, ApplyRandomizedFunction() calls ApplyFunction() \a
//! without the \p RandomNumberGenerator. //! without the RandomNumberGenerator.
Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const
{CRYPTOPP_UNUSED(rng); return ApplyFunction(x);} {CRYPTOPP_UNUSED(rng); return ApplyFunction(x);}
bool IsRandomized() const {return false;} bool IsRandomized() const {return false;}
//! \brief Applies the trapdoor //! \brief Applies the trapdoor
//! \param x the message on which the encryption function is applied //! \param x the message on which the encryption function is applied
//! \returns the message \p x encrypted under the public key //! \returns the message x encrypted under the public key
//! \details \p ApplyFunction is a generalization of encryption under a public key //! \details ApplyFunction is a generalization of encryption under a public key
//! cryptosystem. Derived classes must implement it. //! cryptosystem. Derived classes must implement it.
virtual Integer ApplyFunction(const Integer &x) const =0; virtual Integer ApplyFunction(const Integer &x) const =0;
}; };
//! \class RandomizedTrapdoorFunctionInverse //! \class RandomizedTrapdoorFunctionInverse
//! \brief Applies the inverse of the trapdoor function, using random data if required //! \brief Applies the inverse of the trapdoor function, using random data if required
//! \details \p CalculateInverse() is the foundation for decrypting a message under a private key //! \details CalculateInverse() is the foundation for decrypting a message under a private key
//! in a public key cryptosystem. Derived classes will override it at some point. //! in a public key cryptosystem. Derived classes will override it at some point.
//! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(), //! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(),
//! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse() //! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse()
@ -161,22 +161,22 @@ public:
virtual ~RandomizedTrapdoorFunctionInverse() {} virtual ~RandomizedTrapdoorFunctionInverse() {}
//! \brief Applies the inverse of the trapdoor function, using random data if required //! \brief Applies the inverse of the trapdoor function, using random data if required
//! \param rng a \p RandomNumberGenerator derived class //! \param rng a RandomNumberGenerator derived class
//! \param x the message on which the decryption function is applied //! \param x the message on which the decryption function is applied
//! \returns the message \p x decrypted under the private key //! \returns the message x decrypted under the private key
//! \details \p CalculateRandomizedInverse is a generalization of decryption using the private key //! \details CalculateRandomizedInverse is a generalization of decryption using the private key
//! The \p RandomNumberGenerator may (or may not) be required. Derived classes must implement it. //! The RandomNumberGenerator may (or may not) be required. Derived classes must implement it.
virtual Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const =0; virtual Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const =0;
//! \brief Determines if the decryption algorithm is randomized //! \brief Determines if the decryption algorithm is randomized
//! \returns \p true if the decryption algorithm is randomized, \p false otherwise //! \returns true if the decryption algorithm is randomized, false otherwise
//! \details If \p IsRandomized() returns \p false, then \p NullRNG() can be used. //! \details If IsRandomized() returns false, then NullRNG() can be used.
virtual bool IsRandomized() const {return true;} virtual bool IsRandomized() const {return true;}
}; };
//! \class TrapdoorFunctionInverse //! \class TrapdoorFunctionInverse
//! \brief Applies the inverse of the trapdoor function //! \brief Applies the inverse of the trapdoor function
//! \details \p CalculateInverse() is the foundation for decrypting a message under a private key //! \details CalculateInverse() is the foundation for decrypting a message under a private key
//! in a public key cryptosystem. Derived classes will override it at some point. //! in a public key cryptosystem. Derived classes will override it at some point.
//! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(), //! \sa TrapdoorFunctionBounds(), RandomizedTrapdoorFunction(), TrapdoorFunction(),
//! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse() //! RandomizedTrapdoorFunctionInverse() and TrapdoorFunctionInverse()
@ -186,22 +186,22 @@ public:
virtual ~TrapdoorFunctionInverse() {} virtual ~TrapdoorFunctionInverse() {}
//! \brief Applies the inverse of the trapdoor function //! \brief Applies the inverse of the trapdoor function
//! \param rng a \p RandomNumberGenerator derived class //! \param rng a RandomNumberGenerator derived class
//! \param x the message on which the decryption function is applied //! \param x the message on which the decryption function is applied
//! \returns the message \p x decrypted under the private key //! \returns the message x decrypted under the private key
//! \details \p CalculateRandomizedInverse is a generalization of decryption using the private key //! \details CalculateRandomizedInverse is a generalization of decryption using the private key
//! \details Internally, \p CalculateRandomizedInverse() calls \p CalculateInverse() \a //! \details Internally, CalculateRandomizedInverse() calls CalculateInverse() \a
//! without the \p RandomNumberGenerator. //! without the RandomNumberGenerator.
Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const
{return CalculateInverse(rng, x);} {return CalculateInverse(rng, x);}
//! \brief Determines if the decryption algorithm is randomized //! \brief Determines if the decryption algorithm is randomized
//! \returns \p true if the decryption algorithm is randomized, \p false otherwise //! \returns true if the decryption algorithm is randomized, false otherwise
//! \details If \p IsRandomized() returns \p false, then \p NullRNG() can be used. //! \details If IsRandomized() returns false, then NullRNG() can be used.
bool IsRandomized() const {return false;} bool IsRandomized() const {return false;}
//! \brief Calculates the inverse of an element //! \brief Calculates the inverse of an element
//! \param rng a \p RandomNumberGenerator derived class //! \param rng a RandomNumberGenerator derived class
//! \param x the element //! \param x the element
//! \returns the inverse of the element in the group //! \returns the inverse of the element in the group
virtual Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const =0; virtual Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const =0;
@ -315,7 +315,7 @@ typedef std::pair<const byte *, unsigned int> HashIdentifier;
//! \class PK_SignatureMessageEncodingMethod //! \class PK_SignatureMessageEncodingMethod
//! \brief Interface for message encoding method for public key signature schemes. //! \brief Interface for message encoding method for public key signature schemes.
//! \details \p PK_SignatureMessageEncodingMethod provides interfaces for message //! \details PK_SignatureMessageEncodingMethod provides interfaces for message
//! encoding method for public key signature schemes. The methods support both //! encoding method for public key signature schemes. The methods support both
//! trapdoor functions (<tt>TF_*</tt>) and discrete logarithm (<tt>DL_*</tt>) //! trapdoor functions (<tt>TF_*</tt>) and discrete logarithm (<tt>DL_*</tt>)
//! based schemes. //! based schemes.
@ -399,7 +399,7 @@ public:
//! \class PK_DeterministicSignatureMessageEncodingMethod //! \class PK_DeterministicSignatureMessageEncodingMethod
//! \brief Interface for message encoding method for public key signature schemes. //! \brief Interface for message encoding method for public key signature schemes.
//! \details \p PK_DeterministicSignatureMessageEncodingMethod provides interfaces //! \details PK_DeterministicSignatureMessageEncodingMethod provides interfaces
//! for message encoding method for public key signature schemes. //! for message encoding method for public key signature schemes.
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_DeterministicSignatureMessageEncodingMethod : public PK_SignatureMessageEncodingMethod class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_DeterministicSignatureMessageEncodingMethod : public PK_SignatureMessageEncodingMethod
{ {
@ -411,7 +411,7 @@ public:
//! \class PK_RecoverableSignatureMessageEncodingMethod //! \class PK_RecoverableSignatureMessageEncodingMethod
//! \brief Interface for message encoding method for public key signature schemes. //! \brief Interface for message encoding method for public key signature schemes.
//! \details \p PK_RecoverableSignatureMessageEncodingMethod provides interfaces //! \details PK_RecoverableSignatureMessageEncodingMethod provides interfaces
//! for message encoding method for public key signature schemes. //! for message encoding method for public key signature schemes.
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_RecoverableSignatureMessageEncodingMethod : public PK_SignatureMessageEncodingMethod class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_RecoverableSignatureMessageEncodingMethod : public PK_SignatureMessageEncodingMethod
{ {
@ -423,7 +423,7 @@ public:
//! \class DL_SignatureMessageEncodingMethod_DSA //! \class DL_SignatureMessageEncodingMethod_DSA
//! \brief Interface for message encoding method for public key signature schemes. //! \brief Interface for message encoding method for public key signature schemes.
//! \details \p DL_SignatureMessageEncodingMethod_DSA provides interfaces //! \details DL_SignatureMessageEncodingMethod_DSA provides interfaces
//! for message encoding method for DSA. //! for message encoding method for DSA.
class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_DSA : public PK_DeterministicSignatureMessageEncodingMethod class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_DSA : public PK_DeterministicSignatureMessageEncodingMethod
{ {
@ -436,7 +436,7 @@ public:
//! \class DL_SignatureMessageEncodingMethod_NR //! \class DL_SignatureMessageEncodingMethod_NR
//! \brief Interface for message encoding method for public key signature schemes. //! \brief Interface for message encoding method for public key signature schemes.
//! \details \p DL_SignatureMessageEncodingMethod_NR provides interfaces //! \details DL_SignatureMessageEncodingMethod_NR provides interfaces
//! for message encoding method for Nyberg-Rueppel. //! for message encoding method for Nyberg-Rueppel.
class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_NR : public PK_DeterministicSignatureMessageEncodingMethod class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_NR : public PK_DeterministicSignatureMessageEncodingMethod
{ {
@ -449,7 +449,7 @@ public:
//! \class DL_SignatureMessageEncodingMethod_SM2 //! \class DL_SignatureMessageEncodingMethod_SM2
//! \brief Interface for message encoding method for public key signature schemes. //! \brief Interface for message encoding method for public key signature schemes.
//! \details \p DL_SignatureMessageEncodingMethod_SM2 provides interfaces //! \details DL_SignatureMessageEncodingMethod_SM2 provides interfaces
//! for message encoding method for SM2. //! for message encoding method for SM2.
class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_SM2 : public PK_DeterministicSignatureMessageEncodingMethod class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_SM2 : public PK_DeterministicSignatureMessageEncodingMethod
{ {
@ -462,7 +462,7 @@ public:
//! \class PK_MessageAccumulatorBase //! \class PK_MessageAccumulatorBase
//! \brief Interface for message encoding method for public key signature schemes. //! \brief Interface for message encoding method for public key signature schemes.
//! \details \p PK_MessageAccumulatorBase provides interfaces //! \details PK_MessageAccumulatorBase provides interfaces
//! for message encoding method. //! for message encoding method.
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_MessageAccumulatorBase : public PK_MessageAccumulator class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_MessageAccumulatorBase : public PK_MessageAccumulator
{ {
@ -484,7 +484,7 @@ public:
//! \class PK_MessageAccumulatorImpl //! \class PK_MessageAccumulatorImpl
//! \brief Interface for message encoding method for public key signature schemes. //! \brief Interface for message encoding method for public key signature schemes.
//! \details \p PK_MessageAccumulatorBase provides interfaces //! \details PK_MessageAccumulatorBase provides interfaces
//! for message encoding method. //! for message encoding method.
template <class HASH_ALGORITHM> template <class HASH_ALGORITHM>
class PK_MessageAccumulatorImpl : public PK_MessageAccumulatorBase, protected ObjectHolder<HASH_ALGORITHM> class PK_MessageAccumulatorImpl : public PK_MessageAccumulatorBase, protected ObjectHolder<HASH_ALGORITHM>