gnutls_cert.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GNUTLS_CERT_H
00026 # define GNUTLS_CERT_H
00027
00028 #include <gnutls_pk.h>
00029 #include "x509.h"
00030
00031 #define MAX_PUBLIC_PARAMS_SIZE 4
00032
00033
00034 #define DSA_PUBLIC_PARAMS 4
00035 #define RSA_PUBLIC_PARAMS 2
00036
00037
00038
00039
00040 #define KEY_DIGITAL_SIGNATURE 128
00041 #define KEY_NON_REPUDIATION 64
00042 #define KEY_KEY_ENCIPHERMENT 32
00043 #define KEY_DATA_ENCIPHERMENT 16
00044 #define KEY_KEY_AGREEMENT 8
00045 #define KEY_KEY_CERT_SIGN 4
00046 #define KEY_CRL_SIGN 2
00047 #define KEY_ENCIPHER_ONLY 1
00048 #define KEY_DECIPHER_ONLY 32768
00049
00050 typedef struct MHD_gnutls_cert
00051 {
00052 mpi_t params[MAX_PUBLIC_PARAMS_SIZE];
00053
00054
00055
00056
00057
00058
00059
00060
00061 int params_size;
00062
00063 enum MHD_GNUTLS_PublicKeyAlgorithm subject_pk_algorithm;
00064
00065 unsigned int key_usage;
00066
00067
00068 unsigned int version;
00069
00070
00071 enum MHD_GNUTLS_CertificateType cert_type;
00072
00073 MHD_gnutls_datum_t raw;
00074
00075 } MHD_gnutls_cert;
00076
00077 typedef struct MHD_gnutls_privkey_int
00078 {
00079 mpi_t params[MAX_PRIV_PARAMS_SIZE];
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 int params_size;
00096
00097 enum MHD_GNUTLS_PublicKeyAlgorithm pk_algorithm;
00098 } MHD_gnutls_privkey;
00099
00100 struct MHD_gtls_session_int;
00101
00102 typedef enum ConvFlags
00103 {
00104 CERT_NO_COPY = 2,
00105 CERT_ONLY_PUBKEY = 4,
00106 CERT_ONLY_EXTENSIONS = 16
00107 } ConvFlags;
00108
00109 int MHD_gtls_x509_raw_cert_to_gcert (MHD_gnutls_cert * gcert,
00110 const MHD_gnutls_datum_t * derCert,
00111 int flags);
00112 int MHD_gtls_x509_crt_to_gcert (MHD_gnutls_cert * gcert,
00113 MHD_gnutls_x509_crt_t cert,
00114 unsigned int flags);
00115
00116 void MHD_gtls_gkey_deinit (MHD_gnutls_privkey * key);
00117 void MHD_gtls_gcert_deinit (MHD_gnutls_cert * cert);
00118
00119 int MHD_gtls_selected_cert_supported_kx (struct MHD_gtls_session_int *session,
00120 enum MHD_GNUTLS_KeyExchangeAlgorithm
00121 **alg, int *alg_size);
00122
00123 int MHD_gtls_raw_cert_to_gcert (MHD_gnutls_cert * gcert,
00124 enum MHD_GNUTLS_CertificateType type,
00125 const MHD_gnutls_datum_t * raw_cert,
00126 int flags );
00127 #endif