From 45795f0e01be0f51ac647cac4e7c35463f39636a Mon Sep 17 00:00:00 2001 From: Alexander Gluzsky Date: Thu, 7 Apr 2016 18:53:06 +0000 Subject: aim: "clientlogin": implemented hmac_sha256 "clientlogin" is fully implemented now //TODO: make some testing //TODO: turn it on git-svn-id: http://svn.miranda-ng.org/main/trunk@16607 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/AimOscar/src/connection.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'protocols/AimOscar/src/connection.cpp') diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index 0be3ef6dfc..600f4cbcc9 100755 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -258,7 +258,8 @@ void generate_signature(char *signature, const char *method, const char *url, co mir_snprintf(signature_base, 1023, "%s%s%s", method, encoded_url, encoded_parameters); mir_free(encoded_url); mir_free(encoded_parameters); - //signature = hmac_sha256(session_key, signature_base);//TODO: need this to be implemented + hmac_sha256(session_key, signature_base, signature); + } void fill_session_url(char *buf, char *token, char *secret, time_t &hosttime, const char *password, bool encryption = true) @@ -269,12 +270,12 @@ void fill_session_url(char *buf, char *token, char *secret, time_t &hosttime, co */ char query_string[1024]; query_string[0] = 0; - construct_query_string(query_string, token, hosttime); + construct_query_string(query_string, token, hosttime, encryption); char signature[512]; char session_key[1024]; - //session_key = hmac_sha256(password, secret); //TODO: need this to be implemented + hmac_sha256(password, secret, session_key); generate_signature(signature, "GET", AIM_SESSION_URL, query_string, session_key); @@ -353,17 +354,20 @@ bool parse_start_socar_session_response(char *response, char *bos_host, unsigned bos_port = atoi(tmp_port); mir_strcpy(cookie, tmp_cookie); mir_free(tmp_host); mir_free(tmp_port); mir_free(tmp_cookie); - HXML tls_node = xmlGetNthChild(data, _T("tlsCertName"), 0); //tls is optional, so this is not fatal error - if(tls_node) + if (encryption) { - LPCTSTR certname_w = xmlGetText(tls_node); - if(certname_w) + HXML tls_node = xmlGetNthChild(data, _T("tlsCertName"), 0); //tls is optional, so this is not fatal error + if (tls_node) { - char *tmp_certname = mir_t2a(certname_w); - if(tmp_certname) + LPCTSTR certname_w = xmlGetText(tls_node); + if (certname_w) { - mir_strcpy(tls_cert_name, tmp_certname); - mir_free(tmp_certname); + char *tmp_certname = mir_t2a(certname_w); + if (tmp_certname) + { + mir_strcpy(tls_cert_name, tmp_certname); + mir_free(tmp_certname); + } } } } -- cgit v1.2.3