Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Botan::SRP6_Server_Session Class Referencefinal

`#include <srp6.h>`

## Public Member Functions
BigInt | step1 (const BigInt &v, const std::string &group_id, const std::string &hash_id, RandomNumberGenerator &rng)
BigInt | step1 (const BigInt &v, const DL_Group &group, const std::string &hash_id, const size_t b_bits, RandomNumberGenerator &rng)
SymmetricKey | step2 (const BigInt &A)

## Detailed Description

Represents a SRP-6a server session

Definition at line 107 of file srp6.h.

## Member Function Documentation

BigInt Botan::SRP6_Server_Session::step1 | ( | const BigInt & | v,
|  | const std::string & | group_id,
|  | const std::string & | hash_id,
|  | RandomNumberGenerator & | rng
| ) |  |

Server side step 1

Parameters

  v | the verification value saved from client registration
  group_id | the SRP group id
  hash_id | the SRP hash in use
  rng | a random number generator

Returns
  SRP-6 B value

Definition at line 148 of file srp6.cpp.

References Botan::DL_Group::exponent_bits().

152 {
153 DL_Group group(group_id);
154 const size_t b_bits = group.exponent_bits();
155
156 return this->step1(v, group, hash_id, b_bits, rng);
157 }
Botan::SRP6_Server_Session::step1
BigInt step1(const BigInt &v, const std::string &group_id, const std::string &hash_id, RandomNumberGenerator &rng)
Definition: srp6.cpp:148

BigInt Botan::SRP6_Server_Session::step1 | ( | const BigInt & | v,
|  | const DL_Group & | group,
|  | const std::string & | hash_id,
|  | const size_t | b_bits,
|  | RandomNumberGenerator & | rng
| ) |  |

Server side step 1 This version of step1 added in 2.11

Parameters

  v | the verification value saved from client registration
  group | the SRP group
  hash_id | the SRP hash in use
  rng | a random number generator
  b_bits | size of secret exponent in bits

Returns
  SRP-6 B value

Definition at line 159 of file srp6.cpp.

References Botan::BigInt::bytes(), Botan::DL_Group::get_g(), Botan::DL_Group::get_p(), Botan::DL_Group::mod_p(), and Botan::DL_Group::power_g_p().

164 {
165 const BigInt& g = group.get_g();
166 const BigInt& p = group.get_p();
167
168 m_p_bytes = p.bytes();
169 m_v = v;
170 m_b = BigInt(rng, b_bits);
171 m_p = p;
172 m_hash_id = hash_id;
173
174 const BigInt k = hash_seq(hash_id, m_p_bytes, p, g);
175
176 m_B = group.mod_p(v*k + group.power_g_p(m_b, b_bits));
177
178 return m_B;
179 }

SymmetricKey Botan::SRP6_Server_Session::step2 | ( | const BigInt & | A | ) |

Server side step 2

Parameters

  A | the client's value

Returns
  shared symmetric key

Definition at line 181 of file srp6.cpp.

References Botan::BigInt::encode_1363(), and Botan::power_mod().

Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange().

182 {
183 if(A <= 0 || A >= m_p)
184 throw Decoding_Error("Invalid SRP parameter from client");
185
186 const BigInt u = hash_seq(m_hash_id, m_p_bytes, A, m_B);
187
188 const BigInt S = power_mod(A * power_mod(m_v, u, m_p), m_b, m_p);
189
190 return BigInt::encode_1363(S, m_p_bytes);
191 }
Botan::power_mod
BigInt power_mod(const BigInt &base, const BigInt &exp, const BigInt &mod)
Definition: numthry.cpp:451
Botan::BigInt::encode_1363
static secure_vector< uint8_t > encode_1363(const BigInt &n, size_t bytes)
Definition: big_code.cpp:111

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

- src/lib/misc/srp6/srp6.h
- src/lib/misc/srp6/srp6.cpp