author | Michael Krelin <hacker@klever.net> | 2007-01-12 12:58:25 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-01-12 12:58:25 (UTC) |
commit | e79687a3d9a1631613de02d8e12bae36302b46ab (patch) (unidiff) | |
tree | 4238c0d8d61f5e70ed1e98debb01315babb21686 /lib/params.cc | |
parent | 4cc2e58186e8cd9b96a3573c92f6664064cf11fe (diff) | |
download | libopkele-e79687a3d9a1631613de02d8e12bae36302b46ab.zip libopkele-e79687a3d9a1631613de02d8e12bae36302b46ab.tar.gz libopkele-e79687a3d9a1631613de02d8e12bae36302b46ab.tar.bz2 |
eliminated mimetic dependency and made use of openssl base64 encoder instead
-rw-r--r-- | lib/params.cc | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/params.cc b/lib/params.cc index 14f1a53..03867d5 100644 --- a/lib/params.cc +++ b/lib/params.cc | |||
@@ -1,12 +1,11 @@ | |||
1 | #include <opkele/types.h> | 1 | #include <opkele/types.h> |
2 | #include <opkele/exception.h> | 2 | #include <opkele/exception.h> |
3 | #include <opkele/util.h> | 3 | #include <opkele/util.h> |
4 | #include <openssl/sha.h> | 4 | #include <openssl/sha.h> |
5 | #include <openssl/hmac.h> | 5 | #include <openssl/hmac.h> |
6 | #include <mimetic/mimetic.h> | ||
7 | 6 | ||
8 | namespace opkele { | 7 | namespace opkele { |
9 | using namespace std; | 8 | using namespace std; |
10 | 9 | ||
11 | bool params_t::has_param(const string& n) const { | 10 | bool params_t::has_param(const string& n) const { |
12 | return find(n)!=end(); | 11 | return find(n)!=end(); |
@@ -57,17 +56,13 @@ namespace opkele { | |||
57 | unsigned int md_len = 0; | 56 | unsigned int md_len = 0; |
58 | unsigned char *md = HMAC( | 57 | unsigned char *md = HMAC( |
59 | EVP_sha1(), | 58 | EVP_sha1(), |
60 | &(secret.front()),secret.size(), | 59 | &(secret.front()),secret.size(), |
61 | (const unsigned char *)kv.data(),kv.length(), | 60 | (const unsigned char *)kv.data(),kv.length(), |
62 | 0,&md_len); | 61 | 0,&md_len); |
63 | mimetic::Base64::Encoder b(0); | 62 | sig = util::encode_base64(md,md_len); |
64 | sig.erase(); | ||
65 | mimetic::encode( | ||
66 | md,md+md_len, b, | ||
67 | back_insert_iterator<string>(sig) ); | ||
68 | } | 63 | } |
69 | 64 | ||
70 | string params_t::append_query(const string& url,const char *prefix) const { | 65 | string params_t::append_query(const string& url,const char *prefix) const { |
71 | string rv = url; | 66 | string rv = url; |
72 | bool p = true; | 67 | bool p = true; |
73 | if(rv.find('?')==string::npos) { | 68 | if(rv.find('?')==string::npos) { |