Botan 1.10.17

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

`#include <dsa.h>`

Inheritance diagram for Botan::DSA_Verification_Operation:

## Public Member Functions
| DSA_Verification_Operation (const DSA_PublicKey &dsa)
size_t | max_input_bits () const
size_t | message_part_size () const
size_t | message_parts () const
bool | verify (const byte msg[], size_t msg_len, const byte sig[], size_t sig_len)
virtual SecureVector< byte > | verify_mr (const byte[], size_t)
bool | with_recovery () const

## Detailed Description

Object that can verify a DSA signature

Definition at line 84 of file dsa.h.

## Constructor & Destructor Documentation

## ◆ DSA_Verification_Operation()

Botan::DSA_Verification_Operation::DSA_Verification_Operation | ( | const DSA_PublicKey & | dsa | ) |

Definition at line 102 of file dsa.cpp.

References Botan::DL_Scheme_PublicKey::group_g(), Botan::DL_Scheme_PublicKey::group_p(), and Botan::DL_Scheme_PublicKey::group_q().

102 :
103 q(dsa.group_q()), y(dsa.get_y())
104 {
105 powermod_g_p = Fixed_Base_Power_Mod(dsa.group_g(), dsa.group_p());
106 powermod_y_p = Fixed_Base_Power_Mod(y, dsa.group_p());
107 mod_p = Modular_Reducer(dsa.group_p());
108 mod_q = Modular_Reducer(dsa.group_q());
109 }

## Member Function Documentation

## ◆ max_input_bits()

size_t Botan::DSA_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 91 of file dsa.h.

91 { return q.bits(); }
Botan::BigInt::bits
size_t bits() const
Definition: bigint.cpp:254

## ◆ message_part_size()

size_t Botan::DSA_Verification_Operation::message_part_size | ( |  | ) | const
| inline virtual

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

Returns
  size of the message parts

Reimplemented from Botan::PK_Ops::Verification.

Definition at line 90 of file dsa.h.

90 { return q.bytes(); }
Botan::BigInt::bytes
size_t bytes() const
Definition: bigint.cpp:246

## ◆ message_parts()

size_t Botan::DSA_Verification_Operation::message_parts | ( |  | ) | const
| inline virtual

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

Returns
  number of message parts

Reimplemented from Botan::PK_Ops::Verification.

Definition at line 89 of file dsa.h.

89 { return 2; }

## ◆ verify()

bool Botan::DSA_Verification_Operation::verify | ( | const byte | msg[],
|  | size_t | msg_len,
|  | const byte | sig[],
|  | size_t | sig_len
| ) |  |
| virtual

Reimplemented from Botan::PK_Ops::Verification.

Definition at line 111 of file dsa.cpp.

References Botan::BigInt::bytes(), and Botan::Modular_Reducer::get_modulus().

113 {
114 const BigInt& q = mod_q.get_modulus();
115
116 if(sig_len != 2*q.bytes() || msg_len > q.bytes())
117 return false;
118
119 BigInt r(sig, q.bytes());
120 BigInt s(sig + q.bytes(), q.bytes());
121 BigInt i(msg, msg_len);
122
123 if(r <= 0 || r >= q || s <= 0 || s >= q)
124 return false;
125
126 s = inverse_mod(s, q);
127 s = mod_p.multiply(powermod_g_p(mod_q.multiply(s, i)),
128 powermod_y_p(mod_q.multiply(s, r)));
129
130 return (mod_q.reduce(s) == r);
131 }
Botan::Modular_Reducer::get_modulus
const BigInt & get_modulus() const
Definition: reducer.h:21
Botan::inverse_mod
BigInt inverse_mod(const BigInt &n, const BigInt &mod)
Definition: numthry.cpp:314
Botan::Modular_Reducer::reduce
BigInt reduce(const BigInt &x) const
Definition: reducer.cpp:32
Botan::Modular_Reducer::multiply
BigInt multiply(const BigInt &x, const BigInt &y) const
Definition: reducer.h:31

## ◆ verify_mr()

virtual SecureVector<byte> Botan::PK_Ops::Verification::verify_mr | ( | const byte | [],
|  | size_t |
| ) |  |
| inline virtual inherited

Reimplemented in Botan::RSA_Public_Operation, Botan::RW_Verification_Operation, and Botan::NR_Verification_Operation.

Definition at line 133 of file pk_ops.h.

135 {
136 throw Invalid_State("Message recovery not supported");
137 }

## ◆ with_recovery()

bool Botan::DSA_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 93 of file dsa.h.

93 { return false; }

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

- src/pubkey/dsa/dsa.h
- src/pubkey/dsa/dsa.cpp