47 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
50 const Integer& GetModulus()
const {
return m_n;}
51 void SetModulus(
const Integer &n) {m_n = n;}
96 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
101 const Integer& GetPrime1()
const {
return m_p;}
102 const Integer& GetPrime2()
const {
return m_q;}
103 const Integer& GetMultiplicativeInverseOfPrime2ModPrime1()
const {
return m_u;}
105 void SetPrime1(
const Integer &p) {m_p = p;}
106 void SetPrime2(
const Integer &q) {m_q = q;}
107 void SetMultiplicativeInverseOfPrime2ModPrime1(
const Integer &u) {m_u = u;}
110 virtual void Precompute(
unsigned int unused = 0) {CRYPTOPP_UNUSED(unused); PrecomputeTweakedRoots();}
111 virtual void Precompute(
unsigned int unused = 0)
const {CRYPTOPP_UNUSED(unused); PrecomputeTweakedRoots();}
117 void PrecomputeTweakedRoots()
const;
122 mutable Integer m_pre_2_9p, m_pre_2_3q, m_pre_q_p;
123 mutable bool m_precompute;
130 CRYPTOPP_STATIC_CONSTEXPR
const char* StaticAlgorithmName() {
return "RW";}
139template <
class STANDARD,
class H>
virtual void Precompute(unsigned int precomputationStorage)
Perform precomputation.
void GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize)
Generate a random key or crypto parameters.
Multiple precision integer with arithmetic operations.
Rabin-Williams trapdoor function using the private key.
virtual void LoadPrecomputation(BufferedTransformation &storedPrecomputation)
Retrieve previously saved precomputation.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
void Save(BufferedTransformation &bt) const
Saves a key to a BufferedTransformation.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
void Load(BufferedTransformation &bt)
Loads a key from a BufferedTransformation.
void Initialize(const Integer &n, const Integer &p, const Integer &q, const Integer &u)
Initialize a Rabin-Williams private key.
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits)
Create a Rabin-Williams private key.
virtual bool SupportsPrecomputation() const
Determines whether the object supports precomputation.
virtual void SavePrecomputation(BufferedTransformation &storedPrecomputation) const
Save precomputation for later use.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
InvertibleRWFunction()
Construct an InvertibleRWFunction.
virtual void Precompute(unsigned int unused=0)
Perform precomputation.
Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const
Calculates the inverse of an element.
Interface for retrieving values given their names.
Interface for private keys.
Interface for public keys.
Rabin-Williams trapdoor function using the public key.
Integer PreimageBound() const
Returns the maximum size of a message before the trapdoor function is applied.
Integer ApplyFunction(const Integer &x) const
Applies the trapdoor.
Integer ImageBound() const
Returns the maximum size of a representation after the trapdoor function is applied.
void Save(BufferedTransformation &bt) const
Saves a key to a BufferedTransformation.
void Initialize(const Integer &n)
Initialize a Rabin-Williams public key.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void Load(BufferedTransformation &bt)
Loads a key from a BufferedTransformation.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
Interface for random number generators.
Trapdoor Function (TF) Signature Scheme.
Applies the trapdoor function.
Applies the inverse of the trapdoor function.
Abstract base classes that provide a uniform interface to this library.
Multiple precision integer with arithmetic operations.
Crypto++ library namespace.
This file contains helper classes/functions for implementing public key algorithms.
Rabin-Williams signature scheme.