blob: ccfc66f3d51aa3370f4d1bc5e92e2fc6cc946be5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include "../lib/lib.h"
#include "../lib/lib2.h"
#include "../lib/lib3.h"
#include "../lib/lib4.h"
#include "../lib/lib5.h"
#include <time.h>
int main()
{
struct srp_context srpc;
char *email = "test@example.com";
char *password = "adfasdkfjh";
char sK[41];
char cK[41];
out = BIO_new(BIO_s_file());
BIO_set_fp(out, stdout, BIO_NOCLOSE);
ctx = BN_CTX_new();
srp_context_init(&srpc);
srp_server_init(email, password, &srpc);
srp_client_send1(email, &srpc);
/** setting A to zero or kN yields to a zero S whatever the password is
* So we can set S also to 0 to get the same session key as the server
**/
BN_zero(srpc.A);
BN_copy(srpc.A, srpc.N);
srp_server_send1(&srpc);
srp_compute_uH(&srpc);
srp_client_s_0_prepare_k(&srpc);
srp_server_prepare_k(&srpc);
// set client session key also to 0
hex_binary_to_string(srpc.client_K, cK, 20);
hex_binary_to_string(srpc.server_K, sK, 20);
printf("cK: %s\n", cK);
printf("sK: %s\n", sK);
}
|