summaryrefslogtreecommitdiff
path: root/set5/task37.c
diff options
context:
space:
mode:
Diffstat (limited to 'set5/task37.c')
-rw-r--r--set5/task37.c37
1 files changed, 37 insertions, 0 deletions
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 <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);
+}