oss_auth.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef LIB_OSS_AUTH_H
  2. #define LIB_OSS_AUTH_H
  3. #include "aos_util.h"
  4. #include "aos_string.h"
  5. #include "aos_http_io.h"
  6. #include "oss_define.h"
  7. OSS_CPP_START
  8. /**
  9. * @brief sign oss headers
  10. **/
  11. void oss_sign_headers(aos_pool_t *p,
  12. const aos_string_t *signstr,
  13. const aos_string_t *access_key_id,
  14. const aos_string_t *access_key_secret,
  15. aos_table_t *headers);
  16. /**
  17. * @brief get string to signature
  18. **/
  19. int oss_get_string_to_sign(aos_pool_t *p,
  20. http_method_e method,
  21. const aos_string_t *canon_res,
  22. const aos_table_t *headers,
  23. const aos_table_t *params,
  24. aos_string_t *signstr);
  25. /**
  26. * @brief get signed oss request headers
  27. **/
  28. int oss_get_signed_headers(aos_pool_t *p, const aos_string_t *access_key_id,
  29. const aos_string_t *access_key_secret,
  30. const aos_string_t* canon_res, aos_http_request_t *req);
  31. /**
  32. * @brief sign oss request
  33. **/
  34. int oss_sign_request(aos_http_request_t *req, const oss_config_t *config);
  35. /**
  36. * @brief generate oss request Signature
  37. **/
  38. int get_oss_request_signature(const oss_request_options_t *options, aos_http_request_t *req,
  39. const aos_string_t *expires, aos_string_t *signature);
  40. /**
  41. * @brief get oss signed url
  42. **/
  43. int oss_get_signed_url(const oss_request_options_t *options, aos_http_request_t *req,
  44. const aos_string_t *expires, aos_string_t *auth_url);
  45. /**
  46. * @brief get rtmp string to signature
  47. **/
  48. int oss_get_rtmp_string_to_sign(aos_pool_t *p, const aos_string_t *expires,
  49. const aos_string_t *canon_res, const aos_table_t *params,
  50. aos_string_t *signstr);
  51. /**
  52. * @brief generate oss rtmp request signature
  53. **/
  54. int get_oss_rtmp_request_signature(const oss_request_options_t *options, aos_http_request_t *req,
  55. const aos_string_t *expires, aos_string_t *signature);
  56. /**
  57. * @brief get oss rtmp signed url
  58. **/
  59. int oss_get_rtmp_signed_url(const oss_request_options_t *options, aos_http_request_t *req,
  60. const aos_string_t *expires, const aos_string_t *play_list_name, aos_table_t *params,
  61. aos_string_t *signed_url);
  62. OSS_CPP_END
  63. #endif