Botan: Botan::RW_Signature_Operation Class Reference

Botan 1.10.16

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

`#include <rw.h>`

Inheritance diagram for Botan::RW_Signature_Operation:

## Public Member Functions
size_t | max_input_bits () const
virtual size_t | message_part_size () const
virtual size_t | message_parts () const
| RW_Signature_Operation (const RW_PrivateKey &rw)
SecureVector< byte > | sign (const byte msg[], size_t msg_len, RandomNumberGenerator &rng)

## Detailed Description

Rabin-Williams Signature Operation

Definition at line 65 of file rw.h.

## Constructor & Destructor Documentation

## ◆ RW_Signature_Operation()

Botan::RW_Signature_Operation::RW_Signature_Operation | ( | const RW_PrivateKey & | rw | ) |

Definition at line 62 of file rw.cpp.

62 :
63 n(rw.get_n()),
64 e(rw.get_e()),
65 q(rw.get_q()),
66 c(rw.get_c()),
67 powermod_d1_p(rw.get_d1(), rw.get_p()),
68 powermod_d2_q(rw.get_d2(), rw.get_q()),
69 mod_p(rw.get_p())
70 {
71 }

## Member Function Documentation

## ◆ max_input_bits()

size_t Botan::RW_Signature_Operation::max_input_bits | ( |  | ) | const
| inlinevirtual

Get the maximum message size in bits supported by this public key.

Returns
  maximum message in bits

Implements Botan::PK_Ops::Signature.

Definition at line 70 of file rw.h.

70 { return (n.bits() - 1); }
Botan::BigInt::bits
size_t bits() const
Definition: bigint.cpp:253

## ◆ message_part_size()

virtual size_t Botan::PK_Ops::Signature::message_part_size | ( |  | ) | const
| inlinevirtualinherited

Find out the message part size supported by this scheme/key.

Returns
  size of the message parts

Reimplemented in Botan::ECDSA_Signature_Operation, Botan::DSA_Signature_Operation, and Botan::NR_Signature_Operation.

Definition at line 62 of file pk_ops.h.

62 { return 0; }

## ◆ message_parts()

virtual size_t Botan::PK_Ops::Signature::message_parts | ( |  | ) | const
| inlinevirtualinherited

Find out the number of message parts supported by this scheme.

Returns
  number of message parts

Reimplemented in Botan::ECDSA_Signature_Operation, Botan::DSA_Signature_Operation, and Botan::NR_Signature_Operation.

Definition at line 56 of file pk_ops.h.

56 { return 1; }

## ◆ sign()

SecureVector< byte > Botan::RW_Signature_Operation::sign | ( | const byte | msg[],
|  | size_t | msg_len,
|  | RandomNumberGenerator & | rng
| ) |  |
| virtual

Implements Botan::PK_Ops::Signature.

Definition at line 74 of file rw.cpp.

76 {
77 if(!blinder.initialized())
78 {
79 BigInt k(rng, n.bits() / 2);
80 blinder = Blinder(power_mod(k, e, n), inverse_mod(k, n), n);
81 }
82
83 BigInt i(msg, msg_len);
84
85 if(i >= n || i % 16 != 12)
86 throw Invalid_Argument("Rabin-Williams: invalid input");
87
88 if(jacobi(i, n) != 1)
89 i >>= 1;
90
91 i = blinder.blind(i);
92
93 BigInt j1 = powermod_d1_p(i);
94 BigInt j2 = powermod_d2_q(i);
95 j1 = mod_p.reduce(sub_mul(j1, j2, c));
96
97 BigInt r = blinder.unblind(mul_add(j1, q, j2));
98
99 r = std::min(r, n - r);
100
101 return BigInt::encode_1363(r, n.bytes());
102 }
Botan::BigInt::bits
size_t bits() const
Definition: bigint.cpp:253
Botan::Invalid_Argument
std::invalid_argument Invalid_Argument
Definition: exceptn.h:20
Botan::Blinder::initialized
bool initialized() const
Definition: blinding.h:25
Botan::jacobi
s32bit jacobi(const BigInt &a, const BigInt &n)
Definition: jacobi.cpp:15
Botan::BigInt::bytes
size_t bytes() const
Definition: bigint.cpp:245
Botan::inverse_mod
BigInt inverse_mod(const BigInt &n, const BigInt &mod)
Definition: numthry.cpp:314
Botan::sub_mul
BigInt sub_mul(const BigInt &a, const BigInt &b, const BigInt &c)
Definition: mp_numth.cpp:60
Botan::Modular_Reducer::reduce
BigInt reduce(const BigInt &x) const
Definition: reducer.cpp:32
Botan::power_mod
BigInt power_mod(const BigInt &base, const BigInt &exp, const BigInt &mod)
Definition: numthry.cpp:366
Botan::CT::min
T min(T a, T b)
Definition: ct_utils.h:127
Botan::BigInt::encode_1363
static SecureVector< byte > encode_1363(const BigInt &n, size_t bytes)
Definition: big_code.cpp:78
Botan::mul_add
BigInt mul_add(const BigInt &a, const BigInt &b, const BigInt &c)
Definition: mp_numth.cpp:33

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

- src/pubkey/rw/rw.h
- src/pubkey/rw/rw.cpp