Botan  1.10.9
Public Member Functions | List of all members
Botan::Blinder Class Reference

#include <blinding.h>

Public Member Functions

BigInt blind (const BigInt &x) const
 
 Blinder ()
 
 Blinder (const BigInt &mask, const BigInt &inverse_mask, const BigInt &modulus)
 
bool initialized () const
 
BigInt unblind (const BigInt &x) const
 

Detailed Description

Blinding Function Object

Definition at line 19 of file blinding.h.

Constructor & Destructor Documentation

Botan::Blinder::Blinder ( )
inline

Definition at line 27 of file blinding.h.

27 {}
Botan::Blinder::Blinder ( const BigInt mask,
const BigInt inverse_mask,
const BigInt modulus 
)

Construct a blinder

Parameters
maskthe forward (blinding) mask
inverse_maskthe inverse of mask (depends on algo)
modulusof the group operations are performed in

Definition at line 16 of file blinding.cpp.

17  {
18  if(e < 1 || d < 1 || n < 1)
19  throw Invalid_Argument("Blinder: Arguments too small");
20 
21  reducer = Modular_Reducer(n);
22  this->e = e;
23  this->d = d;
24  }
BigInt n
Definition: numthry.cpp:26
std::invalid_argument Invalid_Argument
Definition: exceptn.h:20

Member Function Documentation

BigInt Botan::Blinder::blind ( const BigInt x) const

Definition at line 29 of file blinding.cpp.

References Botan::Modular_Reducer::initialized(), Botan::Modular_Reducer::multiply(), and Botan::Modular_Reducer::square().

Referenced by Botan::DH_KA_Operation::agree(), Botan::ElGamal_Decryption_Operation::decrypt(), Botan::RSA_Private_Operation::decrypt(), Botan::RW_Signature_Operation::sign(), and Botan::RSA_Private_Operation::sign().

30  {
31  if(!reducer.initialized())
32  return i;
33 
34  e = reducer.square(e);
35  d = reducer.square(d);
36  return reducer.multiply(i, e);
37  }
bool initialized() const
Definition: reducer.h:50
BigInt multiply(const BigInt &x, const BigInt &y) const
Definition: reducer.h:31
BigInt square(const BigInt &x) const
Definition: reducer.h:39
bool Botan::Blinder::initialized ( ) const
inline

Definition at line 25 of file blinding.h.

References reducer.

Referenced by Botan::RW_Signature_Operation::sign().

25 { return reducer.initialized(); }
bool initialized() const
Definition: reducer.h:50
BigInt Botan::Blinder::unblind ( const BigInt x) const

Definition at line 42 of file blinding.cpp.

References Botan::Modular_Reducer::initialized(), and Botan::Modular_Reducer::multiply().

Referenced by Botan::DH_KA_Operation::agree(), Botan::ElGamal_Decryption_Operation::decrypt(), Botan::RSA_Private_Operation::decrypt(), Botan::RW_Signature_Operation::sign(), and Botan::RSA_Private_Operation::sign().

43  {
44  if(!reducer.initialized())
45  return i;
46  return reducer.multiply(i, d);
47  }
bool initialized() const
Definition: reducer.h:50
BigInt multiply(const BigInt &x, const BigInt &y) const
Definition: reducer.h:31

The documentation for this class was generated from the following files: