urls.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2014 Red Hat, Inc.
  3. *
  4. * Author: Nikos Mavrogiannopoulos
  5. *
  6. * This file is part of GnuTLS.
  7. *
  8. * The GnuTLS is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public License
  10. * as published by the Free Software Foundation; either version 2.1 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. #ifndef __GNUTLS_URLS_H
  23. #define __GNUTLS_URLS_H
  24. #include <gnutls/gnutls.h>
  25. #include <gnutls/x509.h>
  26. #include <gnutls/abstract.h>
  27. /* This API allows to register application specific URLs for
  28. * keys and certificates.
  29. */
  30. /* *INDENT-OFF* */
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* *INDENT-ON* */
  35. typedef int (*gnutls_privkey_import_url_func)(gnutls_privkey_t pkey,
  36. const char *url, unsigned flags);
  37. typedef int (*gnutls_x509_crt_import_url_func)(gnutls_x509_crt_t pkey,
  38. const char *url, unsigned flags);
  39. /* The following callbacks are optional */
  40. /* This is to enable gnutls_pubkey_import_url() */
  41. typedef int (*gnutls_pubkey_import_url_func)(gnutls_pubkey_t pkey,
  42. const char *url, unsigned flags);
  43. /* This is to allow constructing a certificate chain. It will be provided
  44. * the initial certificate URL and the certificate to find its issuer, and must
  45. * return zero and the DER encoding of the issuer's certificate. If not available,
  46. * it should return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE. */
  47. typedef int (*gnutls_get_raw_issuer_func)(const char *url, gnutls_x509_crt_t crt,
  48. gnutls_datum_t *issuer_der, unsigned flags);
  49. typedef struct gnutls_custom_url_st {
  50. const char *name;
  51. unsigned name_size;
  52. gnutls_privkey_import_url_func import_key;
  53. gnutls_x509_crt_import_url_func import_crt;
  54. gnutls_pubkey_import_url_func import_pubkey;
  55. gnutls_get_raw_issuer_func get_issuer;
  56. void *future1; /* replace in a future extension */
  57. void *future2; /* replace in a future extension */
  58. } gnutls_custom_url_st;
  59. int gnutls_register_custom_url(const gnutls_custom_url_st *st);
  60. /* *INDENT-OFF* */
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. /* *INDENT-ON* */
  65. #endif