summaryrefslogtreecommitdiffabout
path: root/include
authorMichael Krelin <hacker@klever.net>2007-12-16 22:52:51 (UTC)
committer Michael Krelin <hacker@klever.net>2007-12-17 12:09:16 (UTC)
commit24a6f9e3525b76ed1aa787f66b003b01b767af39 (patch) (unidiff)
tree87741582a2a673205b11ac0386725c0b9d8377f9 /include
parentd4e05a6fe00ebd64546637e5873759d4e8d1b010 (diff)
downloadlibopkele-24a6f9e3525b76ed1aa787f66b003b01b767af39.zip
libopkele-24a6f9e3525b76ed1aa787f66b003b01b767af39.tar.gz
libopkele-24a6f9e3525b76ed1aa787f66b003b01b767af39.tar.bz2
made secret_t non-constant size and added params_t::query_string function
1. removed checking that secret_t is exactly 20 bytes, because its size is not so constant anymore. 2. added a query_string function that produces a query string suitable for use in GET and POST requests. I'm making use of it when performing direct request when establishing associations. Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/types.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h
index 520618d..ca07df5 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -37,22 +37,22 @@ namespace opkele {
37 */ 37 */
38 class secret_t : public vector<unsigned char> { 38 class secret_t : public vector<unsigned char> {
39 public: 39 public:
40 40
41 /** 41 /**
42 * xor the secret and hmac together and encode, using base64 42 * xor the secret and hmac together and encode, using base64
43 * @param key_sha1 pointer to the sha1 digest 43 * @param key_d pointer to the message digest
44 * @param rv reference to the return value 44 * @param rv reference to the return value
45 */ 45 */
46 void enxor_to_base64(const unsigned char *key_sha1,string& rv) const; 46 void enxor_to_base64(const unsigned char *key_d,string& rv) const;
47 /** 47 /**
48 * decode base64-encoded secret and xor it with the sha1 digest 48 * decode base64-encoded secret and xor it with the message digest
49 * @param key_sha1 pointer to the message digest 49 * @param key_d pointer to the message digest
50 * @param b64 base64-encoded secret value 50 * @param b64 base64-encoded secret value
51 */ 51 */
52 void enxor_from_base64(const unsigned char *key_sha1,const string& b64); 52 void enxor_from_base64(const unsigned char *key_d,const string& b64);
53 /** 53 /**
54 * plainly encode to base64 representation 54 * plainly encode to base64 representation
55 * @param rv reference to the return value 55 * @param rv reference to the return value
56 */ 56 */
57 void to_base64(string& rv) const; 57 void to_base64(string& rv) const;
58 /** 58 /**
@@ -158,12 +158,20 @@ namespace opkele {
158 * append parameters to the URL as a GET-request parameters. 158 * append parameters to the URL as a GET-request parameters.
159 * @param url the base URL 159 * @param url the base URL
160 * @param prefix the string to prepend to parameter names 160 * @param prefix the string to prepend to parameter names
161 * @return the ready-to-use location 161 * @return the ready-to-use location
162 */ 162 */
163 string append_query(const string& url,const char *prefix = "openid.") const; 163 string append_query(const string& url,const char *prefix = "openid.") const;
164
165 /**
166 * make up a query string suitable for use in GET and POST
167 * requests.
168 * @param prefix string to prened to parameter names
169 * @return query string
170 */
171 string query_string(const char *prefix = "openid.") const;
164 }; 172 };
165 173
166 /** 174 /**
167 * dump the key/value pairs for the parameters to the stream. 175 * dump the key/value pairs for the parameters to the stream.
168 * @param o output stream 176 * @param o output stream
169 * @param p the parameters 177 * @param p the parameters