From 6cb46f5857189fc42e05981ca2c01bb00e65e59f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 8 Apr 2016 09:02:00 +0000 Subject: more base64 git-svn-id: http://svn.miranda-ng.org/main/trunk@16612 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/AimOscar/src/connection.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index c7b9dd1b20..7aac34e2e5 100755 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -250,7 +250,7 @@ void construct_query_string(char *buf, const char *token, time_t hosttime, bool } -void generate_signature(BYTE *signature, const char *method, const char *url, const char *parameters, const BYTE *session_key) +void generate_signature(BYTE *signature, const char *method, const char *url, const char *parameters, const char *session_key) { char *encoded_url = mir_urlEncode(url); char *encoded_parameters = mir_urlEncode(parameters); @@ -258,7 +258,7 @@ void generate_signature(BYTE *signature, const char *method, const char *url, co mir_snprintf(signature_base, "%s%s%s", method, encoded_url, encoded_parameters); mir_free(encoded_url); mir_free(encoded_parameters); - mir_hmac_sha256(signature, session_key, MIR_SHA256_HASH_SIZE, (BYTE*)signature_base, mir_strlen(signature_base)); + mir_hmac_sha256(signature, (BYTE*)session_key, mir_strlen(session_key), (BYTE*)signature_base, mir_strlen(signature_base)); } void fill_session_url(char *buf, size_t bufSize, char *token, char *secret, time_t &hosttime, const char *password, bool encryption = true) @@ -273,7 +273,9 @@ void fill_session_url(char *buf, size_t bufSize, char *token, char *secret, time BYTE session_key[MIR_SHA256_HASH_SIZE], signature[MIR_SHA256_HASH_SIZE]; mir_hmac_sha256(session_key, (BYTE*)password, mir_strlen(password), (BYTE*)secret, mir_strlen(secret)); - generate_signature(signature, "GET", AIM_SESSION_URL, query_string, session_key); + + ptrA szKey(mir_base64_encode(session_key, sizeof(session_key))); + generate_signature(signature, "GET", AIM_SESSION_URL, query_string, szKey); ptrA szEncoded(mir_base64_encode(signature, sizeof(signature))); mir_snprintf(buf, bufSize, "%s?%s&sig_sha256=%s", AIM_SESSION_URL, query_string, (char*)szEncoded); -- cgit v1.2.3