Botan 1.10.17
srp6.h
Go to the documentation of this file.
1/*
2* SRP-6a (RFC 5054 compatatible)
3* (C) 2011,2012 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_RFC5054_SRP6_H__
9#define BOTAN_RFC5054_SRP6_H__
10
11#include <botan/bigint.h>
12#include <botan/hash.h>
13#include <botan/rng.h>
14#include <botan/symkey.h>
15#include <string>
16
17namespace Botan {
18
19/**
20* SRP6a Client side
21* @param username the username we are attempting login for
22* @param password the password we are attempting to use
23* @param group_id specifies the shared SRP group
24* @param hash_id specifies a secure hash function
25* @param salt is the salt value sent by the server
26* @param B is the server's public value
27* @param rng is a random number generator
28*
29* @return (A,K) the client public key and the shared secret key
30*/
31std::pair<BigInt,SymmetricKey>
32BOTAN_DLL srp6_client_agree(const std::string& username,
33 const std::string& password,
34 const std::string& group_id,
35 const std::string& hash_id,
36 const MemoryRegion<byte>& salt,
37 const BigInt& B,
39
40/**
41* Generate a new SRP-6 verifier
42* @param identifier a username or other client identifier
43* @param password the secret used to authenticate user
44* @param salt a randomly chosen value, at least 128 bits long
45*/
46BigInt BOTAN_DLL generate_srp6_verifier(const std::string& identifier,
47 const std::string& password,
48 const MemoryRegion<byte>& salt,
49 const std::string& group_id,
50 const std::string& hash_id);
51
52/**
53* Return the group id for this SRP param set, or else thrown an
54* exception
55*/
56std::string BOTAN_DLL srp6_group_identifier(const BigInt& N, const BigInt& g);
57
58/**
59* Represents a SRP-6a server session
60*/
61class BOTAN_DLL SRP6_Server_Session
62 {
63 public:
64 /**
65 * Server side step 1
66 * @param v the verification value saved from client registration
67 */
68 BigInt step1(const BigInt& v,
69 const std::string& group_id,
70 const std::string& hash_id,
72
73 SymmetricKey step2(const BigInt& A);
74
75 private:
76 std::string hash_id;
77 BigInt B, b, v, S, p;
78 size_t p_bytes;
79 };
80
81}
82
83#endif
BigInt step1(const BigInt &v, const std::string &group_id, const std::string &hash_id, RandomNumberGenerator &rng)
Definition srp6.cpp:142
SymmetricKey step2(const BigInt &A)
Definition srp6.cpp:167
OctetString SymmetricKey
Definition symkey.h:147
BigInt generate_srp6_verifier(const std::string &identifier, const std::string &password, const MemoryRegion< byte > &salt, const std::string &group_id, const std::string &hash_id)
Definition srp6.cpp:130
std::string srp6_group_identifier(const BigInt &N, const BigInt &g)
Definition srp6.cpp:72
std::pair< BigInt, SymmetricKey > srp6_client_agree(const std::string &identifier, const std::string &password, const std::string &group_id, const std::string &hash_id, const MemoryRegion< byte > &salt, const BigInt &B, RandomNumberGenerator &rng)
Definition srp6.cpp:96