Botan: Botan::SRP6_Server_Session Class Reference

Botan 1.10.16

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

`#include <srp6.h>`

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

## Detailed Description

Represents a SRP-6a server session

Definition at line 61 of file srp6.h.

## Member Function Documentation

## ◆ step1()

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

Definition at line 142 of file srp6.cpp.

146 {
147 DL_Group group(group_id);
148 const BigInt& g = group.get_g();
149 const BigInt& p = group.get_p();
150
151 p_bytes = p.bytes();
152
153 BigInt k = hash_seq(hash_id, p_bytes, p, g);
154
155 BigInt b(rng, 256);
156
157 B = (v*k + power_mod(g, b, p)) % p;
158
159 this->v = v;
160 this->b = b;
161 this->p = p;
162 this->hash_id = hash_id;
163
164 return B;
165 }
Botan::power_mod
BigInt power_mod(const BigInt &base, const BigInt &exp, const BigInt &mod)
Definition: numthry.cpp:366

## ◆ step2()

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

Definition at line 167 of file srp6.cpp.

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

168 {
169 if(A <= 0 || A >= p)
170 throw std::runtime_error("Invalid SRP parameter from client");
171
172 BigInt u = hash_seq(hash_id, p_bytes, A, B);
173
174 BigInt S = power_mod(A * power_mod(v, u, p), b, p);
175
176 return BigInt::encode_1363(S, p_bytes);
177 }
Botan::power_mod
BigInt power_mod(const BigInt &base, const BigInt &exp, const BigInt &mod)
Definition: numthry.cpp:366
Botan::BigInt::encode_1363
static SecureVector< byte > encode_1363(const BigInt &n, size_t bytes)
Definition: big_code.cpp:78

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

- src/constructs/srp6/srp6.h
- src/constructs/srp6/srp6.cpp