diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-04 07:55:00 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-04 07:55:00 +0000 |
commit | 8751885ea79df4b666b65bb2b6900617785e0da7 (patch) | |
tree | 676db28129ece760d7ad354b2d39ba371453db8c /protocols/Gadu-Gadu/src/oauth.cpp | |
parent | 09476981eccbcae37ef4526f3fbcb18fca686ffa (diff) |
end of base64* zoo
git-svn-id: http://svn.miranda-ng.org/main/trunk@4879 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/oauth.cpp')
-rw-r--r-- | protocols/Gadu-Gadu/src/oauth.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 6773b61cf6..4b54e75e7f 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -232,29 +232,19 @@ int oauth_sign_request(LIST<OAUTHPARAMETER> ¶ms, const char *httpmethod, con if (!strcmp(signmethod, "HMAC-SHA1")) {
char *text = oauth_generate_signature(params, httpmethod, url);
- char *key;
char *csenc = oauth_uri_escape(consumer_secret);
char *tsenc = oauth_uri_escape(token_secret);
- mir_sha1_byte_t digest[MIR_SHA1_HASH_SIZE];
- NETLIBBASE64 nlb64 = {0};
- int signlen;
-
- key = (char *)mir_alloc(strlen(csenc) + strlen(tsenc) + 2);
+ char *key = (char *)mir_alloc(strlen(csenc) + strlen(tsenc) + 2);
strcpy(key, csenc);
strcat(key, "&");
strcat(key, tsenc);
mir_free(csenc);
mir_free(tsenc);
+ mir_sha1_byte_t digest[MIR_SHA1_HASH_SIZE];
hmacsha1_hash((BYTE*)text, (int)strlen(text), (BYTE*)key, (int)strlen(key), digest);
- signlen = Netlib_GetBase64EncodedBufferSize(MIR_SHA1_HASH_SIZE);
- sign = (char *)mir_alloc(signlen);
- nlb64.pszEncoded = sign;
- nlb64.cchEncoded = signlen;
- nlb64.pbDecoded = digest;
- nlb64.cbDecoded = MIR_SHA1_HASH_SIZE;
- CallService(MS_NETLIB_BASE64ENCODE, 0, (LPARAM)&nlb64);
+ sign = mir_base64_encode(digest, MIR_SHA1_HASH_SIZE);
mir_free(text);
mir_free(key);
|