#include "../lib/lib.h" #include "../lib/lib2.h" #include "../lib/lib3.h" #include "../lib/lib4.h" #include "../lib/lib5.h" #include 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); }