32#define LIBOAUTH_VERSION "1.0.3"
33#define LIBOAUTH_VERSION_MAJOR 1
34#define LIBOAUTH_VERSION_MINOR 0
35#define LIBOAUTH_VERSION_MICRO 3
44# define OA_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
46# define OA_GCC_VERSION_AT_LEAST(x,y) 0
49#ifndef attribute_deprecated
50#if OA_GCC_VERSION_AT_LEAST(3,1)
51# define attribute_deprecated __attribute__((deprecated))
53# define attribute_deprecated
373 const char *http_method,
375 const char *c_secret,
386 const char *c_secret,
389 ) attribute_deprecated;
432 const char *http_method,
434 const char *c_secret,
470 const char *http_method,
472 const char *c_secret,
484 const char *c_secret,
487 ) attribute_deprecated;
539 const char *c_secret,
595char *
oauth_http_get2 (
const char *u,
const char *q,
const char *customheader) attribute_deprecated;
651char *
oauth_http_post2 (
const char *u,
const char *p,
const char *customheader) attribute_deprecated;
670char *
oauth_post_file (
const char *u,
const char *fn,
const size_t len,
const char *customheader) attribute_deprecated;
688char *
oauth_post_data (
const char *u,
const char *data,
size_t len,
const char *customheader) attribute_deprecated;
716 const char *customheader,
717 void (*callback)(
void*,
int,
size_t,
size_t),
718 void *callback_data) attribute_deprecated;
742 const char *customheader,
743 const char *httpMethod) attribute_deprecated;
772 const char *customheader,
773 void (*callback)(
void*,
int,
size_t,
size_t),
775 const char *httpMethod) attribute_deprecated;
int oauth_verify_rsa_sha1(const char *m, const char *c, const char *s)
verify RSA-SHA1 signature.
int oauth_time_indepenent_equals_n(const char *a, const char *b, size_t len_a, size_t len_b) attribute_deprecated
int oauth_cmpstringp(const void *p1, const void *p2)
string compare function for oauth parameters.
char * oauth_send_data(const char *u, const char *data, size_t len, const char *customheader, const char *httpMethod) attribute_deprecated
http send raw data.
char * oauth_gen_nonce()
generate a random string between 15 and 32 chars length and return a pointer to it.
char * oauth_serialize_url_sep(int argc, int start, char **argv, char *sep, int mod)
encode query parameters from an array.
int oauth_param_exists(char **argv, int argc, char *key)
search array for parameter key.
char * oauth_body_hash_encode(size_t len, unsigned char *digest)
base64 encode digest, free it and return a URL parameter with the oauth_body_hash.
char * oauth_sign_hmac_sha1(const char *m, const char *k)
returns base64 encoded HMAC-SHA1 signature for given message and key.
char * oauth_encode_base64(int size, const unsigned char *src)
Base64 encode and return size data in 'src'.
int oauth_decode_base64(unsigned char *dest, const char *src)
Decode the base64 encoded string 'src' into the memory pointed to by 'dest'.
OAuthMethod
signature method to used for signing the request.
@ OA_HMAC
use HMAC-SHA1 request signing method
@ OA_RSA
use RSA signature
@ OA_PLAINTEXT
use plain text signature (for testing only)
char * oauth_sign_array2(int *argcp, char ***argvp, char **postargs, OAuthMethod method, const char *http_method, const char *c_key, const char *c_secret, const char *t_key, const char *t_secret)
same as /ref oauth_sign_url with the url already split into parameter array
char * oauth_post_data(const char *u, const char *data, size_t len, const char *customheader) attribute_deprecated
http post raw data the returned string needs to be freed by the caller (requires libcurl)
char * oauth_sign_url(const char *url, char **postargs, OAuthMethod method, const char *c_key, const char *c_secret, const char *t_key, const char *t_secret) attribute_deprecated
char * oauth_sign_plaintext(const char *m, const char *k)
returns plaintext signature for the given key.
int oauth_split_url_parameters(const char *url, char ***argv)
splits the given url into a parameter array.
char * oauth_body_hash_file(char *filename)
calculate body hash (sha1sum) of given file and return a oauth_body_hash=xxxx parameter to be added t...
char * oauth_url_unescape(const char *string, size_t *olen)
Parse RFC3986 encoded 'string' back to unescaped version.
char * oauth_post_file(const char *u, const char *fn, const size_t len, const char *customheader) attribute_deprecated
http post raw data from file.
char * oauth_http_get(const char *u, const char *q) attribute_deprecated
do a HTTP GET request, wait for it to finish and return the content of the reply.
char * oauth_sign_xmpp(const char *xml, OAuthMethod method, const char *c_secret, const char *t_secret)
xep-0235 - TODO
char * oauth_http_post2(const char *u, const char *p, const char *customheader) attribute_deprecated
do a HTTP POST request, wait for it to finish and return the content of the reply.
int oauth_time_indepenent_equals(const char *a, const char *b) attribute_deprecated
char * oauth_send_data_with_callback(const char *u, const char *data, size_t len, const char *customheader, void(*callback)(void *, int, size_t, size_t), void *callback_data, const char *httpMethod) attribute_deprecated
http post raw data, with callback.
int oauth_time_independent_equals(const char *a, const char *b)
compare two strings in constant-time.
char * oauth_url_escape(const char *string)
Escape 'string' according to RFC3986 and http://oauth.net/core/1.0/#encoding_parameters.
char * oauth_sign_rsa_sha1(const char *m, const char *k)
returns RSA-SHA1 signature for given data.
char * oauth_catenc(int len,...)
url-escape strings and concatenate with '&' separator.
char * oauth_sign_array(int *argcp, char ***argvp, char **postargs, OAuthMethod method, const char *c_key, const char *c_secret, const char *t_key, const char *t_secret) attribute_deprecated
void oauth_sign_array2_process(int *argcp, char ***argvp, char **postargs, OAuthMethod method, const char *http_method, const char *c_key, const char *c_secret, const char *t_key, const char *t_secret)
the back-end behind by /ref oauth_sign_array2.
char * oauth_serialize_url_parameters(int argc, char **argv)
build a query parameter string from an array.
int oauth_time_independent_equals_n(const char *a, const char *b, size_t len_a, size_t len_b)
compare two strings in constant-time (as to not let an attacker guess how many leading chars are corr...
int oauth_split_post_paramters(const char *url, char ***argv, short qesc)
splits the given url into a parameter array.
char * oauth_http_get2(const char *u, const char *q, const char *customheader) attribute_deprecated
do a HTTP GET request, wait for it to finish and return the content of the reply.
char * oauth_body_hash_data(size_t length, const char *data)
calculate body hash (sha1sum) of given data and return a oauth_body_hash=xxxx parameter to be added t...
void oauth_free_array(int *argcp, char ***argvp)
free array args
char * oauth_sign_url2(const char *url, char **postargs, OAuthMethod method, const char *http_method, const char *c_key, const char *c_secret, const char *t_key, const char *t_secret)
calculate OAuth-signature for a given HTTP request URL, parameters and oauth-tokens.
char * oauth_http_post(const char *u, const char *p) attribute_deprecated
do a HTTP POST request, wait for it to finish and return the content of the reply.
void oauth_add_param_to_array(int *argcp, char ***argvp, const char *addparam)
add query parameter to array
char * oauth_serialize_url(int argc, int start, char **argv)
build a url query string from an array.
char * oauth_sign_hmac_sha1_raw(const char *m, const size_t ml, const char *k, const size_t kl)
same as oauth_sign_hmac_sha1 but allows one to specify length of message and key (in case they contai...
char * oauth_post_data_with_callback(const char *u, const char *data, size_t len, const char *customheader, void(*callback)(void *, int, size_t, size_t), void *callback_data) attribute_deprecated
http post raw data, with callback.