private-lib-jose-jwe.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * libwebsockets - small server side websockets and web server implementation
  3. *
  4. * Copyright (C) 2010 - 2019 Andy Green <[email protected]>
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to
  8. * deal in the Software without restriction, including without limitation the
  9. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  10. * sell copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  22. * IN THE SOFTWARE.
  23. */
  24. #define LWS_AESGCM_IV 12
  25. #define LWS_AESGCM_TAG 16
  26. /* jwe-rsa-aescbc.c */
  27. int
  28. lws_jwe_auth_and_decrypt_rsa_aes_cbc_hs(struct lws_jwe *jwe);
  29. int
  30. lws_jwe_encrypt_rsa_aes_cbc_hs(struct lws_jwe *jwe,
  31. char *temp, int *temp_len);
  32. int
  33. lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek,
  34. uint8_t *aad, int aad_len);
  35. /* jws-rsa-aesgcm.c */
  36. int
  37. lws_jwe_auth_and_decrypt_gcm(struct lws_jwe *jwe, uint8_t *enc_cek,
  38. uint8_t *aad, int aad_len);
  39. int
  40. lws_jwe_auth_and_decrypt_rsa_aes_gcm(struct lws_jwe *jwe);
  41. int
  42. lws_jwe_encrypt_gcm(struct lws_jwe *jwe,
  43. uint8_t *enc_cek, uint8_t *aad, int aad_len);
  44. int
  45. lws_jwe_encrypt_rsa_aes_gcm(struct lws_jwe *jwe,
  46. char *temp, int *temp_len);
  47. /* jwe-rsa-aeskw.c */
  48. int
  49. lws_jwe_encrypt_aeskw_cbc_hs(struct lws_jwe *jwe,
  50. char *temp, int *temp_len);
  51. int
  52. lws_jwe_auth_and_decrypt_aeskw_cbc_hs(struct lws_jwe *jwe);
  53. /* aescbc.c */
  54. int
  55. lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek,
  56. uint8_t *aad, int aad_len);
  57. int
  58. lws_jwe_encrypt_cbc_hs(struct lws_jwe *jwe,
  59. uint8_t *cek, uint8_t *aad, int aad_len);
  60. int
  61. lws_jwe_auth_and_decrypt_ecdh_cbc_hs(struct lws_jwe *jwe,
  62. char *temp, int *temp_len);
  63. int
  64. lws_jwe_encrypt_ecdh_cbc_hs(struct lws_jwe *jwe,
  65. char *temp, int *temp_len);