Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:00:18

0001 /*
0002  * Copyright (C) 2014 Red Hat, Inc.
0003  *
0004  * Author: Nikos Mavrogiannopoulos
0005  *
0006  * This file is part of GnuTLS.
0007  *
0008  * The GnuTLS is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Lesser General Public License
0010  * as published by the Free Software Foundation; either version 2.1 of
0011  * the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful, but
0014  * WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Lesser General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Lesser General Public License
0019  * along with this program.  If not, see <https://www.gnu.org/licenses/>
0020  *
0021  */
0022 
0023 #ifndef GNUTLS_URLS_H
0024 #define GNUTLS_URLS_H
0025 
0026 #include <gnutls/gnutls.h>
0027 #include <gnutls/x509.h>
0028 #include <gnutls/abstract.h>
0029 
0030 /* This API allows to register application specific URLs for
0031  * keys and certificates.
0032  */
0033 
0034 #ifdef __cplusplus
0035 extern "C" {
0036 #endif
0037 
0038 typedef int (*gnutls_privkey_import_url_func)(gnutls_privkey_t pkey,
0039                           const char *url, unsigned flags);
0040 
0041 typedef int (*gnutls_x509_crt_import_url_func)(gnutls_x509_crt_t pkey,
0042                            const char *url, unsigned flags);
0043 
0044 /* The following callbacks are optional */
0045 
0046 /* This is to enable gnutls_pubkey_import_url() */
0047 typedef int (*gnutls_pubkey_import_url_func)(gnutls_pubkey_t pkey,
0048                          const char *url, unsigned flags);
0049 
0050 /* This is to allow constructing a certificate chain. It will be provided
0051  * the initial certificate URL and the certificate to find its issuer, and must
0052  * return zero and the DER encoding of the issuer's certificate. If not available,
0053  * it should return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE. */
0054 typedef int (*gnutls_get_raw_issuer_func)(const char *url,
0055                       gnutls_x509_crt_t crt,
0056                       gnutls_datum_t *issuer_der,
0057                       unsigned flags);
0058 
0059 typedef struct gnutls_custom_url_st {
0060     const char *name;
0061     unsigned name_size;
0062     gnutls_privkey_import_url_func import_key;
0063     gnutls_x509_crt_import_url_func import_crt;
0064     gnutls_pubkey_import_url_func import_pubkey;
0065     gnutls_get_raw_issuer_func get_issuer;
0066     void *future1; /* replace in a future extension */
0067     void *future2; /* replace in a future extension */
0068 } gnutls_custom_url_st;
0069 
0070 int gnutls_register_custom_url(const gnutls_custom_url_st *st);
0071 
0072 #ifdef __cplusplus
0073 }
0074 #endif
0075 
0076 #endif /* GNUTLS_URLS_H */