From 6619623d75b8ace7f70f64dc683c5e9193aa6aea Mon Sep 17 00:00:00 2001 From: Benedict Date: Fri, 9 Dec 2016 18:35:45 +0100 Subject: set5: task37: completed --- set5/task37.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 set5/task37.c (limited to 'set5') diff --git a/set5/task37.c b/set5/task37.c new file mode 100644 index 0000000..ccfc66f --- /dev/null +++ b/set5/task37.c @@ -0,0 +1,37 @@ +#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); +} -- cgit v1.2.3-70-g09d2