Botan 1.10.17

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

`#include <rw.h>`

Inheritance diagram for Botan::RW_Verification_Operation:

## Public Member Functions
size_t | max_input_bits () const
virtual size_t | message_part_size () const
virtual size_t | message_parts () const
| RW_Verification_Operation (const RW_PublicKey &rw)
virtual bool | verify (const byte[], size_t, const byte[], size_t)
SecureVector< byte > | verify_mr (const byte msg[], size_t msg_len)
bool | with_recovery () const

## Detailed Description

Rabin-Williams Verification Operation

Definition at line 88 of file rw.h.

## Constructor & Destructor Documentation

## ◆ RW_Verification_Operation()

Botan::RW_Verification_Operation::RW_Verification_Operation | ( | const RW_PublicKey & | rw | ) |
| inline

Definition at line 91 of file rw.h.

91 :
92 n(rw.get_n()), powermod_e_n(rw.get_e(), rw.get_n())
93 {}

## Member Function Documentation

## ◆ max_input_bits()

size_t Botan::RW_Verification_Operation::max_input_bits | ( |  | ) | const
| inline virtual

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

Returns
  maximum message in bits

Implements Botan::PK_Ops::Verification.

Definition at line 95 of file rw.h.

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

## ◆ message_part_size()

virtual size_t Botan::PK_Ops::Verification::message_part_size | ( |  | ) | const
| inline virtual inherited

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

Returns
  size of the message parts

Reimplemented in Botan::ECDSA_Verification_Operation, Botan::DSA_Verification_Operation, and Botan::NR_Verification_Operation.

Definition at line 104 of file pk_ops.h.

Referenced by Botan::PK_Verifier::check_signature().

104 { return 0; }

## ◆ message_parts()

virtual size_t Botan::PK_Ops::Verification::message_parts | ( |  | ) | const
| inline virtual inherited

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

Returns
  number of message parts

Reimplemented in Botan::ECDSA_Verification_Operation, Botan::DSA_Verification_Operation, and Botan::NR_Verification_Operation.

Definition at line 98 of file pk_ops.h.

Referenced by Botan::PK_Verifier::check_signature(), and Botan::PK_Verifier::set_input_format().

98 { return 1; }

## ◆ verify()

virtual bool Botan::PK_Ops::Verification::verify | ( | const byte | [],
|  | size_t | ,
|  | const byte | [],
|  | size_t |
| ) |  |
| inline virtual inherited

Reimplemented in Botan::ECDSA_Verification_Operation, and Botan::DSA_Verification_Operation.

Definition at line 120 of file pk_ops.h.

122 {
123 throw Invalid_State("Message recovery required");
124 }

## ◆ verify_mr()

SecureVector< byte > Botan::RW_Verification_Operation::verify_mr | ( | const byte | msg[],
|  | size_t | msg_len
| ) |  |
| virtual

Reimplemented from Botan::PK_Ops::Verification.

Definition at line 105 of file rw.cpp.

References Botan::BigInt::is_negative().

106 {
107 BigInt m(msg, msg_len);
108
109 if((m > (n >> 1)) || m.is_negative())
110 throw Invalid_Argument("RW signature verification: m > n / 2 || m < 0");
111
112 BigInt r = powermod_e_n(m);
113 if(r % 16 == 12)
114 return BigInt::encode(r);
115 if(r % 8 == 6)
116 return BigInt::encode(2*r);
117
118 r = n - r;
119 if(r % 16 == 12)
120 return BigInt::encode(r);
121 if(r % 8 == 6)
122 return BigInt::encode(2*r);
123
124 throw Invalid_Argument("RW signature verification: Invalid signature");
125 }
Botan::Invalid_Argument
std::invalid_argument Invalid_Argument
Definition: exceptn.h:20
Botan::BigInt::encode
static SecureVector< byte > encode(const BigInt &n, Base base=Binary)
Definition: big_code.cpp:64

## ◆ with_recovery()

bool Botan::RW_Verification_Operation::with_recovery | ( |  | ) | const
| inline virtual

Returns
  boolean specifying if this key type supports message recovery and thus if you need to call verify() or verify_mr()

Implements Botan::PK_Ops::Verification.

Definition at line 96 of file rw.h.

96 { return true; }

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

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