Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

srp6.h
Go to the documentation of this file.
1 /*
2 * SRP-6a (RFC 5054 compatatible)
3 * (C) 2011,2012 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
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
17 namespace 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 */
31 std::pair<BigInt,SymmetricKey>
32 BOTAN_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 std::vector<uint8_t>& salt,
37 const BigInt& B,
38 RandomNumberGenerator& rng);
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 * @param group_id specifies the shared SRP group
46 * @param hash_id specifies a secure hash function
47 */
48 BigInt BOTAN_DLL generate_srp6_verifier(const std::string& identifier,
49 const std::string& password,
50 const std::vector<uint8_t>& salt,
51 const std::string& group_id,
52 const std::string& hash_id);
53
54 /**
55 * Return the group id for this SRP param set, or else thrown an
56 * exception
57 * @param N the group modulus
58 * @param g the group generator
59 * @return group identifier
60 */
61 std::string BOTAN_DLL srp6_group_identifier(const BigInt& N, const BigInt& g);
62
63 /**
64 * Represents a SRP-6a server session
65 */
66 class BOTAN_DLL SRP6_Server_Session
67 {
68 public:
69 /**
70 * Server side step 1
71 * @param v the verification value saved from client registration
72 * @param group_id the SRP group id
73 * @param hash_id the SRP hash in use
74 * @param rng a random number generator
75 * @return SRP-6 B value
76 */
77 BigInt step1(const BigInt& v,
78 const std::string& group_id,
79 const std::string& hash_id,
80 RandomNumberGenerator& rng);
81
82 /**
83 * Server side step 2
84 * @param A the client's value
85 * @return shared symmetric key
86 */
87 SymmetricKey step2(const BigInt& A);
88
89 private:
90 std::string m_hash_id;
91 BigInt m_B, m_b, m_v, m_S, m_p;
92 size_t m_p_bytes = 0;
93 };
94
95 }
96
97 #endif
Botan::OctetString
Definition: symkey.h:19
Botan::BigInt
Definition: bigint.h:23
Botan::RandomNumberGenerator
Definition: rng.h:25
Botan::SRP6_Server_Session
Definition: srp6.h:66
m_hash_id
std::vector< uint8_t > m_hash_id
Definition: tpm.cpp:440
m_b
BigInt m_b
Definition: curve_gfp.cpp:55
Botan
Definition: alg_id.cpp:13
Botan::srp6_client_agree
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 std::vector< uint8_t > &salt, const BigInt &B, RandomNumberGenerator &rng)
Definition: srp6.cpp:76
Botan::generate_srp6_verifier
BigInt generate_srp6_verifier(const std::string &identifier, const std::string &password, const std::vector< uint8_t > &salt, const std::string &group_id, const std::string &hash_id)
Definition: srp6.cpp:110
m_p
BigInt m_p
Definition: curve_gfp.cpp:55
Botan::srp6_group_identifier
std::string srp6_group_identifier(const BigInt &N, const BigInt &g)
Definition: srp6.cpp:52