Botan  1.11.15
Public Member Functions
Botan::SRP6_Server_Session Class Reference

#include <srp6.h>

List of all members.

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 66 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:
vthe verification value saved from client registration
group_idthe SRP group id
hash_idthe SRP hash in use
rnga random number generator
Returns:
SRP-6 B value

Definition at line 123 of file srp6.cpp.

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

   {
   DL_Group group(group_id);
   const BigInt& g = group.get_g();
   const BigInt& p = group.get_p();

   m_p_bytes = p.bytes();
   m_v = v;
   m_b = BigInt(rng, 256);
   m_p = p;
   m_hash_id = hash_id;

   const BigInt k = hash_seq(hash_id, m_p_bytes, p, g);

   m_B = (v*k + power_mod(g, m_b, p)) % p;

   return m_B;
   }

Server side step 2

Parameters:
Athe client's value
Returns:
shared symmetric key

Definition at line 145 of file srp6.cpp.

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

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

   {
   if(A <= 0 || A >= m_p)
      throw std::runtime_error("Invalid SRP parameter from client");

   const BigInt u = hash_seq(m_hash_id, m_p_bytes, A, m_B);

   const BigInt S = power_mod(A * power_mod(m_v, u, m_p), m_b, m_p);

   return BigInt::encode_1363(S, m_p_bytes);
   }

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