| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
E.3 X.509 certificate API
The following functions are to be used for X.509 certificate handling. Their prototypes lie in ‘gnutls/x509.h’.
gnutls_certificate_set_trust_list
- Function: void gnutls_certificate_set_trust_list (gnutls_certificate_credentials_t res, gnutls_x509_trust_list_t tlist, unsigned flags)
- res: is a - gnutls_certificate_credentials_tstructure.- tlist: is a - gnutls_x509_trust_list_tstructure- flags: must be zero - This function sets a trust list in the gnutls_certificate_credentials_t structure. - Note that the - tlistwill become part of the credentials structure and must not be deallocated. It will be automatically deallocated when the- resstructure is deinitialized.- Returns: - GNUTLS_E_SUCCESS(0) on success, or a negative error code.- Since: 3.2.2 
gnutls_pkcs7_deinit
- Function: void gnutls_pkcs7_deinit (gnutls_pkcs7_t pkcs7)
- pkcs7: The structure to be initialized - This function will deinitialize a PKCS7 structure. 
gnutls_pkcs7_delete_crl
- Function: int gnutls_pkcs7_delete_crl (gnutls_pkcs7_t pkcs7, int indx)
- pkcs7: should contain a - gnutls_pkcs7_tstructure- indx: the index of the crl to delete - This function will delete a crl from a PKCS7 or RFC2630 crl set. Index starts from 0. Returns 0 on success. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_delete_crt
- Function: int gnutls_pkcs7_delete_crt (gnutls_pkcs7_t pkcs7, int indx)
- pkcs7: should contain a gnutls_pkcs7_t structure - indx: the index of the certificate to delete - This function will delete a certificate from a PKCS7 or RFC2630 certificate set. Index starts from 0. Returns 0 on success. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_export
- Function: int gnutls_pkcs7_export (gnutls_pkcs7_t pkcs7, gnutls_x509_crt_fmt_t format, void * output_data, size_t * output_data_size)
- pkcs7: Holds the pkcs7 structure - format: the format of output params. One of PEM or DER. - output_data: will contain a structure PEM or DER encoded - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will export the pkcs7 structure to DER or PEM format. - If the buffer provided is not long enough to hold the output, then * - output_data_sizeis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned.- If the structure is PEM encoded, it will have a header of "BEGIN PKCS7". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_export2
- Function: int gnutls_pkcs7_export2 (gnutls_pkcs7_t pkcs7, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out)
- pkcs7: Holds the pkcs7 structure - format: the format of output params. One of PEM or DER. - out: will contain a structure PEM or DER encoded - This function will export the pkcs7 structure to DER or PEM format. - The output buffer is allocated using - gnutls_malloc().- If the structure is PEM encoded, it will have a header of "BEGIN PKCS7". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.1.3 
gnutls_pkcs7_get_crl_count
- Function: int gnutls_pkcs7_get_crl_count (gnutls_pkcs7_t pkcs7)
- pkcs7: should contain a gnutls_pkcs7_t structure - This function will return the number of certifcates in the PKCS7 or RFC2630 crl set. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_get_crl_raw
- Function: int gnutls_pkcs7_get_crl_raw (gnutls_pkcs7_t pkcs7, int indx, void * crl, size_t * crl_size)
- pkcs7: should contain a - gnutls_pkcs7_tstructure- indx: contains the index of the crl to extract - crl: the contents of the crl will be copied there (may be null) - crl_size: should hold the size of the crl - This function will return a crl of the PKCS7 or RFC2630 crl set. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. If the provided buffer is not long enough, then- crl_sizeis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERis returned. After the last crl has been read- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.
gnutls_pkcs7_get_crt_count
- Function: int gnutls_pkcs7_get_crt_count (gnutls_pkcs7_t pkcs7)
- pkcs7: should contain a - gnutls_pkcs7_tstructure- This function will return the number of certifcates in the PKCS7 or RFC2630 certificate set. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_get_crt_raw
- Function: int gnutls_pkcs7_get_crt_raw (gnutls_pkcs7_t pkcs7, int indx, void * certificate, size_t * certificate_size)
- pkcs7: should contain a gnutls_pkcs7_t structure - indx: contains the index of the certificate to extract - certificate: the contents of the certificate will be copied there (may be null) - certificate_size: should hold the size of the certificate - This function will return a certificate of the PKCS7 or RFC2630 certificate set. - After the last certificate has been read - GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. If the provided buffer is not long enough, then- certificate_sizeis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERis returned.
gnutls_pkcs7_import
- Function: int gnutls_pkcs7_import (gnutls_pkcs7_t pkcs7, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format)
- pkcs7: The structure to store the parsed PKCS7. - data: The DER or PEM encoded PKCS7. - format: One of DER or PEM - This function will convert the given DER or PEM encoded PKCS7 to the native - gnutls_pkcs7_tformat. The output will be stored in- pkcs7.- If the PKCS7 is PEM encoded it should have a header of "PKCS7". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_init
- Function: int gnutls_pkcs7_init (gnutls_pkcs7_t * pkcs7)
- pkcs7: The structure to be initialized - This function will initialize a PKCS7 structure. PKCS7 structures usually contain lists of X.509 Certificates and X.509 Certificate revocation lists. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_set_crl
- Function: int gnutls_pkcs7_set_crl (gnutls_pkcs7_t pkcs7, gnutls_x509_crl_t crl)
- pkcs7: should contain a - gnutls_pkcs7_tstructure- crl: the DER encoded crl to be added - This function will add a parsed CRL to the PKCS7 or RFC2630 crl set. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_set_crl_raw
- Function: int gnutls_pkcs7_set_crl_raw (gnutls_pkcs7_t pkcs7, const gnutls_datum_t * crl)
- pkcs7: should contain a - gnutls_pkcs7_tstructure- crl: the DER encoded crl to be added - This function will add a crl to the PKCS7 or RFC2630 crl set. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_set_crt
- Function: int gnutls_pkcs7_set_crt (gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t crt)
- pkcs7: should contain a - gnutls_pkcs7_tstructure- crt: the certificate to be copied. - This function will add a parsed certificate to the PKCS7 or RFC2630 certificate set. This is a wrapper function over - gnutls_pkcs7_set_crt_raw().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_pkcs7_set_crt_raw
- Function: int gnutls_pkcs7_set_crt_raw (gnutls_pkcs7_t pkcs7, const gnutls_datum_t * crt)
- pkcs7: should contain a - gnutls_pkcs7_tstructure- crt: the DER encoded certificate to be added - This function will add a certificate to the PKCS7 or RFC2630 certificate set. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_subject_alt_names_deinit
- Function: void gnutls_subject_alt_names_deinit (gnutls_subject_alt_names_t sans)
- sans: The alternative names structure - This function will deinitialize an alternative names structure. - Since: 3.3.0 
gnutls_subject_alt_names_get
- Function: int gnutls_subject_alt_names_get (gnutls_subject_alt_names_t sans, unsigned int seq, unsigned int * san_type, gnutls_datum_t * san, gnutls_datum_t * othername_oid)
- sans: The alternative names structure - seq: The index of the name to get - san_type: Will hold the type of the name (of - gnutls_subject_alt_names_t)- san: The alternative name data (should be treated as constant) - othername_oid: The object identifier if - san_typeis- GNUTLS_SAN_OTHERNAME(should be treated as constant)- This function will return a specific alternative name as stored in the - sansstructure. The returned values should be treated as constant and valid for the lifetime of- sans.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the index is out of bounds, otherwise a negative error value.- Since: 3.3.0 
gnutls_subject_alt_names_init
- Function: int gnutls_subject_alt_names_init (gnutls_subject_alt_names_t * sans)
- sans: The alternative names structure - This function will initialize an alternative names structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_subject_alt_names_set
- Function: int gnutls_subject_alt_names_set (gnutls_subject_alt_names_t sans, unsigned int san_type, const gnutls_datum_t * san, const char * othername_oid)
- sans: The alternative names structure - san_type: The type of the name (of - gnutls_subject_alt_names_t)- san: The alternative name data - othername_oid: The object identifier if - san_typeis- GNUTLS_SAN_OTHERNAME- This function will store the specified alternative name in the - sansstructure.- Returns: On success, - GNUTLS_E_SUCCESS(0), otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_aia_deinit
- Function: void gnutls_x509_aia_deinit (gnutls_x509_aia_t aia)
- aia: The authority info access structure - This function will deinitialize a CRL distribution points structure. - Since: 3.3.0 
gnutls_x509_aia_get
- Function: int gnutls_x509_aia_get (gnutls_x509_aia_t aia, unsigned int seq, gnutls_datum_t * oid, unsigned * san_type, gnutls_datum_t * san)
- aia: The authority info access structure - seq: specifies the sequence number of the access descriptor (0 for the first one, 1 for the second etc.) - oid: the type of available data; to be treated as constant. - san_type: Will hold the type of the name of - gnutls_subject_alt_names_t(may be null).- san: the access location name; to be treated as constant (may be null). - This function reads from the Authority Information Access structure. - The - seqinput parameter is used to indicate which member of the sequence the caller is interested in. The first member is 0, the second member 1 and so on. When the- seqvalue is out of bounds,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.- Typically - oidis- GNUTLS_OID_AD_CAISSUERSor- GNUTLS_OID_AD_OCSP.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_aia_init
- Function: int gnutls_x509_aia_init (gnutls_x509_aia_t * aia)
- aia: The authority info access structure - This function will initialize a CRL distribution points structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_aia_set
- Function: int gnutls_x509_aia_set (gnutls_x509_aia_t aia, const char * oid, unsigned san_type, const gnutls_datum_t * san)
- aia: The authority info access structure - oid: the type of data. - san_type: The type of the name (of - gnutls_subject_alt_names_t)- san: The alternative name data - This function will store the specified alternative name in the - aiastructure.- Typically the value for - oidshould be- GNUTLS_OID_AD_OCSP, or- GNUTLS_OID_AD_CAISSUERS.- Returns: On success, - GNUTLS_E_SUCCESS(0), otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_aki_deinit
- Function: void gnutls_x509_aki_deinit (gnutls_x509_aki_t aki)
- aki: The authority key identifier structure - This function will deinitialize an authority key identifier structure. - Since: 3.3.0 
gnutls_x509_aki_get_cert_issuer
- Function: int gnutls_x509_aki_get_cert_issuer (gnutls_x509_aki_t aki, unsigned int seq, unsigned int * san_type, gnutls_datum_t * san, gnutls_datum_t * othername_oid, gnutls_datum_t * serial)
- aki: The authority key ID structure - seq: The index of the name to get - san_type: Will hold the type of the name (of - gnutls_subject_alt_names_t), may be null- san: The alternative name data (may be null and should be treated as constant) - othername_oid: The object identifier if - san_typeis- GNUTLS_SAN_OTHERNAME(should be treated as constant)- serial: The authorityCertSerialNumber number (may be null) - This function will return a specific authorityCertIssuer name as stored in the - akistructure, as well as the authorityCertSerialNumber.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the index is out of bounds, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_aki_get_id
- Function: int gnutls_x509_aki_get_id (gnutls_x509_aki_t aki, gnutls_datum_t * id)
- aki: The authority key ID structure - id: Will hold the identifier - This function will return the key identifier as stored in the - akistructure.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the index is out of bounds, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_aki_init
- Function: int gnutls_x509_aki_init (gnutls_x509_aki_t * aki)
- aki: The authority key ID structure - This function will initialize an authority key ID structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_aki_set_cert_issuer
- Function: int gnutls_x509_aki_set_cert_issuer (gnutls_x509_aki_t aki, unsigned int san_type, const gnutls_datum_t * san, const char * othername_oid, const gnutls_datum_t * serial)
- aki: The authority key ID structure - san_type: the type of the name (of - gnutls_subject_alt_names_t), may be null- san: The alternative name data - othername_oid: The object identifier if - san_typeis- GNUTLS_SAN_OTHERNAME- serial: The authorityCertSerialNumber number (may be null) - This function will set the authorityCertIssuer name and the authorityCertSerialNumber to be stored in the - akistructure. When storing multiple names, the serial should be set on the first call, and subsequent calls should use a- NULLserial.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_aki_set_id
- Function: int gnutls_x509_aki_set_id (gnutls_x509_aki_t aki, const gnutls_datum_t * id)
- aki: The authority key ID structure - id: the key identifier - This function will set the keyIdentifier to be stored in the - akistructure.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_crl_check_issuer
- Function: int gnutls_x509_crl_check_issuer (gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer)
- crl: is the CRL to be checked - issuer: is the certificate of a possible issuer - This function will check if the given CRL was issued by the given issuer certificate. - Returns: true (1) if the given CRL was issued by the given issuer, and false (0) if not. 
gnutls_x509_crl_deinit
- Function: void gnutls_x509_crl_deinit (gnutls_x509_crl_t crl)
- crl: The structure to be initialized - This function will deinitialize a CRL structure. 
gnutls_x509_crl_dist_points_deinit
- Function: void gnutls_x509_crl_dist_points_deinit (gnutls_x509_crl_dist_points_t cdp)
- cdp: The CRL distribution points structure - This function will deinitialize a CRL distribution points structure. - Since: 3.3.0 
gnutls_x509_crl_dist_points_get
- Function: int gnutls_x509_crl_dist_points_get (gnutls_x509_crl_dist_points_t cdp, unsigned int seq, unsigned int * type, gnutls_datum_t * san, unsigned int * reasons)
- cdp: The CRL distribution points structure - seq: specifies the sequence number of the distribution point (0 for the first one, 1 for the second etc.) - type: The name type of the corresponding name (gnutls_x509_subject_alt_name_t) - san: The distribution point names (to be treated as constant) - reasons: Revocation reasons. An ORed sequence of flags from - gnutls_x509_crl_reason_flags_t.- This function retrieves the individual CRL distribution points (2.5.29.31), contained in provided structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the index is out of bounds, otherwise a negative error value.
gnutls_x509_crl_dist_points_init
- Function: int gnutls_x509_crl_dist_points_init (gnutls_x509_crl_dist_points_t * cdp)
- cdp: The CRL distribution points structure - This function will initialize a CRL distribution points structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_crl_dist_points_set
- Function: int gnutls_x509_crl_dist_points_set (gnutls_x509_crl_dist_points_t cdp, gnutls_x509_subject_alt_name_t type, const gnutls_datum_t * san, unsigned int reasons)
- cdp: The CRL distribution points structure - type: The type of the name (of - gnutls_subject_alt_names_t)- san: The point name data - reasons: Revocation reasons. An ORed sequence of flags from - gnutls_x509_crl_reason_flags_t.- This function will store the specified CRL distibution point value the - cdpstructure.- Returns: On success, - GNUTLS_E_SUCCESS(0), otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_crl_export
- Function: int gnutls_x509_crl_export (gnutls_x509_crl_t crl, gnutls_x509_crt_fmt_t format, void * output_data, size_t * output_data_size)
- crl: Holds the revocation list - format: the format of output params. One of PEM or DER. - output_data: will contain a private key PEM or DER encoded - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will export the revocation list to DER or PEM format. - If the buffer provided is not long enough to hold the output, then - GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned.- If the structure is PEM encoded, it will have a header of "BEGIN X509 CRL". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. and a negative error code on failure.
gnutls_x509_crl_export2
- Function: int gnutls_x509_crl_export2 (gnutls_x509_crl_t crl, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out)
- crl: Holds the revocation list - format: the format of output params. One of PEM or DER. - out: will contain a private key PEM or DER encoded - This function will export the revocation list to DER or PEM format. - The output buffer is allocated using - gnutls_malloc().- If the structure is PEM encoded, it will have a header of "BEGIN X509 CRL". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. and a negative error code on failure.- Since 3.1.3 
gnutls_x509_crl_get_authority_key_gn_serial
- Function: int gnutls_x509_crl_get_authority_key_gn_serial (gnutls_x509_crl_t crl, unsigned int seq, void * alt, size_t * alt_size, unsigned int * alt_type, void * serial, size_t * serial_size, unsigned int * critical)
- crl: should contain a - gnutls_x509_crl_tstructure- seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) - alt: is the place where the alternative name will be copied to - alt_size: holds the size of alt. - alt_type: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t). - serial: buffer to store the serial number (may be null) - serial_size: Holds the size of the serial field (may be null) - critical: will be non-zero if the extension is marked as critical (may be null) - This function will return the X.509 authority key identifier when stored as a general name (authorityCertIssuer) and serial number. - Because more than one general names might be stored - seqcan be used as a counter to request them all until- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.- Returns: Returns 0 on success, or an error code. - Since: 3.0 
gnutls_x509_crl_get_authority_key_id
- Function: int gnutls_x509_crl_get_authority_key_id (gnutls_x509_crl_t crl, void * id, size_t * id_size, unsigned int * critical)
- crl: should contain a - gnutls_x509_crl_tstructure- id: The place where the identifier will be copied - id_size: Holds the size of the result field. - critical: will be non-zero if the extension is marked as critical (may be null) - This function will return the CRL authority’s key identifier. This is obtained by the X.509 Authority Key identifier extension field (2.5.29.35). Note that this function only returns the keyIdentifier field of the extension and - GNUTLS_E_X509_UNSUPPORTED_EXTENSION, if the extension contains the name and serial number of the certificate. In that case- gnutls_x509_crl_get_authority_key_gn_serial()may be used.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error.- Since: 2.8.0 
gnutls_x509_crl_get_crt_count
- Function: int gnutls_x509_crl_get_crt_count (gnutls_x509_crl_t crl)
- crl: should contain a - gnutls_x509_crl_tstructure- This function will return the number of revoked certificates in the given CRL. - Returns: number of certificates, a negative error code on failure. 
gnutls_x509_crl_get_crt_serial
- Function: int gnutls_x509_crl_get_crt_serial (gnutls_x509_crl_t crl, int indx, unsigned char * serial, size_t * serial_size, time_t * t)
- crl: should contain a - gnutls_x509_crl_tstructure- indx: the index of the certificate to extract (starting from 0) - serial: where the serial number will be copied - serial_size: initially holds the size of serial - t: if non null, will hold the time this certificate was revoked - This function will retrieve the serial number of the specified, by the index, revoked certificate. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. and a negative error code on error.
gnutls_x509_crl_get_dn_oid
- Function: int gnutls_x509_crl_get_dn_oid (gnutls_x509_crl_t crl, int indx, void * oid, size_t * sizeof_oid)
- crl: should contain a gnutls_x509_crl_t structure - indx: Specifies which DN OID to send. Use (0) to get the first one. - oid: a pointer to a structure to hold the name (may be null) - sizeof_oid: initially holds the size of ’oid’ - This function will extract the requested OID of the name of the CRL issuer, specified by the given index. - If oid is null then only the size will be filled. - Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the sizeof_oid will be updated with the required size. On success 0 is returned.
gnutls_x509_crl_get_extension_data
- Function: int gnutls_x509_crl_get_extension_data (gnutls_x509_crl_t crl, int indx, void * data, size_t * sizeof_data)
- crl: should contain a - gnutls_x509_crl_tstructure- indx: Specifies which extension OID to send. Use (0) to get the first one. - data: a pointer to a structure to hold the data (may be null) - sizeof_data: initially holds the size of - oid- This function will return the requested extension data in the CRL. The extension data will be stored as a string in the provided buffer. - Use - gnutls_x509_crl_get_extension_info()to extract the OID and critical flag. Use- gnutls_x509_crl_get_extension_info()instead, if you want to get data indexed by the extension OID rather than sequence.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error. If your have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crl_get_extension_data2
- Function: int gnutls_x509_crl_get_extension_data2 (gnutls_x509_crl_t crl, unsigned indx, gnutls_datum_t * data)
- crl: should contain a - gnutls_x509_crl_tstructure- indx: Specifies which extension OID to read. Use (0) to get the first one. - data: will contain the extension DER-encoded data - This function will return the requested by the index extension data in the certificate revocation list. The extension data will be allocated using - gnutls_malloc().- Use - gnutls_x509_crt_get_extension_info()to extract the OID.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code is returned. If you have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.
gnutls_x509_crl_get_extension_info
- Function: int gnutls_x509_crl_get_extension_info (gnutls_x509_crl_t crl, int indx, void * oid, size_t * sizeof_oid, unsigned int * critical)
- crl: should contain a - gnutls_x509_crl_tstructure- indx: Specifies which extension OID to send, use (0) to get the first one. - oid: a pointer to a structure to hold the OID - sizeof_oid: initially holds the maximum size of - oid, on return holds actual size of- oid.- critical: output variable with critical flag, may be NULL. - This function will return the requested extension OID in the CRL, and the critical flag for it. The extension OID will be stored as a string in the provided buffer. Use - gnutls_x509_crl_get_extension_data()to extract the data.- If the buffer provided is not long enough to hold the output, then * - sizeof_oidis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error. If your have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crl_get_extension_oid
- Function: int gnutls_x509_crl_get_extension_oid (gnutls_x509_crl_t crl, int indx, void * oid, size_t * sizeof_oid)
- crl: should contain a - gnutls_x509_crl_tstructure- indx: Specifies which extension OID to send, use (0) to get the first one. - oid: a pointer to a structure to hold the OID (may be null) - sizeof_oid: initially holds the size of - oid- This function will return the requested extension OID in the CRL. The extension OID will be stored as a string in the provided buffer. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error. If your have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crl_get_issuer_dn
- Function: int gnutls_x509_crl_get_issuer_dn (const gnutls_x509_crl_t crl, char * buf, size_t * sizeof_buf)
- crl: should contain a gnutls_x509_crl_t structure - buf: a pointer to a structure to hold the peer’s name (may be null) - sizeof_buf: initially holds the size of - buf- This function will copy the name of the CRL issuer in the provided buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. - If buf is - NULLthen only the size will be filled.- Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the sizeof_buf will be updated with the required size, and 0 on success.
gnutls_x509_crl_get_issuer_dn2
- Function: int gnutls_x509_crl_get_issuer_dn2 (gnutls_x509_crl_t crl, gnutls_datum_t * dn)
- crl: should contain a - gnutls_x509_crl_tstructure- dn: a pointer to a structure to hold the name - This function will allocate buffer and copy the name of the CRL issuer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. and a negative error code on error.- Since: 3.1.10 
gnutls_x509_crl_get_issuer_dn_by_oid
- Function: int gnutls_x509_crl_get_issuer_dn_by_oid (gnutls_x509_crl_t crl, const char * oid, int indx, unsigned int raw_flag, void * buf, size_t * sizeof_buf)
- crl: should contain a gnutls_x509_crl_t structure - oid: holds an Object Identified in null terminated string - indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use (0) to get the first one. - raw_flag: If non-zero returns the raw DER data of the DN part. - buf: a pointer to a structure to hold the peer’s name (may be null) - sizeof_buf: initially holds the size of - buf- This function will extract the part of the name of the CRL issuer specified by the given OID. The output will be encoded as described in RFC4514. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. - Some helper macros with popular OIDs can be found in gnutls/x509.h If raw flag is (0), this function will only return known OIDs as text. Other OIDs will be DER encoded, as described in RFC4514 – in hex format with a ’#’ prefix. You can check about known OIDs using - gnutls_x509_dn_oid_known().- If buf is null then only the size will be filled. - Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the sizeof_buf will be updated with the required size, and 0 on success.
gnutls_x509_crl_get_next_update
- Function: time_t gnutls_x509_crl_get_next_update (gnutls_x509_crl_t crl)
- crl: should contain a - gnutls_x509_crl_tstructure- This function will return the time the next CRL will be issued. This field is optional in a CRL so it might be normal to get an error instead. - Returns: when the next CRL will be issued, or (time_t)-1 on error. 
gnutls_x509_crl_get_number
- Function: int gnutls_x509_crl_get_number (gnutls_x509_crl_t crl, void * ret, size_t * ret_size, unsigned int * critical)
- crl: should contain a - gnutls_x509_crl_tstructure- ret: The place where the number will be copied - ret_size: Holds the size of the result field. - critical: will be non-zero if the extension is marked as critical (may be null) - This function will return the CRL number extension. This is obtained by the CRL Number extension field (2.5.29.20). - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error.- Since: 2.8.0 
gnutls_x509_crl_get_raw_issuer_dn
- Function: int gnutls_x509_crl_get_raw_issuer_dn (gnutls_x509_crl_t crl, gnutls_datum_t * dn)
- crl: should contain a gnutls_x509_crl_t structure - dn: will hold the starting point of the DN - This function will return a pointer to the DER encoded DN structure and the length. - Returns: a negative error code on error, and (0) on success. - Since: 2.12.0 
gnutls_x509_crl_get_signature
- Function: int gnutls_x509_crl_get_signature (gnutls_x509_crl_t crl, char * sig, size_t * sizeof_sig)
- crl: should contain a gnutls_x509_crl_t structure - sig: a pointer where the signature part will be copied (may be null). - sizeof_sig: initially holds the size of - sig- This function will extract the signature field of a CRL. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. and a negative error code on error.
gnutls_x509_crl_get_signature_algorithm
- Function: int gnutls_x509_crl_get_signature_algorithm (gnutls_x509_crl_t crl)
- crl: should contain a - gnutls_x509_crl_tstructure- This function will return a value of the - gnutls_sign_algorithm_tenumeration that is the signature algorithm.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_get_this_update
- Function: time_t gnutls_x509_crl_get_this_update (gnutls_x509_crl_t crl)
- crl: should contain a - gnutls_x509_crl_tstructure- This function will return the time this CRL was issued. - Returns: when the CRL was issued, or (time_t)-1 on error. 
gnutls_x509_crl_get_version
- Function: int gnutls_x509_crl_get_version (gnutls_x509_crl_t crl)
- crl: should contain a - gnutls_x509_crl_tstructure- This function will return the version of the specified CRL. - Returns: The version number, or a negative error code on error. 
gnutls_x509_crl_import
- Function: int gnutls_x509_crl_import (gnutls_x509_crl_t crl, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format)
- crl: The structure to store the parsed CRL. - data: The DER or PEM encoded CRL. - format: One of DER or PEM - This function will convert the given DER or PEM encoded CRL to the native - gnutls_x509_crl_tformat. The output will be stored in ’crl’.- If the CRL is PEM encoded it should have a header of "X509 CRL". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_init
- Function: int gnutls_x509_crl_init (gnutls_x509_crl_t * crl)
- crl: The structure to be initialized - This function will initialize a CRL structure. CRL stands for Certificate Revocation List. A revocation list usually contains lists of certificate serial numbers that have been revoked by an Authority. The revocation lists are always signed with the authority’s private key. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_list_import
- Function: int gnutls_x509_crl_list_import (gnutls_x509_crl_t * crls, unsigned int * crl_max, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags)
- crls: The structures to store the parsed CRLs. Must not be initialized. - crl_max: Initially must hold the maximum number of crls. It will be updated with the number of crls available. - data: The PEM encoded CRLs - format: One of DER or PEM. - flags: must be (0) or an OR’d sequence of gnutls_certificate_import_flags. - This function will convert the given PEM encoded CRL list to the native gnutls_x509_crl_t format. The output will be stored in - crls. They will be automatically initialized.- If the Certificate is PEM encoded it should have a header of "X509 CRL". - Returns: the number of certificates read or a negative error value. - Since: 3.0 
gnutls_x509_crl_list_import2
- Function: int gnutls_x509_crl_list_import2 (gnutls_x509_crl_t ** crls, unsigned int * size, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags)
- crls: The structures to store the parsed crl list. Must not be initialized. - size: It will contain the size of the list. - data: The PEM encoded CRL. - format: One of DER or PEM. - flags: must be (0) or an OR’d sequence of gnutls_certificate_import_flags. - This function will convert the given PEM encoded CRL list to the native gnutls_x509_crl_t format. The output will be stored in - crls. They will be automatically initialized.- If the Certificate is PEM encoded it should have a header of "X509 CRL". - Returns: the number of certificates read or a negative error value. - Since: 3.0 
gnutls_x509_crl_print
- Function: int gnutls_x509_crl_print (gnutls_x509_crl_t crl, gnutls_certificate_print_formats_t format, gnutls_datum_t * out)
- crl: The structure to be printed - format: Indicate the format to use - out: Newly allocated datum with (0) terminated string. - This function will pretty print a X.509 certificate revocation list, suitable for display to a human. - The output - outneeds to be deallocated using- gnutls_free().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_set_authority_key_id
- Function: int gnutls_x509_crl_set_authority_key_id (gnutls_x509_crl_t crl, const void * id, size_t id_size)
- crl: a CRL of type - gnutls_x509_crl_t- id: The key ID - id_size: Holds the size of the serial field. - This function will set the CRL’s authority key ID extension. Only the keyIdentifier field can be set with this function. This may be used by an authority that holds multiple private keys, to distinguish the used key. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.8.0 
gnutls_x509_crl_set_crt
- Function: int gnutls_x509_crl_set_crt (gnutls_x509_crl_t crl, gnutls_x509_crt_t crt, time_t revocation_time)
- crl: should contain a gnutls_x509_crl_t structure - crt: a certificate of type - gnutls_x509_crt_twith the revoked certificate- revocation_time: The time this certificate was revoked - This function will set a revoked certificate’s serial number to the CRL. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_set_crt_serial
- Function: int gnutls_x509_crl_set_crt_serial (gnutls_x509_crl_t crl, const void * serial, size_t serial_size, time_t revocation_time)
- crl: should contain a gnutls_x509_crl_t structure - serial: The revoked certificate’s serial number - serial_size: Holds the size of the serial field. - revocation_time: The time this certificate was revoked - This function will set a revoked certificate’s serial number to the CRL. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_set_next_update
- Function: int gnutls_x509_crl_set_next_update (gnutls_x509_crl_t crl, time_t exp_time)
- crl: should contain a gnutls_x509_crl_t structure - exp_time: The actual time - This function will set the time this CRL will be updated. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_set_number
- Function: int gnutls_x509_crl_set_number (gnutls_x509_crl_t crl, const void * nr, size_t nr_size)
- crl: a CRL of type - gnutls_x509_crl_t- nr: The CRL number - nr_size: Holds the size of the nr field. - This function will set the CRL’s number extension. This is to be used as a unique and monotonic number assigned to the CRL by the authority. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.8.0 
gnutls_x509_crl_set_this_update
- Function: int gnutls_x509_crl_set_this_update (gnutls_x509_crl_t crl, time_t act_time)
- crl: should contain a gnutls_x509_crl_t structure - act_time: The actual time - This function will set the time this CRL was issued. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_set_version
- Function: int gnutls_x509_crl_set_version (gnutls_x509_crl_t crl, unsigned int version)
- crl: should contain a gnutls_x509_crl_t structure - version: holds the version number. For CRLv1 crls must be 1. - This function will set the version of the CRL. This must be one for CRL version 1, and so on. The CRLs generated by gnutls should have a version number of 2. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_sign2
- Function: int gnutls_x509_crl_sign2 (gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer, gnutls_x509_privkey_t issuer_key, gnutls_digest_algorithm_t dig, unsigned int flags)
- crl: should contain a gnutls_x509_crl_t structure - issuer: is the certificate of the certificate issuer - issuer_key: holds the issuer’s private key - dig: The message digest to use. GNUTLS_DIG_SHA1 is the safe choice unless you know what you’re doing. - flags: must be 0 - This function will sign the CRL with the issuer’s private key, and will copy the issuer’s information into the CRL. - This must be the last step in a certificate CRL since all the previously set parameters are now signed. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crl_verify
- Function: int gnutls_x509_crl_verify (gnutls_x509_crl_t crl, const gnutls_x509_crt_t * trusted_cas, int tcas_size, unsigned int flags, unsigned int * verify)
- crl: is the crl to be verified - trusted_cas: is a certificate list that is considered to be trusted one - tcas_size: holds the number of CA certificates in CA_list - flags: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations. - verify: will hold the crl verification output. - This function will try to verify the given crl and return its verification status. See - gnutls_x509_crt_list_verify()for a detailed description of return values. Note that since GnuTLS 3.1.4 this function includes the time checks.- Note that value in - verifyis set only when the return value of this function is success (i.e, failure to trust a CRL a certificate does not imply a negative return value).- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_deinit
- Function: void gnutls_x509_crq_deinit (gnutls_x509_crq_t crq)
- crq: The structure to be initialized - This function will deinitialize a PKCS - 10certificate request structure.
gnutls_x509_crq_export
- Function: int gnutls_x509_crq_export (gnutls_x509_crq_t crq, gnutls_x509_crt_fmt_t format, void * output_data, size_t * output_data_size)
- crq: should contain a - gnutls_x509_crq_tstructure- format: the format of output params. One of PEM or DER. - output_data: will contain a certificate request PEM or DER encoded - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will export the certificate request to a PEM or DER encoded PKCS10 structure. - If the buffer provided is not long enough to hold the output, then - GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned and *- output_data_sizewill be updated.- If the structure is PEM encoded, it will have a header of "BEGIN NEW CERTIFICATE REQUEST". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_export2
- Function: int gnutls_x509_crq_export2 (gnutls_x509_crq_t crq, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out)
- crq: should contain a - gnutls_x509_crq_tstructure- format: the format of output params. One of PEM or DER. - out: will contain a certificate request PEM or DER encoded - This function will export the certificate request to a PEM or DER encoded PKCS10 structure. - The output buffer is allocated using - gnutls_malloc().- If the structure is PEM encoded, it will have a header of "BEGIN NEW CERTIFICATE REQUEST". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since 3.1.3 
gnutls_x509_crq_get_attribute_by_oid
- Function: int gnutls_x509_crq_get_attribute_by_oid (gnutls_x509_crq_t crq, const char * oid, int indx, void * buf, size_t * buf_size)
- crq: should contain a - gnutls_x509_crq_tstructure- oid: holds an Object Identifier in null-terminated string - indx: In case multiple same OIDs exist in the attribute list, this specifies which to get, use (0) to get the first one - buf: a pointer to a structure to hold the attribute data (may be - NULL)- buf_size: initially holds the size of - buf- This function will return the attribute in the certificate request specified by the given Object ID. The attribute will be DER encoded. - Attributes in a certificate request is an optional set of data appended to the request. Their interpretation depends on the CA policy. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_get_attribute_data
- Function: int gnutls_x509_crq_get_attribute_data (gnutls_x509_crq_t crq, int indx, void * data, size_t * sizeof_data)
- crq: should contain a - gnutls_x509_crq_tstructure- indx: Specifies which attribute number to get. Use (0) to get the first one. - data: a pointer to a structure to hold the data (may be null) - sizeof_data: initially holds the size of - oid- This function will return the requested attribute data in the certificate request. The attribute data will be stored as a string in the provided buffer. - Use - gnutls_x509_crq_get_attribute_info()to extract the OID. Use- gnutls_x509_crq_get_attribute_by_oid()instead, if you want to get data indexed by the attribute OID rather than sequence.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error. If your have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crq_get_attribute_info
- Function: int gnutls_x509_crq_get_attribute_info (gnutls_x509_crq_t crq, int indx, void * oid, size_t * sizeof_oid)
- crq: should contain a - gnutls_x509_crq_tstructure- indx: Specifies which attribute number to get. Use (0) to get the first one. - oid: a pointer to a structure to hold the OID - sizeof_oid: initially holds the maximum size of - oid, on return holds actual size of- oid.- This function will return the requested attribute OID in the certificate, and the critical flag for it. The attribute OID will be stored as a string in the provided buffer. Use - gnutls_x509_crq_get_attribute_data()to extract the data.- If the buffer provided is not long enough to hold the output, then * - sizeof_oidis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error. If your have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crq_get_basic_constraints
- Function: int gnutls_x509_crq_get_basic_constraints (gnutls_x509_crq_t crq, unsigned int * critical, unsigned int * ca, int * pathlen)
- crq: should contain a - gnutls_x509_crq_tstructure- critical: will be non-zero if the extension is marked as critical - ca: pointer to output integer indicating CA status, may be NULL, value is 1 if the certificate CA flag is set, 0 otherwise. - pathlen: pointer to output integer indicating path length (may be NULL), non-negative error codes indicate a present pathLenConstraint field and the actual value, -1 indicate that the field is absent. - This function will read the certificate’s basic constraints, and return the certificates CA status. It reads the basicConstraints X.509 extension (2.5.29.19). - Returns: If the certificate is a CA a positive value will be returned, or (0) if the certificate does not have CA flag set. A negative error code may be returned in case of errors. If the certificate does not contain the basicConstraints extension - GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crq_get_challenge_password
- Function: int gnutls_x509_crq_get_challenge_password (gnutls_x509_crq_t crq, char * pass, size_t * pass_size)
- crq: should contain a - gnutls_x509_crq_tstructure- pass: will hold a (0)-terminated password string - pass_size: Initially holds the size of - pass.- This function will return the challenge password in the request. The challenge password is intended to be used for requesting a revocation of the certificate. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_get_dn
- Function: int gnutls_x509_crq_get_dn (gnutls_x509_crq_t crq, char * buf, size_t * buf_size)
- crq: should contain a - gnutls_x509_crq_tstructure- buf: a pointer to a structure to hold the name (may be - NULL)- buf_size: initially holds the size of - buf- This function will copy the name of the Certificate request subject to the provided buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC 2253. The output string - bufwill be ASCII or UTF-8 encoded, depending on the certificate data.- Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the *- buf_sizewill be updated with the required size. On success 0 is returned.
gnutls_x509_crq_get_dn2
- Function: int gnutls_x509_crq_get_dn2 (gnutls_x509_crq_t crq, gnutls_datum_t * dn)
- crq: should contain a - gnutls_x509_crq_tstructure- dn: a pointer to a structure to hold the name - This function will allocate buffer and copy the name of the Certificate request. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. and a negative error code on error.- Since: 3.1.10 
gnutls_x509_crq_get_dn_by_oid
- Function: int gnutls_x509_crq_get_dn_by_oid (gnutls_x509_crq_t crq, const char * oid, int indx, unsigned int raw_flag, void * buf, size_t * buf_size)
- crq: should contain a gnutls_x509_crq_t structure - oid: holds an Object Identifier in a null terminated string - indx: In case multiple same OIDs exist in the RDN, this specifies which to get. Use (0) to get the first one. - raw_flag: If non-zero returns the raw DER data of the DN part. - buf: a pointer to a structure to hold the name (may be - NULL)- buf_size: initially holds the size of - buf- This function will extract the part of the name of the Certificate request subject, specified by the given OID. The output will be encoded as described in RFC2253. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. - Some helper macros with popular OIDs can be found in gnutls/x509.h If raw flag is (0), this function will only return known OIDs as text. Other OIDs will be DER encoded, as described in RFC2253 – in hex format with a ’\#’ prefix. You can check about known OIDs using - gnutls_x509_dn_oid_known().- Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the *- buf_sizewill be updated with the required size. On success 0 is returned.
gnutls_x509_crq_get_dn_oid
- Function: int gnutls_x509_crq_get_dn_oid (gnutls_x509_crq_t crq, int indx, void * oid, size_t * sizeof_oid)
- crq: should contain a gnutls_x509_crq_t structure - indx: Specifies which DN OID to get. Use (0) to get the first one. - oid: a pointer to a structure to hold the name (may be - NULL)- sizeof_oid: initially holds the size of - oid- This function will extract the requested OID of the name of the certificate request subject, specified by the given index. - Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the *- sizeof_oidwill be updated with the required size. On success 0 is returned.
gnutls_x509_crq_get_extension_by_oid
- Function: int gnutls_x509_crq_get_extension_by_oid (gnutls_x509_crq_t crq, const char * oid, int indx, void * buf, size_t * buf_size, unsigned int * critical)
- crq: should contain a - gnutls_x509_crq_tstructure- oid: holds an Object Identifier in a null terminated string - indx: In case multiple same OIDs exist in the extensions, this specifies which to get. Use (0) to get the first one. - buf: a pointer to a structure to hold the name (may be null) - buf_size: initially holds the size of - buf- critical: will be non-zero if the extension is marked as critical - This function will return the extension specified by the OID in the certificate. The extensions will be returned as binary data DER encoded, in the provided buffer. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error. If the certificate does not contain the specified extension- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crq_get_extension_data
- Function: int gnutls_x509_crq_get_extension_data (gnutls_x509_crq_t crq, int indx, void * data, size_t * sizeof_data)
- crq: should contain a - gnutls_x509_crq_tstructure- indx: Specifies which extension number to get. Use (0) to get the first one. - data: a pointer to a structure to hold the data (may be null) - sizeof_data: initially holds the size of - oid- This function will return the requested extension data in the certificate. The extension data will be stored as a string in the provided buffer. - Use - gnutls_x509_crq_get_extension_info()to extract the OID and critical flag. Use- gnutls_x509_crq_get_extension_by_oid()instead, if you want to get data indexed by the extension OID rather than sequence.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error. If your have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crq_get_extension_data2
- Function: int gnutls_x509_crq_get_extension_data2 (gnutls_x509_crq_t crq, unsigned indx, gnutls_datum_t * data)
- crq: should contain a - gnutls_x509_crq_tstructure- indx: Specifies which extension OID to read. Use (0) to get the first one. - data: will contain the extension DER-encoded data - This function will return the requested extension data in the certificate request. The extension data will be allocated using - gnutls_malloc().- Use - gnutls_x509_crq_get_extension_info()to extract the OID.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code is returned. If you have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 3.3.0 
gnutls_x509_crq_get_extension_info
- Function: int gnutls_x509_crq_get_extension_info (gnutls_x509_crq_t crq, int indx, void * oid, size_t * sizeof_oid, unsigned int * critical)
- crq: should contain a - gnutls_x509_crq_tstructure- indx: Specifies which extension number to get. Use (0) to get the first one. - oid: a pointer to a structure to hold the OID - sizeof_oid: initially holds the maximum size of - oid, on return holds actual size of- oid.- critical: output variable with critical flag, may be NULL. - This function will return the requested extension OID in the certificate, and the critical flag for it. The extension OID will be stored as a string in the provided buffer. Use - gnutls_x509_crq_get_extension_data()to extract the data.- If the buffer provided is not long enough to hold the output, then * - sizeof_oidis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code in case of an error. If your have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crq_get_key_id
- Function: int gnutls_x509_crq_get_key_id (gnutls_x509_crq_t crq, unsigned int flags, unsigned char * output_data, size_t * output_data_size)
- crq: a certificate of type - gnutls_x509_crq_t- flags: should be 0 for now - output_data: will contain the key ID - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will return a unique ID that depends on the public key parameters. This ID can be used in checking whether a certificate corresponds to the given private key. - If the buffer provided is not long enough to hold the output, then * - output_data_sizeis updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. The output will normally be a SHA-1 hash output, which is 20 bytes.- Returns: In case of failure a negative error code will be returned, and 0 on success. - Since: 2.8.0 
gnutls_x509_crq_get_key_purpose_oid
- Function: int gnutls_x509_crq_get_key_purpose_oid (gnutls_x509_crq_t crq, int indx, void * oid, size_t * sizeof_oid, unsigned int * critical)
- crq: should contain a - gnutls_x509_crq_tstructure- indx: This specifies which OID to return, use (0) to get the first one - oid: a pointer to a buffer to hold the OID (may be - NULL)- sizeof_oid: initially holds the size of - oid- critical: output variable with critical flag, may be - NULL.- This function will extract the key purpose OIDs of the Certificate specified by the given index. These are stored in the Extended Key Usage extension (2.5.29.37). See the GNUTLS_KP_* definitions for human readable names. - Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the *- sizeof_oidwill be updated with the required size. On success 0 is returned.- Since: 2.8.0 
gnutls_x509_crq_get_key_rsa_raw
- Function: int gnutls_x509_crq_get_key_rsa_raw (gnutls_x509_crq_t crq, gnutls_datum_t * m, gnutls_datum_t * e)
- crq: Holds the certificate - m: will hold the modulus - e: will hold the public exponent - This function will export the RSA public key’s parameters found in the given structure. The new parameters will be allocated using - gnutls_malloc()and will be stored in the appropriate datum.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.8.0 
gnutls_x509_crq_get_key_usage
- Function: int gnutls_x509_crq_get_key_usage (gnutls_x509_crq_t crq, unsigned int * key_usage, unsigned int * critical)
- crq: should contain a - gnutls_x509_crq_tstructure- key_usage: where the key usage bits will be stored - critical: will be non-zero if the extension is marked as critical - This function will return certificate’s key usage, by reading the keyUsage X.509 extension (2.5.29.15). The key usage value will ORed values of the: - GNUTLS_KEY_DIGITAL_SIGNATURE,- GNUTLS_KEY_NON_REPUDIATION,- GNUTLS_KEY_KEY_ENCIPHERMENT,- GNUTLS_KEY_DATA_ENCIPHERMENT,- GNUTLS_KEY_KEY_AGREEMENT,- GNUTLS_KEY_KEY_CERT_SIGN,- GNUTLS_KEY_CRL_SIGN,- GNUTLS_KEY_ENCIPHER_ONLY,- GNUTLS_KEY_DECIPHER_ONLY.- Returns: the certificate key usage, or a negative error code in case of parsing error. If the certificate does not contain the keyUsage extension - GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 2.8.0 
gnutls_x509_crq_get_pk_algorithm
- Function: int gnutls_x509_crq_get_pk_algorithm (gnutls_x509_crq_t crq, unsigned int * bits)
- crq: should contain a - gnutls_x509_crq_tstructure- bits: if bits is non- - NULLit will hold the size of the parameters’ in bits- This function will return the public key algorithm of a PKCS - 10certificate request.- If bits is non- - NULL, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.- Returns: a member of the - gnutls_pk_algorithm_tenumeration on success, or a negative error code on error.
gnutls_x509_crq_get_private_key_usage_period
- Function: int gnutls_x509_crq_get_private_key_usage_period (gnutls_x509_crq_t crq, time_t * activation, time_t * expiration, unsigned int * critical)
- crq: should contain a - gnutls_x509_crq_tstructure- activation: The activation time - expiration: The expiration time - critical: the extension status - This function will return the expiration and activation times of the private key of the certificate. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.
gnutls_x509_crq_get_subject_alt_name
- Function: int gnutls_x509_crq_get_subject_alt_name (gnutls_x509_crq_t crq, unsigned int seq, void * ret, size_t * ret_size, unsigned int * ret_type, unsigned int * critical)
- crq: should contain a - gnutls_x509_crq_tstructure- seq: specifies the sequence number of the alt name, 0 for the first one, 1 for the second etc. - ret: is the place where the alternative name will be copied to - ret_size: holds the size of ret. - ret_type: holds the - gnutls_x509_subject_alt_name_tname type- critical: will be non-zero if the extension is marked as critical (may be null) - This function will return the alternative names, contained in the given certificate. It is the same as - gnutls_x509_crq_get_subject_alt_name()except for the fact that it will return the type of the alternative name in- ret_typeeven if the function fails for some reason (i.e. the buffer provided is not enough).- Returns: the alternative subject name type on success, one of the enumerated - gnutls_x509_subject_alt_name_t. It will return- GNUTLS_E_SHORT_MEMORY_BUFFERif- ret_sizeis not large enough to hold the value. In that case- ret_sizewill be updated with the required size. If the certificate request does not have an Alternative name with the specified sequence number then- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.- Since: 2.8.0 
gnutls_x509_crq_get_subject_alt_othername_oid
- Function: int gnutls_x509_crq_get_subject_alt_othername_oid (gnutls_x509_crq_t crq, unsigned int seq, void * ret, size_t * ret_size)
- crq: should contain a - gnutls_x509_crq_tstructure- seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) - ret: is the place where the otherName OID will be copied to - ret_size: holds the size of ret. - This function will extract the type OID of an otherName Subject Alternative Name, contained in the given certificate, and return the type as an enumerated element. - This function is only useful if - gnutls_x509_crq_get_subject_alt_name()returned- GNUTLS_SAN_OTHERNAME.- Returns: the alternative subject name type on success, one of the enumerated gnutls_x509_subject_alt_name_t. For supported OIDs, it will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types, e.g. - GNUTLS_SAN_OTHERNAME_XMPP, and- GNUTLS_SAN_OTHERNAMEfor unknown OIDs. It will return- GNUTLS_E_SHORT_MEMORY_BUFFERif- ret_sizeis not large enough to hold the value. In that case- ret_sizewill be updated with the required size. If the certificate does not have an Alternative name with the specified sequence number and with the otherName type then- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.- Since: 2.8.0 
gnutls_x509_crq_get_version
- Function: int gnutls_x509_crq_get_version (gnutls_x509_crq_t crq)
- crq: should contain a - gnutls_x509_crq_tstructure- This function will return the version of the specified Certificate request. - Returns: version of certificate request, or a negative error code on error. 
gnutls_x509_crq_import
- Function: int gnutls_x509_crq_import (gnutls_x509_crq_t crq, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format)
- crq: The structure to store the parsed certificate request. - data: The DER or PEM encoded certificate. - format: One of DER or PEM - This function will convert the given DER or PEM encoded certificate request to a - gnutls_x509_crq_tstructure. The output will be stored in- crq.- If the Certificate is PEM encoded it should have a header of "NEW CERTIFICATE REQUEST". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_init
- Function: int gnutls_x509_crq_init (gnutls_x509_crq_t * crq)
- crq: The structure to be initialized - This function will initialize a PKCS - 10certificate request structure.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_print
- Function: int gnutls_x509_crq_print (gnutls_x509_crq_t crq, gnutls_certificate_print_formats_t format, gnutls_datum_t * out)
- crq: The structure to be printed - format: Indicate the format to use - out: Newly allocated datum with (0) terminated string. - This function will pretty print a certificate request, suitable for display to a human. - The output - outneeds to be deallocated using- gnutls_free().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.8.0 
gnutls_x509_crq_set_attribute_by_oid
- Function: int gnutls_x509_crq_set_attribute_by_oid (gnutls_x509_crq_t crq, const char * oid, void * buf, size_t buf_size)
- crq: should contain a - gnutls_x509_crq_tstructure- oid: holds an Object Identifier in a null-terminated string - buf: a pointer to a structure that holds the attribute data - buf_size: holds the size of - buf- This function will set the attribute in the certificate request specified by the given Object ID. The provided attribute must be be DER encoded. - Attributes in a certificate request is an optional set of data appended to the request. Their interpretation depends on the CA policy. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_set_basic_constraints
- Function: int gnutls_x509_crq_set_basic_constraints (gnutls_x509_crq_t crq, unsigned int ca, int pathLenConstraint)
- crq: a certificate request of type - gnutls_x509_crq_t- ca: true(1) or false(0) depending on the Certificate authority status. - pathLenConstraint: non-negative error codes indicate maximum length of path, and negative error codes indicate that the pathLenConstraints field should not be present. - This function will set the basicConstraints certificate extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.8.0 
gnutls_x509_crq_set_challenge_password
- Function: int gnutls_x509_crq_set_challenge_password (gnutls_x509_crq_t crq, const char * pass)
- crq: should contain a - gnutls_x509_crq_tstructure- pass: holds a (0)-terminated password - This function will set a challenge password to be used when revoking the request. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_set_dn
- Function: int gnutls_x509_crq_set_dn (gnutls_x509_crq_t crq, const char * dn, const char ** err)
- crq: a certificate of type - gnutls_x509_crq_t- dn: a comma separated DN string (RFC4514) - err: indicates the error position (if any) - This function will set the DN on the provided certificate. The input string should be plain ASCII or UTF-8 encoded. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_set_dn_by_oid
- Function: int gnutls_x509_crq_set_dn_by_oid (gnutls_x509_crq_t crq, const char * oid, unsigned int raw_flag, const void * data, unsigned int sizeof_data)
- crq: should contain a - gnutls_x509_crq_tstructure- oid: holds an Object Identifier in a (0)-terminated string - raw_flag: must be 0, or 1 if the data are DER encoded - data: a pointer to the input data - sizeof_data: holds the size of - data- This function will set the part of the name of the Certificate request subject, specified by the given OID. The input string should be ASCII or UTF-8 encoded. - Some helper macros with popular OIDs can be found in gnutls/x509.h With this function you can only set the known OIDs. You can test for known OIDs using - gnutls_x509_dn_oid_known(). For OIDs that are not known (by gnutls) you should properly DER encode your data, and call this function with raw_flag set.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_set_key
- Function: int gnutls_x509_crq_set_key (gnutls_x509_crq_t crq, gnutls_x509_privkey_t key)
- crq: should contain a - gnutls_x509_crq_tstructure- key: holds a private key - This function will set the public parameters from the given private key to the request. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_set_key_purpose_oid
- Function: int gnutls_x509_crq_set_key_purpose_oid (gnutls_x509_crq_t crq, const void * oid, unsigned int critical)
- crq: a certificate of type - gnutls_x509_crq_t- oid: a pointer to a (0)-terminated string that holds the OID - critical: Whether this extension will be critical or not - This function will set the key purpose OIDs of the Certificate. These are stored in the Extended Key Usage extension (2.5.29.37) See the GNUTLS_KP_* definitions for human readable names. - Subsequent calls to this function will append OIDs to the OID list. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.8.0 
gnutls_x509_crq_set_key_rsa_raw
- Function: int gnutls_x509_crq_set_key_rsa_raw (gnutls_x509_crq_t crq, const gnutls_datum_t * m, const gnutls_datum_t * e)
- crq: should contain a - gnutls_x509_crq_tstructure- m: holds the modulus - e: holds the public exponent - This function will set the public parameters from the given private key to the request. Only RSA keys are currently supported. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.6.0 
gnutls_x509_crq_set_key_usage
- Function: int gnutls_x509_crq_set_key_usage (gnutls_x509_crq_t crq, unsigned int usage)
- crq: a certificate request of type - gnutls_x509_crq_t- usage: an ORed sequence of the GNUTLS_KEY_* elements. - This function will set the keyUsage certificate extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.8.0 
gnutls_x509_crq_set_private_key_usage_period
- Function: int gnutls_x509_crq_set_private_key_usage_period (gnutls_x509_crq_t crq, time_t activation, time_t expiration)
- crq: a certificate of type - gnutls_x509_crq_t- activation: The activation time - expiration: The expiration time - This function will set the private key usage period extension (2.5.29.16). - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_set_subject_alt_name
- Function: int gnutls_x509_crq_set_subject_alt_name (gnutls_x509_crq_t crq, gnutls_x509_subject_alt_name_t nt, const void * data, unsigned int data_size, unsigned int flags)
- crq: a certificate request of type - gnutls_x509_crq_t- nt: is one of the - gnutls_x509_subject_alt_name_tenumerations- data: The data to be set - data_size: The size of data to be set - flags: - GNUTLS_FSAN_SETto clear previous data or- GNUTLS_FSAN_APPENDto append.- This function will set the subject alternative name certificate extension. It can set the following types: - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.8.0 
gnutls_x509_crq_set_version
- Function: int gnutls_x509_crq_set_version (gnutls_x509_crq_t crq, unsigned int version)
- crq: should contain a - gnutls_x509_crq_tstructure- version: holds the version number, for v1 Requests must be 1 - This function will set the version of the certificate request. For version 1 requests this must be one. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crq_sign2
- Function: int gnutls_x509_crq_sign2 (gnutls_x509_crq_t crq, gnutls_x509_privkey_t key, gnutls_digest_algorithm_t dig, unsigned int flags)
- crq: should contain a - gnutls_x509_crq_tstructure- key: holds a private key - dig: The message digest to use, i.e., - GNUTLS_DIG_SHA1- flags: must be 0 - This function will sign the certificate request with a private key. This must be the same key as the one used in - gnutls_x509_crt_set_key()since a certificate request is self signed.- This must be the last step in a certificate request generation since all the previously set parameters are now signed. - Returns: - GNUTLS_E_SUCCESSon success, otherwise a negative error code.- GNUTLS_E_ASN1_VALUE_NOT_FOUNDis returned if you didn’t set all information in the certificate request (e.g., the version using- gnutls_x509_crq_set_version()).
gnutls_x509_crq_verify
- Function: int gnutls_x509_crq_verify (gnutls_x509_crq_t crq, unsigned int flags)
- crq: is the crq to be verified - flags: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations. - This function will verify self signature in the certificate request and return its status. - Returns: In case of a verification failure - GNUTLS_E_PK_SIG_VERIFY_FAILEDis returned, and zero or positive code on success.- Since 2.12.0 
gnutls_x509_crt_check_hostname
- Function: int gnutls_x509_crt_check_hostname (gnutls_x509_crt_t cert, const char * hostname)
- cert: should contain an gnutls_x509_crt_t structure - hostname: A null terminated string that contains a DNS name - This function will check if the given certificate’s subject matches the given hostname. This is a basic implementation of the matching described in RFC2818 (HTTPS), which takes into account wildcards, and the DNSName/IPAddress subject alternative name PKIX extension. - The comparison may have false-negatives as it is done byte by byte in non-ascii names. - Wildcards are only considered if the domain name consists of three components or more, and the wildcard starts at the leftmost position. - Returns: non-zero for a successful match, and zero on failure. 
gnutls_x509_crt_check_hostname2
- Function: int gnutls_x509_crt_check_hostname2 (gnutls_x509_crt_t cert, const char * hostname, unsigned int flags)
- cert: should contain an gnutls_x509_crt_t structure - hostname: A null terminated string that contains a DNS name - flags: gnutls_certificate_verify_flags - This function will check if the given certificate’s subject matches the given hostname. This is a basic implementation of the matching described in RFC2818 (HTTPS), which takes into account wildcards, and the DNSName/IPAddress subject alternative name PKIX extension. - The comparison may have false-negatives as it is done byte by byte in non-ascii names. - When the flag - GNUTLS_VERIFY_DO_NOT_ALLOW_WILDCARDSis specified no wildcards are considered. Otherwise they are only considered if the domain name consists of three components or more, and the wildcard starts at the leftmost position.- Returns: non-zero for a successful match, and zero on failure. 
gnutls_x509_crt_check_issuer
- Function: int gnutls_x509_crt_check_issuer (gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer)
- cert: is the certificate to be checked - issuer: is the certificate of a possible issuer - This function will check if the given certificate was issued by the given issuer. It checks the DN fields and the authority key identifier and subject key identifier fields match. - Returns: It will return true (1) if the given certificate is issued by the given issuer, and false (0) if not. 
gnutls_x509_crt_check_revocation
- Function: int gnutls_x509_crt_check_revocation (gnutls_x509_crt_t cert, const gnutls_x509_crl_t * crl_list, int crl_list_length)
- cert: should contain a - gnutls_x509_crt_tstructure- crl_list: should contain a list of gnutls_x509_crl_t structures - crl_list_length: the length of the crl_list - This function will return check if the given certificate is revoked. It is assumed that the CRLs have been verified before. - Returns: 0 if the certificate is NOT revoked, and 1 if it is. A negative error code is returned on error. 
gnutls_x509_crt_cpy_crl_dist_points
- Function: int gnutls_x509_crt_cpy_crl_dist_points (gnutls_x509_crt_t dst, gnutls_x509_crt_t src)
- dst: a certificate of type - gnutls_x509_crt_t- src: the certificate where the dist points will be copied from - This function will copy the CRL distribution points certificate extension, from the source to the destination certificate. This may be useful to copy from a CA certificate to issued ones. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_deinit
- Function: void gnutls_x509_crt_deinit (gnutls_x509_crt_t cert)
- cert: The structure to be deinitialized - This function will deinitialize a certificate structure. 
gnutls_x509_crt_export
- Function: int gnutls_x509_crt_export (gnutls_x509_crt_t cert, gnutls_x509_crt_fmt_t format, void * output_data, size_t * output_data_size)
- cert: Holds the certificate - format: the format of output params. One of PEM or DER. - output_data: will contain a certificate PEM or DER encoded - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will export the certificate to DER or PEM format. - If the buffer provided is not long enough to hold the output, then *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. - If the structure is PEM encoded, it will have a header of "BEGIN CERTIFICATE". - Returns: In case of failure a negative error code will be returned, and 0 on success. 
gnutls_x509_crt_export2
- Function: int gnutls_x509_crt_export2 (gnutls_x509_crt_t cert, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out)
- cert: Holds the certificate - format: the format of output params. One of PEM or DER. - out: will contain a certificate PEM or DER encoded - This function will export the certificate to DER or PEM format. The output buffer is allocated using - gnutls_malloc().- If the structure is PEM encoded, it will have a header of "BEGIN CERTIFICATE". - Returns: In case of failure a negative error code will be returned, and 0 on success. - Since: 3.1.3 
gnutls_x509_crt_get_activation_time
- Function: time_t gnutls_x509_crt_get_activation_time (gnutls_x509_crt_t cert)
- cert: should contain a - gnutls_x509_crt_tstructure- This function will return the time this Certificate was or will be activated. - Returns: activation time, or (time_t)-1 on error. 
gnutls_x509_crt_get_authority_info_access
- Function: int gnutls_x509_crt_get_authority_info_access (gnutls_x509_crt_t crt, unsigned int seq, int what, gnutls_datum_t * data, unsigned int * critical)
- crt: Holds the certificate - seq: specifies the sequence number of the access descriptor (0 for the first one, 1 for the second etc.) - what: what data to get, a - gnutls_info_access_what_ttype.- data: output data to be freed with - gnutls_free().- critical: pointer to output integer that is set to non-0 if the extension is marked as critical (may be - NULL)- Note that a simpler API to access the authority info data is provided by - gnutls_x509_aia_get()and- gnutls_x509_ext_import_aia().- This function extracts the Authority Information Access (AIA) extension, see RFC 5280 section 4.2.2.1 for more information. The AIA extension holds a sequence of AccessDescription (AD) data. - The - seqinput parameter is used to indicate which member of the sequence the caller is interested in. The first member is 0, the second member 1 and so on. When the- seqvalue is out of bounds,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.- The type of data returned in - datais specified via- whatwhich should be- gnutls_info_access_what_tvalues.- If - whatis- GNUTLS_IA_ACCESSMETHOD_OIDthen- datawill hold the accessMethod OID (e.g., "1.3.6.1.5.5.7.48.1").- If - whatis- GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE,- datawill hold the accessLocation GeneralName type (e.g., "uniformResourceIdentifier").- If - whatis- GNUTLS_IA_URI,- datawill hold the accessLocation URI data. Requesting this- whatvalue leads to an error if the accessLocation is not of the "uniformResourceIdentifier" type.- If - whatis- GNUTLS_IA_OCSP_URI,- datawill hold the OCSP URI. Requesting this- whatvalue leads to an error if the accessMethod is not 1.3.6.1.5.5.7.48.1 aka OSCP, or if accessLocation is not of the "uniformResourceIdentifier" type.- If - whatis- GNUTLS_IA_CAISSUERS_URI,- datawill hold the caIssuers URI. Requesting this- whatvalue leads to an error if the accessMethod is not 1.3.6.1.5.5.7.48.2 aka caIssuers, or if accessLocation is not of the "uniformResourceIdentifier" type.- More - whatvalues may be allocated in the future as needed.- If - datais NULL, the function does the same without storing the output data, that is, it will set- criticaland do error checking as usual.- The value of the critical flag is returned in * - critical. Supply a NULL- criticalif you want the function to make sure the extension is non-critical, as required by RFC 5280.- Returns: - GNUTLS_E_SUCCESSon success,- GNUTLS_E_INVALID_REQUESTon invalid- crt,- GNUTLS_E_CONSTRAINT_ERRORif the extension is incorrectly marked as critical (use a non-NULL- criticalto override),- GNUTLS_E_UNKNOWN_ALGORITHMif the requested OID does not match (e.g., when using- GNUTLS_IA_OCSP_URI), otherwise a negative error code.- Since: 3.0 
gnutls_x509_crt_get_authority_key_gn_serial
- Function: int gnutls_x509_crt_get_authority_key_gn_serial (gnutls_x509_crt_t cert, unsigned int seq, void * alt, size_t * alt_size, unsigned int * alt_type, void * serial, size_t * serial_size, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) - alt: is the place where the alternative name will be copied to - alt_size: holds the size of alt. - alt_type: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t). - serial: buffer to store the serial number (may be null) - serial_size: Holds the size of the serial field (may be null) - critical: will be non-zero if the extension is marked as critical (may be null) - This function will return the X.509 authority key identifier when stored as a general name (authorityCertIssuer) and serial number. - Because more than one general names might be stored - seqcan be used as a counter to request them all until- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.- Since: 3.0 
gnutls_x509_crt_get_authority_key_id
- Function: int gnutls_x509_crt_get_authority_key_id (gnutls_x509_crt_t cert, void * id, size_t * id_size, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- id: The place where the identifier will be copied - id_size: Holds the size of the id field. - critical: will be non-zero if the extension is marked as critical (may be null) - This function will return the X.509v3 certificate authority’s key identifier. This is obtained by the X.509 Authority Key identifier extension field (2.5.29.35). Note that this function only returns the keyIdentifier field of the extension and - GNUTLS_E_X509_UNSUPPORTED_EXTENSION, if the extension contains the name and serial number of the certificate. In that case- gnutls_x509_crt_get_authority_key_gn_serial()may be used.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.
gnutls_x509_crt_get_basic_constraints
- Function: int gnutls_x509_crt_get_basic_constraints (gnutls_x509_crt_t cert, unsigned int * critical, unsigned int * ca, int * pathlen)
- cert: should contain a - gnutls_x509_crt_tstructure- critical: will be non-zero if the extension is marked as critical - ca: pointer to output integer indicating CA status, may be NULL, value is 1 if the certificate CA flag is set, 0 otherwise. - pathlen: pointer to output integer indicating path length (may be NULL), non-negative error codes indicate a present pathLenConstraint field and the actual value, -1 indicate that the field is absent. - This function will read the certificate’s basic constraints, and return the certificates CA status. It reads the basicConstraints X.509 extension (2.5.29.19). - Returns: If the certificate is a CA a positive value will be returned, or (0) if the certificate does not have CA flag set. A negative error code may be returned in case of errors. If the certificate does not contain the basicConstraints extension GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. 
gnutls_x509_crt_get_ca_status
- Function: int gnutls_x509_crt_get_ca_status (gnutls_x509_crt_t cert, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- critical: will be non-zero if the extension is marked as critical - This function will return certificates CA status, by reading the basicConstraints X.509 extension (2.5.29.19). If the certificate is a CA a positive value will be returned, or (0) if the certificate does not have CA flag set. - Use - gnutls_x509_crt_get_basic_constraints()if you want to read the pathLenConstraint field too.- Returns: A negative error code may be returned in case of parsing error. If the certificate does not contain the basicConstraints extension - GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.
gnutls_x509_crt_get_crl_dist_points
- Function: int gnutls_x509_crt_get_crl_dist_points (gnutls_x509_crt_t cert, unsigned int seq, void * san, size_t * san_size, unsigned int * reason_flags, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- seq: specifies the sequence number of the distribution point (0 for the first one, 1 for the second etc.) - san: is the place where the distribution point will be copied to - san_size: holds the size of ret. - reason_flags: Revocation reasons. An ORed sequence of flags from - gnutls_x509_crl_reason_flags_t.- critical: will be non-zero if the extension is marked as critical (may be null) - This function retrieves the CRL distribution points (2.5.29.31), contained in the given certificate in the X509v3 Certificate Extensions. - Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERand updates- ret_sizeif- ret_sizeis not enough to hold the distribution point, or the type of the distribution point if everything was ok. The type is one of the enumerated- gnutls_x509_subject_alt_name_t. If the certificate does not have an Alternative name with the specified sequence number then- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.
gnutls_x509_crt_get_dn
- Function: int gnutls_x509_crt_get_dn (gnutls_x509_crt_t cert, char * buf, size_t * buf_size)
- cert: should contain a - gnutls_x509_crt_tstructure- buf: a pointer to a structure to hold the name (may be null) - buf_size: initially holds the size of - buf- This function will copy the name of the Certificate in the provided buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. - If - bufis null then only the size will be filled.- Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the- buf_sizewill be updated with the required size. On success 0 is returned.
gnutls_x509_crt_get_dn2
- Function: int gnutls_x509_crt_get_dn2 (gnutls_x509_crt_t cert, gnutls_datum_t * dn)
- cert: should contain a - gnutls_x509_crt_tstructure- dn: a pointer to a structure to hold the name - This function will allocate buffer and copy the name of the Certificate. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. and a negative error code on error.- Since: 3.1.10 
gnutls_x509_crt_get_dn_by_oid
- Function: int gnutls_x509_crt_get_dn_by_oid (gnutls_x509_crt_t cert, const char * oid, int indx, unsigned int raw_flag, void * buf, size_t * buf_size)
- cert: should contain a - gnutls_x509_crt_tstructure- oid: holds an Object Identified in null terminated string - indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use (0) to get the first one. - raw_flag: If non-zero returns the raw DER data of the DN part. - buf: a pointer where the DN part will be copied (may be null). - buf_size: initially holds the size of - buf- This function will extract the part of the name of the Certificate subject specified by the given OID. The output, if the raw flag is not used, will be encoded as described in RFC4514. Thus a string that is ASCII or UTF-8 encoded, depending on the certificate data. - Some helper macros with popular OIDs can be found in gnutls/x509.h If raw flag is (0), this function will only return known OIDs as text. Other OIDs will be DER encoded, as described in RFC4514 – in hex format with a ’#’ prefix. You can check about known OIDs using - gnutls_x509_dn_oid_known().- If - bufis null then only the size will be filled. If the- raw_flagis not specified the output is always null terminated, although the- buf_sizewill not include the null character.- Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the- buf_sizewill be updated with the required size.- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif there are no data in the current index. On success 0 is returned.
gnutls_x509_crt_get_dn_oid
- Function: int gnutls_x509_crt_get_dn_oid (gnutls_x509_crt_t cert, int indx, void * oid, size_t * oid_size)
- cert: should contain a - gnutls_x509_crt_tstructure- indx: This specifies which OID to return. Use (0) to get the first one. - oid: a pointer to a buffer to hold the OID (may be null) - oid_size: initially holds the size of - oid- This function will extract the OIDs of the name of the Certificate subject specified by the given index. - If - oidis null then only the size will be filled. The- oidreturned will be null terminated, although- oid_sizewill not account for the trailing null.- Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the- buf_sizewill be updated with the required size.- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif there are no data in the current index. On success 0 is returned.
gnutls_x509_crt_get_expiration_time
- Function: time_t gnutls_x509_crt_get_expiration_time (gnutls_x509_crt_t cert)
- cert: should contain a - gnutls_x509_crt_tstructure- This function will return the time this Certificate was or will be expired. - The no well defined expiration time can be checked against with the - GNUTLS_X509_NO_WELL_DEFINED_EXPIRATIONmacro.- Returns: expiration time, or (time_t)-1 on error. 
gnutls_x509_crt_get_extension_by_oid
- Function: int gnutls_x509_crt_get_extension_by_oid (gnutls_x509_crt_t cert, const char * oid, int indx, void * buf, size_t * buf_size, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- oid: holds an Object Identified in null terminated string - indx: In case multiple same OIDs exist in the extensions, this specifies which to send. Use (0) to get the first one. - buf: a pointer to a structure to hold the name (may be null) - buf_size: initially holds the size of - buf- critical: will be non-zero if the extension is marked as critical - This function will return the extension specified by the OID in the certificate. The extensions will be returned as binary data DER encoded, in the provided buffer. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code is returned. If the certificate does not contain the specified extension GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
gnutls_x509_crt_get_extension_data
- Function: int gnutls_x509_crt_get_extension_data (gnutls_x509_crt_t cert, int indx, void * data, size_t * sizeof_data)
- cert: should contain a - gnutls_x509_crt_tstructure- indx: Specifies which extension OID to send. Use (0) to get the first one. - data: a pointer to a structure to hold the data (may be null) - sizeof_data: initially holds the size of - data- This function will return the requested extension data in the certificate. The extension data will be stored in the provided buffer. - Use - gnutls_x509_crt_get_extension_info()to extract the OID and critical flag. Use- gnutls_x509_crt_get_extension_by_oid()instead, if you want to get data indexed by the extension OID rather than sequence.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code is returned. If you have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.
gnutls_x509_crt_get_extension_data2
- Function: int gnutls_x509_crt_get_extension_data2 (gnutls_x509_crt_t cert, unsigned indx, gnutls_datum_t * data)
- cert: should contain a - gnutls_x509_crt_tstructure- indx: Specifies which extension OID to read. Use (0) to get the first one. - data: will contain the extension DER-encoded data - This function will return the requested by the index extension data in the certificate. The extension data will be allocated using - gnutls_malloc().- Use - gnutls_x509_crt_get_extension_info()to extract the OID.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code is returned. If you have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.
gnutls_x509_crt_get_extension_info
- Function: int gnutls_x509_crt_get_extension_info (gnutls_x509_crt_t cert, int indx, void * oid, size_t * oid_size, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- indx: Specifies which extension OID to send. Use (0) to get the first one. - oid: a pointer to a structure to hold the OID - oid_size: initially holds the maximum size of - oid, on return holds actual size of- oid.- critical: output variable with critical flag, may be NULL. - This function will return the requested extension OID in the certificate, and the critical flag for it. The extension OID will be stored as a string in the provided buffer. Use - gnutls_x509_crt_get_extension()to extract the data.- If the buffer provided is not long enough to hold the output, then - oid_sizeis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned. The- oidreturned will be null terminated, although- oid_sizewill not account for the trailing null.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code is returned. If you have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.
gnutls_x509_crt_get_extension_oid
- Function: int gnutls_x509_crt_get_extension_oid (gnutls_x509_crt_t cert, int indx, void * oid, size_t * oid_size)
- cert: should contain a - gnutls_x509_crt_tstructure- indx: Specifies which extension OID to send. Use (0) to get the first one. - oid: a pointer to a structure to hold the OID (may be null) - oid_size: initially holds the size of - oid- This function will return the requested extension OID in the certificate. The extension OID will be stored as a string in the provided buffer. - The - oidreturned will be null terminated, although- oid_sizewill not account for the trailing null.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code is returned. If you have reached the last extension available- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.
gnutls_x509_crt_get_fingerprint
- Function: int gnutls_x509_crt_get_fingerprint (gnutls_x509_crt_t cert, gnutls_digest_algorithm_t algo, void * buf, size_t * buf_size)
- cert: should contain a - gnutls_x509_crt_tstructure- algo: is a digest algorithm - buf: a pointer to a structure to hold the fingerprint (may be null) - buf_size: initially holds the size of - buf- This function will calculate and copy the certificate’s fingerprint in the provided buffer. The fingerprint is a hash of the DER-encoded data of the certificate. - If the buffer is null then only the size will be filled. - Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the *buf_size will be updated with the required size. On success 0 is returned.
gnutls_x509_crt_get_issuer
- Function: int gnutls_x509_crt_get_issuer (gnutls_x509_crt_t cert, gnutls_x509_dn_t * dn)
- cert: should contain a - gnutls_x509_crt_tstructure- dn: output variable with pointer to uint8_t DN - Return the Certificate’s Issuer DN as a - gnutls_x509_dn_tdata type, that can be decoded using- gnutls_x509_dn_get_rdn_ava().- Note that - dnshould be treated as constant. Because it points into the- certobject, you should not use- dnafter- certis deallocated.- Returns: Returns 0 on success, or an error code. 
gnutls_x509_crt_get_issuer_alt_name
- Function: int gnutls_x509_crt_get_issuer_alt_name (gnutls_x509_crt_t cert, unsigned int seq, void * ian, size_t * ian_size, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) - ian: is the place where the alternative name will be copied to - ian_size: holds the size of ian. - critical: will be non-zero if the extension is marked as critical (may be null) - This function retrieves the Issuer Alternative Name (2.5.29.18), contained in the given certificate in the X509v3 Certificate Extensions. - When the SAN type is otherName, it will extract the data in the otherName’s value field, and - GNUTLS_SAN_OTHERNAMEis returned. You may use- gnutls_x509_crt_get_subject_alt_othername_oid()to get the corresponding OID and the "virtual" SAN types (e.g.,- GNUTLS_SAN_OTHERNAME_XMPP).- If an otherName OID is known, the data will be decoded. Otherwise the returned data will be DER encoded, and you will have to decode it yourself. Currently, only the RFC 3920 id-on-xmppAddr Issuer AltName is recognized. - Returns: the alternative issuer name type on success, one of the enumerated - gnutls_x509_subject_alt_name_t. It will return- GNUTLS_E_SHORT_MEMORY_BUFFERif- ian_sizeis not large enough to hold the value. In that case- ian_sizewill be updated with the required size. If the certificate does not have an Alternative name with the specified sequence number then- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.- Since: 2.10.0 
gnutls_x509_crt_get_issuer_alt_name2
- Function: int gnutls_x509_crt_get_issuer_alt_name2 (gnutls_x509_crt_t cert, unsigned int seq, void * ian, size_t * ian_size, unsigned int * ian_type, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) - ian: is the place where the alternative name will be copied to - ian_size: holds the size of ret. - ian_type: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t). - critical: will be non-zero if the extension is marked as critical (may be null) - This function will return the alternative names, contained in the given certificate. It is the same as - gnutls_x509_crt_get_issuer_alt_name()except for the fact that it will return the type of the alternative name in- ian_typeeven if the function fails for some reason (i.e. the buffer provided is not enough).- Returns: the alternative issuer name type on success, one of the enumerated - gnutls_x509_subject_alt_name_t. It will return- GNUTLS_E_SHORT_MEMORY_BUFFERif- ian_sizeis not large enough to hold the value. In that case- ian_sizewill be updated with the required size. If the certificate does not have an Alternative name with the specified sequence number then- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.- Since: 2.10.0 
gnutls_x509_crt_get_issuer_alt_othername_oid
- Function: int gnutls_x509_crt_get_issuer_alt_othername_oid (gnutls_x509_crt_t cert, unsigned int seq, void * ret, size_t * ret_size)
- cert: should contain a - gnutls_x509_crt_tstructure- seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) - ret: is the place where the otherName OID will be copied to - ret_size: holds the size of ret. - This function will extract the type OID of an otherName Subject Alternative Name, contained in the given certificate, and return the type as an enumerated element. - If - oidis null then only the size will be filled. The- oidreturned will be null terminated, although- oid_sizewill not account for the trailing null.- This function is only useful if - gnutls_x509_crt_get_issuer_alt_name()returned- GNUTLS_SAN_OTHERNAME.- Returns: the alternative issuer name type on success, one of the enumerated gnutls_x509_subject_alt_name_t. For supported OIDs, it will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types, e.g. - GNUTLS_SAN_OTHERNAME_XMPP, and- GNUTLS_SAN_OTHERNAMEfor unknown OIDs. It will return- GNUTLS_E_SHORT_MEMORY_BUFFERif- ret_sizeis not large enough to hold the value. In that case- ret_sizewill be updated with the required size. If the certificate does not have an Alternative name with the specified sequence number and with the otherName type then- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.- Since: 2.10.0 
gnutls_x509_crt_get_issuer_dn
- Function: int gnutls_x509_crt_get_issuer_dn (gnutls_x509_crt_t cert, char * buf, size_t * buf_size)
- cert: should contain a - gnutls_x509_crt_tstructure- buf: a pointer to a structure to hold the name (may be null) - buf_size: initially holds the size of - buf- This function will copy the name of the Certificate issuer in the provided buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. - If - bufis null then only the size will be filled.- Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the - buf_sizewill be updated with the required size. On success 0 is returned.
gnutls_x509_crt_get_issuer_dn2
- Function: int gnutls_x509_crt_get_issuer_dn2 (gnutls_x509_crt_t cert, gnutls_datum_t * dn)
- cert: should contain a - gnutls_x509_crt_tstructure- dn: a pointer to a structure to hold the name - This function will allocate buffer and copy the name of issuer of the Certificate. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. and a negative error code on error.- Since: 3.1.10 
gnutls_x509_crt_get_issuer_dn_by_oid
- Function: int gnutls_x509_crt_get_issuer_dn_by_oid (gnutls_x509_crt_t cert, const char * oid, int indx, unsigned int raw_flag, void * buf, size_t * buf_size)
- cert: should contain a - gnutls_x509_crt_tstructure- oid: holds an Object Identified in null terminated string - indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use (0) to get the first one. - raw_flag: If non-zero returns the raw DER data of the DN part. - buf: a pointer to a structure to hold the name (may be null) - buf_size: initially holds the size of - buf- This function will extract the part of the name of the Certificate issuer specified by the given OID. The output, if the raw flag is not used, will be encoded as described in RFC4514. Thus a string that is ASCII or UTF-8 encoded, depending on the certificate data. - Some helper macros with popular OIDs can be found in gnutls/x509.h If raw flag is (0), this function will only return known OIDs as text. Other OIDs will be DER encoded, as described in RFC4514 – in hex format with a ’#’ prefix. You can check about known OIDs using - gnutls_x509_dn_oid_known().- If - bufis null then only the size will be filled. If the- raw_flagis not specified the output is always null terminated, although the- buf_sizewill not include the null character.- Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the- buf_sizewill be updated with the required size.- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif there are no data in the current index. On success 0 is returned.
gnutls_x509_crt_get_issuer_dn_oid
- Function: int gnutls_x509_crt_get_issuer_dn_oid (gnutls_x509_crt_t cert, int indx, void * oid, size_t * oid_size)
- cert: should contain a - gnutls_x509_crt_tstructure- indx: This specifies which OID to return. Use (0) to get the first one. - oid: a pointer to a buffer to hold the OID (may be null) - oid_size: initially holds the size of - oid- This function will extract the OIDs of the name of the Certificate issuer specified by the given index. - If - oidis null then only the size will be filled. The- oidreturned will be null terminated, although- oid_sizewill not account for the trailing null.- Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the- buf_sizewill be updated with the required size.- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif there are no data in the current index. On success 0 is returned.
gnutls_x509_crt_get_issuer_unique_id
- Function: int gnutls_x509_crt_get_issuer_unique_id (gnutls_x509_crt_t crt, char * buf, size_t * buf_size)
- crt: Holds the certificate - buf: user allocated memory buffer, will hold the unique id - buf_size: size of user allocated memory buffer (on input), will hold actual size of the unique ID on return. - This function will extract the issuerUniqueID value (if present) for the given certificate. - If the user allocated memory buffer is not large enough to hold the full subjectUniqueID, then a GNUTLS_E_SHORT_MEMORY_BUFFER error will be returned, and buf_size will be set to the actual length. - Returns: - GNUTLS_E_SUCCESSon success, otherwise a negative error code.- Since: 2.12.0 
gnutls_x509_crt_get_key_id
- Function: int gnutls_x509_crt_get_key_id (gnutls_x509_crt_t crt, unsigned int flags, unsigned char * output_data, size_t * output_data_size)
- crt: Holds the certificate - flags: should be 0 for now - output_data: will contain the key ID - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will return a unique ID that depends on the public key parameters. This ID can be used in checking whether a certificate corresponds to the given private key. - If the buffer provided is not long enough to hold the output, then *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. The output will normally be a SHA-1 hash output, which is 20 bytes. - Returns: In case of failure a negative error code will be returned, and 0 on success. 
gnutls_x509_crt_get_key_purpose_oid
- Function: int gnutls_x509_crt_get_key_purpose_oid (gnutls_x509_crt_t cert, int indx, void * oid, size_t * oid_size, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- indx: This specifies which OID to return. Use (0) to get the first one. - oid: a pointer to a buffer to hold the OID (may be null) - oid_size: initially holds the size of - oid- critical: output flag to indicate criticality of extension - This function will extract the key purpose OIDs of the Certificate specified by the given index. These are stored in the Extended Key Usage extension (2.5.29.37) See the GNUTLS_KP_* definitions for human readable names. - If - oidis null then only the size will be filled. The- oidreturned will be null terminated, although- oid_sizewill not account for the trailing null.- Returns: - GNUTLS_E_SHORT_MEMORY_BUFFERif the provided buffer is not long enough, and in that case the *oid_size will be updated with the required size. On success 0 is returned.
gnutls_x509_crt_get_key_usage
- Function: int gnutls_x509_crt_get_key_usage (gnutls_x509_crt_t cert, unsigned int * key_usage, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- key_usage: where the key usage bits will be stored - critical: will be non-zero if the extension is marked as critical - This function will return certificate’s key usage, by reading the keyUsage X.509 extension (2.5.29.15). The key usage value will ORed values of the: - GNUTLS_KEY_DIGITAL_SIGNATURE,- GNUTLS_KEY_NON_REPUDIATION,- GNUTLS_KEY_KEY_ENCIPHERMENT,- GNUTLS_KEY_DATA_ENCIPHERMENT,- GNUTLS_KEY_KEY_AGREEMENT,- GNUTLS_KEY_KEY_CERT_SIGN,- GNUTLS_KEY_CRL_SIGN,- GNUTLS_KEY_ENCIPHER_ONLY,- GNUTLS_KEY_DECIPHER_ONLY.- Returns: the certificate key usage, or a negative error code in case of parsing error. If the certificate does not contain the keyUsage extension - GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.
gnutls_x509_crt_get_name_constraints
- Function: int gnutls_x509_crt_get_name_constraints (gnutls_x509_crt_t crt, gnutls_x509_name_constraints_t nc, unsigned int flags, unsigned int * critical)
- crt: should contain a - gnutls_x509_crt_tstructure- nc: The nameconstraints intermediate structure - flags: zero or - GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND- critical: the extension status - This function will return an intermediate structure containing the name constraints of the provided CA certificate. That structure can be used in combination with - gnutls_x509_name_constraints_check()to verify whether a server’s name is in accordance with the constraints.- When the - flagsis set to- GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND, then if the- ncstructure is empty this function will behave identically as if the flag was not set. Otherwise if there are elements in the- ncstructure then only the excluded constraints will be appended to the constraints.- Note that - ncmust be initialized prior to calling this function.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_crt_get_pk_algorithm
- Function: int gnutls_x509_crt_get_pk_algorithm (gnutls_x509_crt_t cert, unsigned int * bits)
- cert: should contain a - gnutls_x509_crt_tstructure- bits: if bits is non null it will hold the size of the parameters’ in bits - This function will return the public key algorithm of an X.509 certificate. - If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent. - Returns: a member of the - gnutls_pk_algorithm_tenumeration on success, or a negative error code on error.
gnutls_x509_crt_get_pk_dsa_raw
- Function: int gnutls_x509_crt_get_pk_dsa_raw (gnutls_x509_crt_t crt, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y)
- crt: Holds the certificate - p: will hold the p - q: will hold the q - g: will hold the g - y: will hold the y - This function will export the DSA public key’s parameters found in the given certificate. The new parameters will be allocated using - gnutls_malloc()and will be stored in the appropriate datum.- Returns: - GNUTLS_E_SUCCESSon success, otherwise a negative error code.
gnutls_x509_crt_get_pk_rsa_raw
- Function: int gnutls_x509_crt_get_pk_rsa_raw (gnutls_x509_crt_t crt, gnutls_datum_t * m, gnutls_datum_t * e)
- crt: Holds the certificate - m: will hold the modulus - e: will hold the public exponent - This function will export the RSA public key’s parameters found in the given structure. The new parameters will be allocated using - gnutls_malloc()and will be stored in the appropriate datum.- Returns: - GNUTLS_E_SUCCESSon success, otherwise a negative error code.
gnutls_x509_crt_get_policy
- Function: int gnutls_x509_crt_get_policy (gnutls_x509_crt_t crt, int indx, struct gnutls_x509_policy_st * policy, unsigned int * critical)
- crt: should contain a - gnutls_x509_crt_tstructure- indx: This specifies which policy to return. Use (0) to get the first one. - policy: A pointer to a policy structure. - critical: will be non-zero if the extension is marked as critical - This function will extract the certificate policy (extension 2.5.29.32) specified by the given index. - The policy returned by this function must be deinitialized by using - gnutls_x509_policy_release().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.- Since: 3.1.5 
gnutls_x509_crt_get_private_key_usage_period
- Function: int gnutls_x509_crt_get_private_key_usage_period (gnutls_x509_crt_t cert, time_t * activation, time_t * expiration, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- activation: The activation time - expiration: The expiration time - critical: the extension status - This function will return the expiration and activation times of the private key of the certificate. It relies on the PKIX extension 2.5.29.16 being present. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.
gnutls_x509_crt_get_proxy
- Function: int gnutls_x509_crt_get_proxy (gnutls_x509_crt_t cert, unsigned int * critical, int * pathlen, char ** policyLanguage, char ** policy, size_t * sizeof_policy)
- cert: should contain a - gnutls_x509_crt_tstructure- critical: will be non-zero if the extension is marked as critical - pathlen: pointer to output integer indicating path length (may be NULL), non-negative error codes indicate a present pCPathLenConstraint field and the actual value, -1 indicate that the field is absent. - policyLanguage: output variable with OID of policy language - policy: output variable with policy data - sizeof_policy: output variable size of policy data - This function will get information from a proxy certificate. It reads the ProxyCertInfo X.509 extension (1.3.6.1.5.5.7.1.14). - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code is returned.
gnutls_x509_crt_get_raw_dn
- Function: int gnutls_x509_crt_get_raw_dn (gnutls_x509_crt_t cert, gnutls_datum_t * dn)
- cert: should contain a - gnutls_x509_crt_tstructure- dn: will hold the starting point of the DN - This function will return a pointer to the DER encoded DN structure and the length. This points to allocated data that must be free’d using - gnutls_free().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. or a negative error code on error.
gnutls_x509_crt_get_raw_issuer_dn
- Function: int gnutls_x509_crt_get_raw_issuer_dn (gnutls_x509_crt_t cert, gnutls_datum_t * dn)
- cert: should contain a - gnutls_x509_crt_tstructure- dn: will hold the starting point of the DN - This function will return a pointer to the DER encoded DN structure and the length. This points to allocated data that must be free’d using - gnutls_free().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.or a negative error code on error.
gnutls_x509_crt_get_serial
- Function: int gnutls_x509_crt_get_serial (gnutls_x509_crt_t cert, void * result, size_t * result_size)
- cert: should contain a - gnutls_x509_crt_tstructure- result: The place where the serial number will be copied - result_size: Holds the size of the result field. - This function will return the X.509 certificate’s serial number. This is obtained by the X509 Certificate serialNumber field. Serial is not always a 32 or 64bit number. Some CAs use large serial numbers, thus it may be wise to handle it as something uint8_t. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_get_signature
- Function: int gnutls_x509_crt_get_signature (gnutls_x509_crt_t cert, char * sig, size_t * sig_size)
- cert: should contain a - gnutls_x509_crt_tstructure- sig: a pointer where the signature part will be copied (may be null). - sig_size: initially holds the size of - sig- This function will extract the signature field of a certificate. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value. and a negative error code on error.
gnutls_x509_crt_get_signature_algorithm
- Function: int gnutls_x509_crt_get_signature_algorithm (gnutls_x509_crt_t cert)
- cert: should contain a - gnutls_x509_crt_tstructure- This function will return a value of the - gnutls_sign_algorithm_tenumeration that is the signature algorithm that has been used to sign this certificate.- Returns: a - gnutls_sign_algorithm_tvalue, or a negative error code on error.
gnutls_x509_crt_get_subject
- Function: int gnutls_x509_crt_get_subject (gnutls_x509_crt_t cert, gnutls_x509_dn_t * dn)
- cert: should contain a - gnutls_x509_crt_tstructure- dn: output variable with pointer to uint8_t DN. - Return the Certificate’s Subject DN as a - gnutls_x509_dn_tdata type, that can be decoded using- gnutls_x509_dn_get_rdn_ava().- Note that - dnshould be treated as constant. Because it points into the- certobject, you should not use- dnafter- certis deallocated.- Returns: Returns 0 on success, or an error code. 
gnutls_x509_crt_get_subject_alt_name
- Function: int gnutls_x509_crt_get_subject_alt_name (gnutls_x509_crt_t cert, unsigned int seq, void * san, size_t * san_size, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) - san: is the place where the alternative name will be copied to - san_size: holds the size of san. - critical: will be non-zero if the extension is marked as critical (may be null) - This function retrieves the Alternative Name (2.5.29.17), contained in the given certificate in the X509v3 Certificate Extensions. - When the SAN type is otherName, it will extract the data in the otherName’s value field, and - GNUTLS_SAN_OTHERNAMEis returned. You may use- gnutls_x509_crt_get_subject_alt_othername_oid()to get the corresponding OID and the "virtual" SAN types (e.g.,- GNUTLS_SAN_OTHERNAME_XMPP).- If an otherName OID is known, the data will be decoded. Otherwise the returned data will be DER encoded, and you will have to decode it yourself. Currently, only the RFC 3920 id-on-xmppAddr SAN is recognized. - Returns: the alternative subject name type on success, one of the enumerated - gnutls_x509_subject_alt_name_t. It will return- GNUTLS_E_SHORT_MEMORY_BUFFERif- san_sizeis not large enough to hold the value. In that case- san_sizewill be updated with the required size. If the certificate does not have an Alternative name with the specified sequence number then- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.
gnutls_x509_crt_get_subject_alt_name2
- Function: int gnutls_x509_crt_get_subject_alt_name2 (gnutls_x509_crt_t cert, unsigned int seq, void * san, size_t * san_size, unsigned int * san_type, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) - san: is the place where the alternative name will be copied to - san_size: holds the size of ret. - san_type: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t). - critical: will be non-zero if the extension is marked as critical (may be null) - This function will return the alternative names, contained in the given certificate. It is the same as - gnutls_x509_crt_get_subject_alt_name()except for the fact that it will return the type of the alternative name in- san_typeeven if the function fails for some reason (i.e. the buffer provided is not enough).- Returns: the alternative subject name type on success, one of the enumerated - gnutls_x509_subject_alt_name_t. It will return- GNUTLS_E_SHORT_MEMORY_BUFFERif- san_sizeis not large enough to hold the value. In that case- san_sizewill be updated with the required size. If the certificate does not have an Alternative name with the specified sequence number then- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.
gnutls_x509_crt_get_subject_alt_othername_oid
- Function: int gnutls_x509_crt_get_subject_alt_othername_oid (gnutls_x509_crt_t cert, unsigned int seq, void * oid, size_t * oid_size)
- cert: should contain a - gnutls_x509_crt_tstructure- seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) - oid: is the place where the otherName OID will be copied to - oid_size: holds the size of ret. - This function will extract the type OID of an otherName Subject Alternative Name, contained in the given certificate, and return the type as an enumerated element. - This function is only useful if - gnutls_x509_crt_get_subject_alt_name()returned- GNUTLS_SAN_OTHERNAME.- If - oidis null then only the size will be filled. The- oidreturned will be null terminated, although- oid_sizewill not account for the trailing null.- Returns: the alternative subject name type on success, one of the enumerated gnutls_x509_subject_alt_name_t. For supported OIDs, it will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types, e.g. - GNUTLS_SAN_OTHERNAME_XMPP, and- GNUTLS_SAN_OTHERNAMEfor unknown OIDs. It will return- GNUTLS_E_SHORT_MEMORY_BUFFERif- ian_sizeis not large enough to hold the value. In that case- ian_sizewill be updated with the required size. If the certificate does not have an Alternative name with the specified sequence number and with the otherName type then- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned.
gnutls_x509_crt_get_subject_key_id
- Function: int gnutls_x509_crt_get_subject_key_id (gnutls_x509_crt_t cert, void * ret, size_t * ret_size, unsigned int * critical)
- cert: should contain a - gnutls_x509_crt_tstructure- ret: The place where the identifier will be copied - ret_size: Holds the size of the result field. - critical: will be non-zero if the extension is marked as critical (may be null) - This function will return the X.509v3 certificate’s subject key identifier. This is obtained by the X.509 Subject Key identifier extension field (2.5.29.14). - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.
gnutls_x509_crt_get_subject_unique_id
- Function: int gnutls_x509_crt_get_subject_unique_id (gnutls_x509_crt_t crt, char * buf, size_t * buf_size)
- crt: Holds the certificate - buf: user allocated memory buffer, will hold the unique id - buf_size: size of user allocated memory buffer (on input), will hold actual size of the unique ID on return. - This function will extract the subjectUniqueID value (if present) for the given certificate. - If the user allocated memory buffer is not large enough to hold the full subjectUniqueID, then a GNUTLS_E_SHORT_MEMORY_BUFFER error will be returned, and buf_size will be set to the actual length. - Returns: - GNUTLS_E_SUCCESSon success, otherwise a negative error code.
gnutls_x509_crt_get_version
- Function: int gnutls_x509_crt_get_version (gnutls_x509_crt_t cert)
- cert: should contain a - gnutls_x509_crt_tstructure- This function will return the version of the specified Certificate. - Returns: version of certificate, or a negative error code on error. 
gnutls_x509_crt_import
- Function: int gnutls_x509_crt_import (gnutls_x509_crt_t cert, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format)
- cert: The structure to store the parsed certificate. - data: The DER or PEM encoded certificate. - format: One of DER or PEM - This function will convert the given DER or PEM encoded Certificate to the native gnutls_x509_crt_t format. The output will be stored in - cert.- If the Certificate is PEM encoded it should have a header of "X509 CERTIFICATE", or "CERTIFICATE". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_init
- Function: int gnutls_x509_crt_init (gnutls_x509_crt_t * cert)
- cert: The structure to be initialized - This function will initialize an X.509 certificate structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_list_import
- Function: int gnutls_x509_crt_list_import (gnutls_x509_crt_t * certs, unsigned int * cert_max, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags)
- certs: The structures to store the parsed certificate. Must not be initialized. - cert_max: Initially must hold the maximum number of certs. It will be updated with the number of certs available. - data: The PEM encoded certificate. - format: One of DER or PEM. - flags: must be (0) or an OR’d sequence of gnutls_certificate_import_flags. - This function will convert the given PEM encoded certificate list to the native gnutls_x509_crt_t format. The output will be stored in - certs. They will be automatically initialized.- The flag - GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEEDwill cause import to fail if the certificates in the provided buffer are more than the available structures. The- GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTEDflag will cause the function to fail if the provided list is not sorted from subject to issuer.- If the Certificate is PEM encoded it should have a header of "X509 CERTIFICATE", or "CERTIFICATE". - Returns: the number of certificates read or a negative error value. 
gnutls_x509_crt_list_import2
- Function: int gnutls_x509_crt_list_import2 (gnutls_x509_crt_t ** certs, unsigned int * size, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags)
- certs: The structures to store the parsed certificate. Must not be initialized. - size: It will contain the size of the list. - data: The PEM encoded certificate. - format: One of DER or PEM. - flags: must be (0) or an OR’d sequence of gnutls_certificate_import_flags. - This function will convert the given PEM encoded certificate list to the native gnutls_x509_crt_t format. The output will be stored in - certswhich will allocated and initialized.- If the Certificate is PEM encoded it should have a header of "X509 CERTIFICATE", or "CERTIFICATE". - To deinitialize - certs, you need to deinitialize each crt structure independently, and use- gnutls_free()at- Returns: the number of certificates read or a negative error value. - Since: 3.0 
gnutls_x509_crt_list_verify
- Function: int gnutls_x509_crt_list_verify (const gnutls_x509_crt_t * cert_list, int cert_list_length, const gnutls_x509_crt_t * CA_list, int CA_list_length, const gnutls_x509_crl_t * CRL_list, int CRL_list_length, unsigned int flags, unsigned int * verify)
- cert_list: is the certificate list to be verified - cert_list_length: holds the number of certificate in cert_list - CA_list: is the CA list which will be used in verification - CA_list_length: holds the number of CA certificate in CA_list - CRL_list: holds a list of CRLs. - CRL_list_length: the length of CRL list. - flags: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations. - verify: will hold the certificate verification output. - This function will try to verify the given certificate list and return its status. If no flags are specified (0), this function will use the basicConstraints (2.5.29.19) PKIX extension. This means that only a certificate authority is allowed to sign a certificate. - You must also check the peer’s name in order to check if the verified certificate belongs to the actual peer. - The certificate verification output will be put in - verifyand will be one or more of the gnutls_certificate_status_t enumerated elements bitwise or’d. For a more detailed verification status use- gnutls_x509_crt_verify()per list element.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_print
- Function: int gnutls_x509_crt_print (gnutls_x509_crt_t cert, gnutls_certificate_print_formats_t format, gnutls_datum_t * out)
- cert: The structure to be printed - format: Indicate the format to use - out: Newly allocated datum with (0) terminated string. - This function will pretty print a X.509 certificate, suitable for display to a human. - If the format is - GNUTLS_CRT_PRINT_FULLthen all fields of the certificate will be output, on multiple lines. The- GNUTLS_CRT_PRINT_ONELINEformat will generate one line with some selected fields, which is useful for logging purposes.- The output - outneeds to be deallocated using- gnutls_free().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_activation_time
- Function: int gnutls_x509_crt_set_activation_time (gnutls_x509_crt_t cert, time_t act_time)
- cert: a certificate of type - gnutls_x509_crt_t- act_time: The actual time - This function will set the time this Certificate was or will be activated. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_authority_info_access
- Function: int gnutls_x509_crt_set_authority_info_access (gnutls_x509_crt_t crt, int what, gnutls_datum_t * data)
- crt: Holds the certificate - what: what data to get, a - gnutls_info_access_what_ttype.- data: output data to be freed with - gnutls_free().- This function sets the Authority Information Access (AIA) extension, see RFC 5280 section 4.2.2.1 for more information. - The type of data stored in - datais specified via- whatwhich should be- gnutls_info_access_what_tvalues.- If - whatis- GNUTLS_IA_OCSP_URI,- datawill hold the OCSP URI. If- whatis- GNUTLS_IA_CAISSUERS_URI,- datawill hold the caIssuers URI.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.0 
gnutls_x509_crt_set_authority_key_id
- Function: int gnutls_x509_crt_set_authority_key_id (gnutls_x509_crt_t cert, const void * id, size_t id_size)
- cert: a certificate of type - gnutls_x509_crt_t- id: The key ID - id_size: Holds the size of the key ID field. - This function will set the X.509 certificate’s authority key ID extension. Only the keyIdentifier field can be set with this function. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_basic_constraints
- Function: int gnutls_x509_crt_set_basic_constraints (gnutls_x509_crt_t crt, unsigned int ca, int pathLenConstraint)
- crt: a certificate of type - gnutls_x509_crt_t- ca: true(1) or false(0). Depending on the Certificate authority status. - pathLenConstraint: non-negative error codes indicate maximum length of path, and negative error codes indicate that the pathLenConstraints field should not be present. - This function will set the basicConstraints certificate extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_ca_status
- Function: int gnutls_x509_crt_set_ca_status (gnutls_x509_crt_t crt, unsigned int ca)
- crt: a certificate of type - gnutls_x509_crt_t- ca: true(1) or false(0). Depending on the Certificate authority status. - This function will set the basicConstraints certificate extension. Use - gnutls_x509_crt_set_basic_constraints()if you want to control the pathLenConstraint field too.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_crl_dist_points
- Function: int gnutls_x509_crt_set_crl_dist_points (gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const void * data_string, unsigned int reason_flags)
- crt: a certificate of type - gnutls_x509_crt_t- type: is one of the gnutls_x509_subject_alt_name_t enumerations - data_string: The data to be set - reason_flags: revocation reasons - This function will set the CRL distribution points certificate extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_crl_dist_points2
- Function: int gnutls_x509_crt_set_crl_dist_points2 (gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const void * data, unsigned int data_size, unsigned int reason_flags)
- crt: a certificate of type - gnutls_x509_crt_t- type: is one of the gnutls_x509_subject_alt_name_t enumerations - data: The data to be set - data_size: The data size - reason_flags: revocation reasons - This function will set the CRL distribution points certificate extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.6.0 
gnutls_x509_crt_set_crq
- Function: int gnutls_x509_crt_set_crq (gnutls_x509_crt_t crt, gnutls_x509_crq_t crq)
- crt: a certificate of type - gnutls_x509_crt_t- crq: holds a certificate request - This function will set the name and public parameters as well as the extensions from the given certificate request to the certificate. Only RSA keys are currently supported. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_crq_extensions
- Function: int gnutls_x509_crt_set_crq_extensions (gnutls_x509_crt_t crt, gnutls_x509_crq_t crq)
- crt: a certificate of type - gnutls_x509_crt_t- crq: holds a certificate request - This function will set extensions from the given request to the certificate. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.8.0 
gnutls_x509_crt_set_dn
- Function: int gnutls_x509_crt_set_dn (gnutls_x509_crt_t crt, const char * dn, const char ** err)
- crt: a certificate of type - gnutls_x509_crt_t- dn: a comma separated DN string (RFC4514) - err: indicates the error position (if any) - This function will set the DN on the provided certificate. The input string should be plain ASCII or UTF-8 encoded. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_dn_by_oid
- Function: int gnutls_x509_crt_set_dn_by_oid (gnutls_x509_crt_t crt, const char * oid, unsigned int raw_flag, const void * name, unsigned int sizeof_name)
- crt: a certificate of type - gnutls_x509_crt_t- oid: holds an Object Identifier in a null terminated string - raw_flag: must be 0, or 1 if the data are DER encoded - name: a pointer to the name - sizeof_name: holds the size of - name- This function will set the part of the name of the Certificate subject, specified by the given OID. The input string should be ASCII or UTF-8 encoded. - Some helper macros with popular OIDs can be found in gnutls/x509.h With this function you can only set the known OIDs. You can test for known OIDs using - gnutls_x509_dn_oid_known(). For OIDs that are not known (by gnutls) you should properly DER encode your data, and call this function with- raw_flagset.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_expiration_time
- Function: int gnutls_x509_crt_set_expiration_time (gnutls_x509_crt_t cert, time_t exp_time)
- cert: a certificate of type - gnutls_x509_crt_t- exp_time: The actual time - This function will set the time this Certificate will expire. Setting an expiration time to (time_t)-1 or to - GNUTLS_X509_NO_WELL_DEFINED_EXPIRATIONwill set to the no well-defined expiration date value.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_extension_by_oid
- Function: int gnutls_x509_crt_set_extension_by_oid (gnutls_x509_crt_t crt, const char * oid, const void * buf, size_t sizeof_buf, unsigned int critical)
- crt: a certificate of type - gnutls_x509_crt_t- oid: holds an Object Identified in null terminated string - buf: a pointer to a DER encoded data - sizeof_buf: holds the size of - buf- critical: should be non-zero if the extension is to be marked as critical - This function will set an the extension, by the specified OID, in the certificate. The extension data should be binary data DER encoded. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_issuer_alt_name
- Function: int gnutls_x509_crt_set_issuer_alt_name (gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const void * data, unsigned int data_size, unsigned int flags)
- crt: a certificate of type - gnutls_x509_crt_t- type: is one of the gnutls_x509_subject_alt_name_t enumerations - data: The data to be set - data_size: The size of data to be set - flags: GNUTLS_FSAN_SET to clear previous data or GNUTLS_FSAN_APPEND to append. - This function will set the issuer alternative name certificate extension. It can set the same types as - gnutls_x509_crt_set_subject_alt_name().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_crt_set_issuer_dn
- Function: int gnutls_x509_crt_set_issuer_dn (gnutls_x509_crt_t crt, const char * dn, const char ** err)
- crt: a certificate of type - gnutls_x509_crt_t- dn: a comma separated DN string (RFC4514) - err: indicates the error position (if any) - This function will set the DN on the provided certificate. The input string should be plain ASCII or UTF-8 encoded. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_issuer_dn_by_oid
- Function: int gnutls_x509_crt_set_issuer_dn_by_oid (gnutls_x509_crt_t crt, const char * oid, unsigned int raw_flag, const void * name, unsigned int sizeof_name)
- crt: a certificate of type - gnutls_x509_crt_t- oid: holds an Object Identifier in a null terminated string - raw_flag: must be 0, or 1 if the data are DER encoded - name: a pointer to the name - sizeof_name: holds the size of - name- This function will set the part of the name of the Certificate issuer, specified by the given OID. The input string should be ASCII or UTF-8 encoded. - Some helper macros with popular OIDs can be found in gnutls/x509.h With this function you can only set the known OIDs. You can test for known OIDs using - gnutls_x509_dn_oid_known(). For OIDs that are not known (by gnutls) you should properly DER encode your data, and call this function with- raw_flagset.- Normally you do not need to call this function, since the signing operation will copy the signer’s name as the issuer of the certificate. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_key
- Function: int gnutls_x509_crt_set_key (gnutls_x509_crt_t crt, gnutls_x509_privkey_t key)
- crt: a certificate of type - gnutls_x509_crt_t- key: holds a private key - This function will set the public parameters from the given private key to the certificate. Only RSA keys are currently supported. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_key_purpose_oid
- Function: int gnutls_x509_crt_set_key_purpose_oid (gnutls_x509_crt_t cert, const void * oid, unsigned int critical)
- cert: a certificate of type - gnutls_x509_crt_t- oid: a pointer to a null terminated string that holds the OID - critical: Whether this extension will be critical or not - This function will set the key purpose OIDs of the Certificate. These are stored in the Extended Key Usage extension (2.5.29.37) See the GNUTLS_KP_* definitions for human readable names. - Subsequent calls to this function will append OIDs to the OID list. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error code is returned.
gnutls_x509_crt_set_key_usage
- Function: int gnutls_x509_crt_set_key_usage (gnutls_x509_crt_t crt, unsigned int usage)
- crt: a certificate of type - gnutls_x509_crt_t- usage: an ORed sequence of the GNUTLS_KEY_* elements. - This function will set the keyUsage certificate extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_name_constraints
- Function: int gnutls_x509_crt_set_name_constraints (gnutls_x509_crt_t crt, gnutls_x509_name_constraints_t nc, unsigned int critical)
- crt: The certificate structure - nc: The nameconstraints structure - critical: whether this extension will be critical - This function will set the provided name constraints to the certificate extension list. This extension is always marked as critical. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_crt_set_pin_function
- Function: void gnutls_x509_crt_set_pin_function (gnutls_x509_crt_t crt, gnutls_pin_callback_t fn, void * userdata)
- crt: The certificate structure - fn: the callback - userdata: data associated with the callback - This function will set a callback function to be used when it is required to access a protected object. This function overrides the global function set using - gnutls_pkcs11_set_pin_function().- Note that this callback is currently used only during the import of a PKCS - 11certificate with- gnutls_x509_crt_import_pkcs11_url().- Since: 3.1.0 
gnutls_x509_crt_set_policy
- Function: int gnutls_x509_crt_set_policy (gnutls_x509_crt_t crt, const struct gnutls_x509_policy_st * policy, unsigned int critical)
- crt: should contain a - gnutls_x509_crt_tstructure- policy: A pointer to a policy structure. - critical: use non-zero if the extension is marked as critical - This function will set the certificate policy extension (2.5.29.32). Multiple calls to this function append a new policy. - Note the maximum text size for the qualifier - GNUTLS_X509_QUALIFIER_NOTICEis 200 characters. This function will fail with- GNUTLS_E_INVALID_REQUESTif this is exceeded.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.1.5 
gnutls_x509_crt_set_private_key_usage_period
- Function: int gnutls_x509_crt_set_private_key_usage_period (gnutls_x509_crt_t crt, time_t activation, time_t expiration)
- crt: a certificate of type - gnutls_x509_crt_t- activation: The activation time - expiration: The expiration time - This function will set the private key usage period extension (2.5.29.16). - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_proxy
- Function: int gnutls_x509_crt_set_proxy (gnutls_x509_crt_t crt, int pathLenConstraint, const char * policyLanguage, const char * policy, size_t sizeof_policy)
- crt: a certificate of type - gnutls_x509_crt_t- pathLenConstraint: non-negative error codes indicate maximum length of path, and negative error codes indicate that the pathLenConstraints field should not be present. - policyLanguage: OID describing the language of - policy.- policy: uint8_t byte array with policy language, can be - NULL- sizeof_policy: size of - policy.- This function will set the proxyCertInfo extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_proxy_dn
- Function: int gnutls_x509_crt_set_proxy_dn (gnutls_x509_crt_t crt, gnutls_x509_crt_t eecrt, unsigned int raw_flag, const void * name, unsigned int sizeof_name)
- crt: a gnutls_x509_crt_t structure with the new proxy cert - eecrt: the end entity certificate that will be issuing the proxy - raw_flag: must be 0, or 1 if the CN is DER encoded - name: a pointer to the CN name, may be NULL (but MUST then be added later) - sizeof_name: holds the size of - name- This function will set the subject in - crtto the end entity’s- eecrtsubject name, and add a single Common Name component- nameof size- sizeof_name. This corresponds to the required proxy certificate naming style. Note that if- nameis- NULL, you MUST set it later by using- gnutls_x509_crt_set_dn_by_oid()or similar.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_serial
- Function: int gnutls_x509_crt_set_serial (gnutls_x509_crt_t cert, const void * serial, size_t serial_size)
- cert: a certificate of type - gnutls_x509_crt_t- serial: The serial number - serial_size: Holds the size of the serial field. - This function will set the X.509 certificate’s serial number. While the serial number is an integer, it is often handled as an opaque field by several CAs. For this reason this function accepts any kind of data as a serial number. To be consistent with the X.509/PKIX specifications the provided - serialshould be a big-endian positive number (i.e. it’s leftmost bit should be zero).- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_subject_alt_name
- Function: int gnutls_x509_crt_set_subject_alt_name (gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const void * data, unsigned int data_size, unsigned int flags)
- crt: a certificate of type - gnutls_x509_crt_t- type: is one of the gnutls_x509_subject_alt_name_t enumerations - data: The data to be set - data_size: The size of data to be set - flags: GNUTLS_FSAN_SET to clear previous data or GNUTLS_FSAN_APPEND to append. - This function will set the subject alternative name certificate extension. It can set the following types: - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.6.0 
gnutls_x509_crt_set_subject_alternative_name
- Function: int gnutls_x509_crt_set_subject_alternative_name (gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const char * data_string)
- crt: a certificate of type - gnutls_x509_crt_t- type: is one of the gnutls_x509_subject_alt_name_t enumerations - data_string: The data to be set, a (0) terminated string - This function will set the subject alternative name certificate extension. This function assumes that data can be expressed as a null terminated string. - The name of the function is unfortunate since it is incosistent with - gnutls_x509_crt_get_subject_alt_name().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_subject_key_id
- Function: int gnutls_x509_crt_set_subject_key_id (gnutls_x509_crt_t cert, const void * id, size_t id_size)
- cert: a certificate of type - gnutls_x509_crt_t- id: The key ID - id_size: Holds the size of the subject key ID field. - This function will set the X.509 certificate’s subject key ID extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_version
- Function: int gnutls_x509_crt_set_version (gnutls_x509_crt_t crt, unsigned int version)
- crt: a certificate of type - gnutls_x509_crt_t- version: holds the version number. For X.509v1 certificates must be 1. - This function will set the version of the certificate. This must be one for X.509 version 1, and so on. Plain certificates without extensions must have version set to one. - To create well-formed certificates, you must specify version 3 if you use any certificate extensions. Extensions are created by functions such as - gnutls_x509_crt_set_subject_alt_name()or- gnutls_x509_crt_set_key_usage().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_sign
- Function: int gnutls_x509_crt_sign (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer, gnutls_x509_privkey_t issuer_key)
- crt: a certificate of type - gnutls_x509_crt_t- issuer: is the certificate of the certificate issuer - issuer_key: holds the issuer’s private key - This function is the same a - gnutls_x509_crt_sign2()with no flags, and SHA1 as the hash algorithm.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_sign2
- Function: int gnutls_x509_crt_sign2 (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer, gnutls_x509_privkey_t issuer_key, gnutls_digest_algorithm_t dig, unsigned int flags)
- crt: a certificate of type - gnutls_x509_crt_t- issuer: is the certificate of the certificate issuer - issuer_key: holds the issuer’s private key - dig: The message digest to use, - GNUTLS_DIG_SHA1is a safe choice- flags: must be 0 - This function will sign the certificate with the issuer’s private key, and will copy the issuer’s information into the certificate. - This must be the last step in a certificate generation since all the previously set parameters are now signed. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_crt_verify
- Function: int gnutls_x509_crt_verify (gnutls_x509_crt_t cert, const gnutls_x509_crt_t * CA_list, int CA_list_length, unsigned int flags, unsigned int * verify)
- cert: is the certificate to be verified - CA_list: is one certificate that is considered to be trusted one - CA_list_length: holds the number of CA certificate in CA_list - flags: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations. - verify: will hold the certificate verification output. - This function will try to verify the given certificate and return its status. Note that a verification error does not imply a negative return status. In that case the - verifystatus is set.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_dn_deinit
- Function: void gnutls_x509_dn_deinit (gnutls_x509_dn_t dn)
- dn: a DN uint8_t object pointer. - This function deallocates the DN object as returned by - gnutls_x509_dn_import().- Since: 2.4.0 
gnutls_x509_dn_export
- Function: int gnutls_x509_dn_export (gnutls_x509_dn_t dn, gnutls_x509_crt_fmt_t format, void * output_data, size_t * output_data_size)
- dn: Holds the uint8_t DN object - format: the format of output params. One of PEM or DER. - output_data: will contain a DN PEM or DER encoded - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will export the DN to DER or PEM format. - If the buffer provided is not long enough to hold the output, then * - output_data_sizeis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned.- If the structure is PEM encoded, it will have a header of "BEGIN NAME". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_dn_export2
- Function: int gnutls_x509_dn_export2 (gnutls_x509_dn_t dn, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out)
- dn: Holds the uint8_t DN object - format: the format of output params. One of PEM or DER. - out: will contain a DN PEM or DER encoded - This function will export the DN to DER or PEM format. - The output buffer is allocated using - gnutls_malloc().- If the structure is PEM encoded, it will have a header of "BEGIN NAME". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.1.3 
gnutls_x509_dn_get_rdn_ava
- Function: int gnutls_x509_dn_get_rdn_ava (gnutls_x509_dn_t dn, int irdn, int iava, gnutls_x509_ava_st * ava)
- dn: a pointer to DN - irdn: index of RDN - iava: index of AVA. - ava: Pointer to structure which will hold output information. - Get pointers to data within the DN. The format of the - avastructure is shown below.- struct gnutls_x509_ava_st { gnutls_datum_t oid; gnutls_datum_t value; unsigned long value_tag; }; - The X.509 distinguished name is a sequence of sequences of strings and this is what the - irdnand- iavaindexes model.- Note that - avawill contain pointers into the- dnstructure which in turns points to the original certificate. Thus you should not modify any data or deallocate any of those.- This is a low-level function that requires the caller to do the value conversions when necessary (e.g. from UCS-2). - Returns: Returns 0 on success, or an error code. 
gnutls_x509_dn_import
- Function: int gnutls_x509_dn_import (gnutls_x509_dn_t dn, const gnutls_datum_t * data)
- dn: the structure that will hold the imported DN - data: should contain a DER encoded RDN sequence - This function parses an RDN sequence and stores the result to a - gnutls_x509_dn_tstructure. The structure must have been initialized with- gnutls_x509_dn_init(). You may use- gnutls_x509_dn_get_rdn_ava()to decode the DN.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.4.0 
gnutls_x509_dn_init
- Function: int gnutls_x509_dn_init (gnutls_x509_dn_t * dn)
- dn: the object to be initialized - This function initializes a - gnutls_x509_dn_tstructure.- The object returned must be deallocated using - gnutls_x509_dn_deinit().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.4.0 
gnutls_x509_dn_oid_known
- Function: int gnutls_x509_dn_oid_known (const char * oid)
- oid: holds an Object Identifier in a null terminated string - This function will inform about known DN OIDs. This is useful since functions like - gnutls_x509_crt_set_dn_by_oid()use the information on known OIDs to properly encode their input. Object Identifiers that are not known are not encoded by these functions, and their input is stored directly into the ASN.1 structure. In that case of unknown OIDs, you have the responsibility of DER encoding your data.- Returns: 1 on known OIDs and 0 otherwise. 
gnutls_x509_dn_oid_name
- Function: const char * gnutls_x509_dn_oid_name (const char * oid, unsigned int flags)
- oid: holds an Object Identifier in a null terminated string - flags: 0 or GNUTLS_X509_DN_OID_* - This function will return the name of a known DN OID. If - GNUTLS_X509_DN_OID_RETURN_OIDis specified this function will return the given OID if no descriptive name has been found.- Returns: A null terminated string or NULL otherwise. - Since: 3.0 
gnutls_x509_ext_export_aia
- Function: int gnutls_x509_ext_export_aia (gnutls_x509_aia_t aia, gnutls_datum_t * ext)
- aia: The authority info access structure - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will DER encode the Authority Information Access (AIA) extension; see RFC 5280 section 4.2.2.1 for more information on the extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_authority_key_id
- Function: int gnutls_x509_ext_export_authority_key_id (gnutls_x509_aki_t aki, gnutls_datum_t * ext)
- aki: An initialized authority key identifier structure - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the provided key identifier to a DER-encoded PKIX AuthorityKeyIdentifier extension. The output data in - extwill be allocated using- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_basic_constraints
- Function: int gnutls_x509_ext_export_basic_constraints (unsigned int ca, int pathlen, gnutls_datum_t * ext)
- ca: non-zero for a CA - pathlen: The path length constraint (set to -1 for no constraint) - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the parameters provided to a basic constraints DER encoded extension (2.5.29.19). The - extdata will be allocated using- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_crl_dist_points
- Function: int gnutls_x509_ext_export_crl_dist_points (gnutls_x509_crl_dist_points_t cdp, gnutls_datum_t * ext)
- cdp: A pointer to an initialized CRL distribution points structure. - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the provided policies, to a certificate policy DER encoded extension (2.5.29.31). - The - extdata will be allocated using- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_key_purposes
- Function: int gnutls_x509_ext_export_key_purposes (gnutls_x509_key_purposes_t p, gnutls_datum_t * ext)
- p: The key purposes structure - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the key purposes structure to a DER-encoded PKIX ExtKeyUsageSyntax (2.5.29.37) extension. The output data in - extwill be allocated usin- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_key_usage
- Function: int gnutls_x509_ext_export_key_usage (unsigned int usage, gnutls_datum_t * ext)
- usage: an ORed sequence of the GNUTLS_KEY_* elements. - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the keyUsage bit string to a DER encoded PKIX extension. The - extdata will be allocated using- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_name_constraints
- Function: int gnutls_x509_ext_export_name_constraints (gnutls_x509_name_constraints_t nc, gnutls_datum_t * ext)
- nc: The nameconstraints structure - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the provided name constraints structure to a DER-encoded PKIX NameConstraints (2.5.29.30) extension. The output data in - extwill be allocated usin- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_policies
- Function: int gnutls_x509_ext_export_policies (gnutls_x509_policies_t policies, gnutls_datum_t * ext)
- policies: A pointer to an initialized policies structure. - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the provided policies, to a certificate policy DER encoded extension (2.5.29.32). - The - extdata will be allocated using- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_private_key_usage_period
- Function: int gnutls_x509_ext_export_private_key_usage_period (time_t activation, time_t expiration, gnutls_datum_t * ext)
- activation: The activation time - expiration: The expiration time - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the periods provided to a private key usage DER encoded extension (2.5.29.16). The - extdata will be allocated using- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_proxy
- Function: int gnutls_x509_ext_export_proxy (int pathLenConstraint, const char * policyLanguage, const char * policy, size_t sizeof_policy, gnutls_datum_t * ext)
- pathLenConstraint: non-negative error codes indicate maximum length of path, and negative error codes indicate that the pathLenConstraints field should not be present. - policyLanguage: OID describing the language of - policy.- policy: uint8_t byte array with policy language, can be - NULL- sizeof_policy: size of - policy.- ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the parameters provided to a proxyCertInfo extension. - The - extdata will be allocated using- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_subject_alt_names
- Function: int gnutls_x509_ext_export_subject_alt_names (gnutls_subject_alt_names_t sans, gnutls_datum_t * ext)
- sans: The alternative names structure - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the provided alternative names structure to a DER-encoded SubjectAltName PKIX extension. The output data in - extwill be allocated using- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_export_subject_key_id
- Function: int gnutls_x509_ext_export_subject_key_id (const gnutls_datum_t * id, gnutls_datum_t * ext)
- id: The key identifier - ext: The DER-encoded extension data; must be freed using - gnutls_free().- This function will convert the provided key identifier to a DER-encoded PKIX SubjectKeyIdentifier extension. The output data in - extwill be allocated using- gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_aia
- Function: int gnutls_x509_ext_import_aia (const gnutls_datum_t * ext, gnutls_x509_aia_t aia, unsigned int flags)
- ext: The DER-encoded extension data - aia: The authority info access structure - flags: should be zero - This function extracts the Authority Information Access (AIA) extension from the provided DER-encoded data; see RFC 5280 section 4.2.2.1 for more information on the extension. The AIA extension holds a sequence of AccessDescription (AD) data. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_authority_key_id
- Function: int gnutls_x509_ext_import_authority_key_id (const gnutls_datum_t * ext, gnutls_x509_aki_t aki, unsigned int flags)
- ext: a DER encoded extension - aki: An initialized authority key identifier structure - flags: should be zero - This function will return the subject key ID stored in the provided AuthorityKeyIdentifier extension. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_basic_constraints
- Function: int gnutls_x509_ext_import_basic_constraints (const gnutls_datum_t * ext, unsigned int * ca, int * pathlen)
- ext: the DER encoded extension data - ca: will be non zero if the CA status is true - pathlen: the path length constraint; will be set to -1 for no limit - This function will return the CA status and path length constraint as written in the PKIX extension 2.5.29.19. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_crl_dist_points
- Function: int gnutls_x509_ext_import_crl_dist_points (const gnutls_datum_t * ext, gnutls_x509_crl_dist_points_t cdp, unsigned int flags)
- ext: the DER encoded extension data - cdp: A pointer to an initialized CRL distribution points structure. - flags: should be zero - This function will extract the CRL distribution points extension (2.5.29.31) and store it into the provided structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_key_purposes
- Function: int gnutls_x509_ext_import_key_purposes (const gnutls_datum_t * ext, gnutls_x509_key_purposes_t p, unsigned int flags)
- ext: The DER-encoded extension data - p: The key purposes structure - flags: should be zero - This function will extract the key purposes in the provided DER-encoded ExtKeyUsageSyntax PKIX extension, to a - gnutls_x509_key_purposes_tstructure. The structure must be initialized.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_key_usage
- Function: int gnutls_x509_ext_import_key_usage (const gnutls_datum_t * ext, unsigned int * key_usage)
- ext: the DER encoded extension data - key_usage: where the key usage bits will be stored - This function will return certificate’s key usage, by reading the DER data of the keyUsage X.509 extension (2.5.29.15). The key usage value will ORed values of the: - GNUTLS_KEY_DIGITAL_SIGNATURE,- GNUTLS_KEY_NON_REPUDIATION,- GNUTLS_KEY_KEY_ENCIPHERMENT,- GNUTLS_KEY_DATA_ENCIPHERMENT,- GNUTLS_KEY_KEY_AGREEMENT,- GNUTLS_KEY_KEY_CERT_SIGN,- GNUTLS_KEY_CRL_SIGN,- GNUTLS_KEY_ENCIPHER_ONLY,- GNUTLS_KEY_DECIPHER_ONLY.- Returns: the certificate key usage, or a negative error code in case of parsing error. If the certificate does not contain the keyUsage extension - GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned.- Since: 3.3.0 
gnutls_x509_ext_import_name_constraints
- Function: int gnutls_x509_ext_import_name_constraints (const gnutls_datum_t * ext, gnutls_x509_name_constraints_t nc, unsigned int flags)
- ext: a DER encoded extension - nc: The nameconstraints intermediate structure - flags: zero or - GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND- This function will return an intermediate structure containing the name constraints of the provided NameConstraints extension. That structure can be used in combination with - gnutls_x509_name_constraints_check()to verify whether a server’s name is in accordance with the constraints.- When the - flagsis set to- GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND, then if the- ncstructure is empty this function will behave identically as if the flag was not set. Otherwise if there are elements in the- ncstructure then only the excluded constraints will be appended to the constraints.- Note that - ncmust be initialized prior to calling this function.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_policies
- Function: int gnutls_x509_ext_import_policies (const gnutls_datum_t * ext, gnutls_x509_policies_t policies, unsigned int flags)
- ext: the DER encoded extension data - policies: A pointer to an initialized policies structures. - flags: should be zero - This function will extract the certificate policy extension (2.5.29.32) and store it the provided structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_private_key_usage_period
- Function: int gnutls_x509_ext_import_private_key_usage_period (const gnutls_datum_t * ext, time_t * activation, time_t * expiration)
- ext: the DER encoded extension data - activation: Will hold the activation time - expiration: Will hold the expiration time - This function will return the expiration and activation times of the private key as written in the PKIX extension 2.5.29.16. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_proxy
- Function: int gnutls_x509_ext_import_proxy (const gnutls_datum_t * ext, int * pathlen, char ** policyLanguage, char ** policy, size_t * sizeof_policy)
- ext: the DER encoded extension data - pathlen: pointer to output integer indicating path length (may be NULL), non-negative error codes indicate a present pCPathLenConstraint field and the actual value, -1 indicate that the field is absent. - policyLanguage: output variable with OID of policy language - policy: output variable with policy data - sizeof_policy: output variable size of policy data - This function will return the information from a proxy certificate extension. It reads the ProxyCertInfo X.509 extension (1.3.6.1.5.5.7.1.14). - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_subject_alt_names
- Function: int gnutls_x509_ext_import_subject_alt_names (const gnutls_datum_t * ext, gnutls_subject_alt_names_t sans, unsigned int flags)
- ext: The DER-encoded extension data - sans: The alternative names structure - flags: should be zero - This function will export the alternative names in the provided DER-encoded SubjectAltName PKIX extension, to a - gnutls_subject_alt_names_tstructure. The structure must have been initialized.- This function will succeed even if there no subject alternative names in the structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_ext_import_subject_key_id
- Function: int gnutls_x509_ext_import_subject_key_id (const gnutls_datum_t * ext, gnutls_datum_t * id)
- ext: a DER encoded extension - id: will contain the subject key ID - This function will return the subject key ID stored in the provided SubjectKeyIdentifier extension. The ID will be allocated using - gnutls_malloc().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_key_purpose_deinit
- Function: void gnutls_x509_key_purpose_deinit (gnutls_x509_key_purposes_t p)
- p: The key purposes structure - This function will deinitialize an alternative names structure. - Since: 3.3.0 
gnutls_x509_key_purpose_get
- Function: int gnutls_x509_key_purpose_get (gnutls_x509_key_purposes_t p, unsigned idx, gnutls_datum_t * oid)
- p: The key purposes structure - idx: The index of the key purpose to retrieve - oid: Will hold the object identifier of the key purpose (to be treated as constant) - This function will retrieve the specified by the index key purpose in the purposes structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the index is out of bounds, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_key_purpose_init
- Function: int gnutls_x509_key_purpose_init (gnutls_x509_key_purposes_t * p)
- p: The key purposes structure - This function will initialize an alternative names structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_key_purpose_set
- Function: int gnutls_x509_key_purpose_set (gnutls_x509_key_purposes_t p, const char * oid)
- p: The key purposes structure - oid: The object identifier of the key purpose - This function will store the specified key purpose in the purposes structure. - Returns: On success, - GNUTLS_E_SUCCESS(0), otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_name_constraints_add_excluded
- Function: int gnutls_x509_name_constraints_add_excluded (gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type, const gnutls_datum_t * name)
- nc: The nameconstraints structure - type: The type of the constraints - name: The data of the constraints - This function will add a name constraint to the list of excluded constraints. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_name_constraints_add_permitted
- Function: int gnutls_x509_name_constraints_add_permitted (gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type, const gnutls_datum_t * name)
- nc: The nameconstraints structure - type: The type of the constraints - name: The data of the constraints - This function will add a name constraint to the list of permitted constraints. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_name_constraints_check
- Function: unsigned gnutls_x509_name_constraints_check (gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type, const gnutls_datum_t * name)
- nc: the extracted name constraints structure - type: the type of the constraint to check (of type gnutls_x509_subject_alt_name_t) - name: the name to be checked - This function will check the provided name against the constraints in - ncusing the RFC5280 rules. Currently this function is limited to DNS names and emails (of type- GNUTLS_SAN_DNSNAMEand- GNUTLS_SAN_RFC822NAME).- Returns: zero if the provided name is not acceptable, and non-zero otherwise. - Since: 3.3.0 
gnutls_x509_name_constraints_check_crt
- Function: unsigned gnutls_x509_name_constraints_check_crt (gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type, gnutls_x509_crt_t cert)
- nc: the extracted name constraints structure - type: the type of the constraint to check (of type gnutls_x509_subject_alt_name_t) - cert: the certificate to be checked - This function will check the provided certificate names against the constraints in - ncusing the RFC5280 rules. It will traverse all the certificate’s names and alternative names.- Currently this function is limited to DNS names and emails (of type - GNUTLS_SAN_DNSNAMEand- GNUTLS_SAN_RFC822NAME).- Returns: zero if the provided name is not acceptable, and non-zero otherwise. - Since: 3.3.0 
gnutls_x509_name_constraints_deinit
- Function: void gnutls_x509_name_constraints_deinit (gnutls_x509_name_constraints_t nc)
- nc: The nameconstraints structure - This function will deinitialize a name constraints structure. - Since: 3.3.0 
gnutls_x509_name_constraints_get_excluded
- Function: int gnutls_x509_name_constraints_get_excluded (gnutls_x509_name_constraints_t nc, unsigned idx, unsigned * type, gnutls_datum_t * name)
- nc: the extracted name constraints structure - idx: the index of the constraint - type: the type of the constraint (of type gnutls_x509_subject_alt_name_t) - name: the name in the constraint (of the specific type) - This function will return an intermediate structure containing the name constraints of the provided CA certificate. That structure can be used in combination with - gnutls_x509_name_constraints_check()to verify whether a server’s name is in accordance with the constraints.- The name should be treated as constant and valid for the lifetime of - nc.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_name_constraints_get_permitted
- Function: int gnutls_x509_name_constraints_get_permitted (gnutls_x509_name_constraints_t nc, unsigned idx, unsigned * type, gnutls_datum_t * name)
- nc: the extracted name constraints structure - idx: the index of the constraint - type: the type of the constraint (of type gnutls_x509_subject_alt_name_t) - name: the name in the constraint (of the specific type) - This function will return an intermediate structure containing the name constraints of the provided CA certificate. That structure can be used in combination with - gnutls_x509_name_constraints_check()to verify whether a server’s name is in accordance with the constraints.- The name should be treated as constant and valid for the lifetime of - nc.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the extension is not present, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_name_constraints_init
- Function: int gnutls_x509_name_constraints_init (gnutls_x509_name_constraints_t * nc)
- nc: The nameconstraints structure - This function will initialize a name constraints structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_policies_deinit
- Function: void gnutls_x509_policies_deinit (gnutls_x509_policies_t policies)
- policies: The authority key identifier structure - This function will deinitialize an authority key identifier structure. - Since: 3.3.0 
gnutls_x509_policies_get
- Function: int gnutls_x509_policies_get (gnutls_x509_policies_t policies, unsigned int seq, struct gnutls_x509_policy_st * policy)
- policies: The policies structure - seq: The index of the name to get - policy: Will hold the policy - This function will return a specific policy as stored in the - policiesstructure. The returned values should be treated as constant and valid for the lifetime of- policies.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned,- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEif the index is out of bounds, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_policies_init
- Function: int gnutls_x509_policies_init (gnutls_x509_policies_t * policies)
- policies: The authority key ID structure - This function will initialize an authority key ID structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_policies_set
- Function: int gnutls_x509_policies_set (gnutls_x509_policies_t policies, const struct gnutls_x509_policy_st * policy)
- policies: An initialized policies structure - policy: Contains the policy to set - This function will store the specified policy in the provided - policiesstructure.- Returns: On success, - GNUTLS_E_SUCCESS(0), otherwise a negative error value.- Since: 3.3.0 
gnutls_x509_policy_release
- Function: void gnutls_x509_policy_release (struct gnutls_x509_policy_st * policy)
- policy: a certificate policy - This function will deinitialize all memory associated with the provided - policy. The policy is allocated using- gnutls_x509_crt_get_policy().- Since: 3.1.5 
gnutls_x509_privkey_cpy
- Function: int gnutls_x509_privkey_cpy (gnutls_x509_privkey_t dst, gnutls_x509_privkey_t src)
- dst: The destination key, which should be initialized. - src: The source key - This function will copy a private key from source to destination key. Destination has to be initialized. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_deinit
- Function: void gnutls_x509_privkey_deinit (gnutls_x509_privkey_t key)
- key: The structure to be deinitialized - This function will deinitialize a private key structure. 
gnutls_x509_privkey_export
- Function: int gnutls_x509_privkey_export (gnutls_x509_privkey_t key, gnutls_x509_crt_fmt_t format, void * output_data, size_t * output_data_size)
- key: Holds the key - format: the format of output params. One of PEM or DER. - output_data: will contain a private key PEM or DER encoded - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will export the private key to a PKCS1 structure for RSA keys, or an integer sequence for DSA keys. The DSA keys are in the same format with the parameters used by openssl. - If the buffer provided is not long enough to hold the output, then * - output_data_sizeis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned.- If the structure is PEM encoded, it will have a header of "BEGIN RSA PRIVATE KEY". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_export2
- Function: int gnutls_x509_privkey_export2 (gnutls_x509_privkey_t key, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out)
- key: Holds the key - format: the format of output params. One of PEM or DER. - out: will contain a private key PEM or DER encoded - This function will export the private key to a PKCS1 structure for RSA keys, or an integer sequence for DSA keys. The DSA keys are in the same format with the parameters used by openssl. - The output buffer is allocated using - gnutls_malloc().- If the structure is PEM encoded, it will have a header of "BEGIN RSA PRIVATE KEY". - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since 3.1.3 
gnutls_x509_privkey_export2_pkcs8
- Function: int gnutls_x509_privkey_export2_pkcs8 (gnutls_x509_privkey_t key, gnutls_x509_crt_fmt_t format, const char * password, unsigned int flags, gnutls_datum_t * out)
- key: Holds the key - format: the format of output params. One of PEM or DER. - password: the password that will be used to encrypt the key. - flags: an ORed sequence of gnutls_pkcs_encrypt_flags_t - out: will contain a private key PEM or DER encoded - This function will export the private key to a PKCS8 structure. Both RSA and DSA keys can be exported. For DSA keys we use PKCS - 11definitions. If the flags do not specify the encryption cipher, then the default 3DES (PBES2) will be used.- The - passwordcan be either ASCII or UTF-8 in the default PBES2 encryption schemas, or ASCII for the PKCS12 schemas.- The output buffer is allocated using - gnutls_malloc().- If the structure is PEM encoded, it will have a header of "BEGIN ENCRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if encryption is not used. - Returns: In case of failure a negative error code will be returned, and 0 on success. - Since 3.1.3 
gnutls_x509_privkey_export_dsa_raw
- Function: int gnutls_x509_privkey_export_dsa_raw (gnutls_x509_privkey_t key, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y, gnutls_datum_t * x)
- key: a structure that holds the DSA parameters - p: will hold the p - q: will hold the q - g: will hold the g - y: will hold the y - x: will hold the x - This function will export the DSA private key’s parameters found in the given structure. The new parameters will be allocated using - gnutls_malloc()and will be stored in the appropriate datum.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_export_ecc_raw
- Function: int gnutls_x509_privkey_export_ecc_raw (gnutls_x509_privkey_t key, gnutls_ecc_curve_t * curve, gnutls_datum_t * x, gnutls_datum_t * y, gnutls_datum_t * k)
- key: a structure that holds the rsa parameters - curve: will hold the curve - x: will hold the x coordinate - y: will hold the y coordinate - k: will hold the private key - This function will export the ECC private key’s parameters found in the given structure. The new parameters will be allocated using - gnutls_malloc()and will be stored in the appropriate datum.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.0 
gnutls_x509_privkey_export_pkcs8
- Function: int gnutls_x509_privkey_export_pkcs8 (gnutls_x509_privkey_t key, gnutls_x509_crt_fmt_t format, const char * password, unsigned int flags, void * output_data, size_t * output_data_size)
- key: Holds the key - format: the format of output params. One of PEM or DER. - password: the password that will be used to encrypt the key. - flags: an ORed sequence of gnutls_pkcs_encrypt_flags_t - output_data: will contain a private key PEM or DER encoded - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will export the private key to a PKCS8 structure. Both RSA and DSA keys can be exported. For DSA keys we use PKCS - 11definitions. If the flags do not specify the encryption cipher, then the default 3DES (PBES2) will be used.- The - passwordcan be either ASCII or UTF-8 in the default PBES2 encryption schemas, or ASCII for the PKCS12 schemas.- If the buffer provided is not long enough to hold the output, then *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. - If the structure is PEM encoded, it will have a header of "BEGIN ENCRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if encryption is not used. - Returns: In case of failure a negative error code will be returned, and 0 on success. 
gnutls_x509_privkey_export_rsa_raw
- Function: int gnutls_x509_privkey_export_rsa_raw (gnutls_x509_privkey_t key, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u)
- key: a structure that holds the rsa parameters - m: will hold the modulus - e: will hold the public exponent - d: will hold the private exponent - p: will hold the first prime (p) - q: will hold the second prime (q) - u: will hold the coefficient - This function will export the RSA private key’s parameters found in the given structure. The new parameters will be allocated using - gnutls_malloc()and will be stored in the appropriate datum.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_export_rsa_raw2
- Function: int gnutls_x509_privkey_export_rsa_raw2 (gnutls_x509_privkey_t key, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u, gnutls_datum_t * e1, gnutls_datum_t * e2)
- key: a structure that holds the rsa parameters - m: will hold the modulus - e: will hold the public exponent - d: will hold the private exponent - p: will hold the first prime (p) - q: will hold the second prime (q) - u: will hold the coefficient - e1: will hold e1 = d mod (p-1) - e2: will hold e2 = d mod (q-1) - This function will export the RSA private key’s parameters found in the given structure. The new parameters will be allocated using - gnutls_malloc()and will be stored in the appropriate datum.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 2.12.0 
gnutls_x509_privkey_fix
- Function: int gnutls_x509_privkey_fix (gnutls_x509_privkey_t key)
- key: Holds the key - This function will recalculate the secondary parameters in a key. In RSA keys, this can be the coefficient and exponent1,2. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_generate
- Function: int gnutls_x509_privkey_generate (gnutls_x509_privkey_t key, gnutls_pk_algorithm_t algo, unsigned int bits, unsigned int flags)
- key: should contain a - gnutls_x509_privkey_tstructure- algo: is one of the algorithms in - gnutls_pk_algorithm_t.- bits: the size of the modulus - flags: unused for now. Must be 0. - This function will generate a random private key. Note that this function must be called on an empty private key. - Note that when generating an elliptic curve key, the curve can be substituted in the place of the bits parameter using the - GNUTLS_CURVE_TO_BITS()macro.- For DSA keys, if the subgroup size needs to be specified check the - GNUTLS_SUBGROUP_TO_BITS()macro.- Do not set the number of bits directly, use - gnutls_sec_param_to_pk_bits().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_get_key_id
- Function: int gnutls_x509_privkey_get_key_id (gnutls_x509_privkey_t key, unsigned int flags, unsigned char * output_data, size_t * output_data_size)
- key: Holds the key - flags: should be 0 for now - output_data: will contain the key ID - output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) - This function will return a unique ID that depends on the public key parameters. This ID can be used in checking whether a certificate corresponds to the given key. - If the buffer provided is not long enough to hold the output, then * - output_data_sizeis updated and- GNUTLS_E_SHORT_MEMORY_BUFFERwill be returned. The output will normally be a SHA-1 hash output, which is 20 bytes.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_get_pk_algorithm
- Function: int gnutls_x509_privkey_get_pk_algorithm (gnutls_x509_privkey_t key)
- key: should contain a - gnutls_x509_privkey_tstructure- This function will return the public key algorithm of a private key. - Returns: a member of the - gnutls_pk_algorithm_tenumeration on success, or a negative error code on error.
gnutls_x509_privkey_get_pk_algorithm2
- Function: int gnutls_x509_privkey_get_pk_algorithm2 (gnutls_x509_privkey_t key, unsigned int * bits)
- key: should contain a - gnutls_x509_privkey_tstructure- bits: The number of bits in the public key algorithm - This function will return the public key algorithm of a private key. - Returns: a member of the - gnutls_pk_algorithm_tenumeration on success, or a negative error code on error.
gnutls_x509_privkey_import
- Function: int gnutls_x509_privkey_import (gnutls_x509_privkey_t key, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format)
- key: The structure to store the parsed key - data: The DER or PEM encoded certificate. - format: One of DER or PEM - This function will convert the given DER or PEM encoded key to the native - gnutls_x509_privkey_tformat. The output will be stored in- key.- If the key is PEM encoded it should have a header that contains "PRIVATE KEY". Note that this function falls back to PKCS - 8decoding without password, if the default format fails to import.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_import2
- Function: int gnutls_x509_privkey_import2 (gnutls_x509_privkey_t key, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, const char * password, unsigned int flags)
- key: The structure to store the parsed key - data: The DER or PEM encoded key. - format: One of DER or PEM - password: A password (optional) - flags: an ORed sequence of gnutls_pkcs_encrypt_flags_t - This function will import the given DER or PEM encoded key, to the native - gnutls_x509_privkey_tformat, irrespective of the input format. The input format is auto-detected.- The supported formats are basic unencrypted key, PKCS8, PKCS12, and the openssl format. - If the provided key is encrypted but no password was given, then - GNUTLS_E_DECRYPTION_FAILEDis returned.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_import_dsa_raw
- Function: int gnutls_x509_privkey_import_dsa_raw (gnutls_x509_privkey_t key, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * g, const gnutls_datum_t * y, const gnutls_datum_t * x)
- key: The structure to store the parsed key - p: holds the p - q: holds the q - g: holds the g - y: holds the y - x: holds the x - This function will convert the given DSA raw parameters to the native - gnutls_x509_privkey_tformat. The output will be stored in- key.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_import_ecc_raw
- Function: int gnutls_x509_privkey_import_ecc_raw (gnutls_x509_privkey_t key, gnutls_ecc_curve_t curve, const gnutls_datum_t * x, const gnutls_datum_t * y, const gnutls_datum_t * k)
- key: The structure to store the parsed key - curve: holds the curve - x: holds the x - y: holds the y - k: holds the k - This function will convert the given elliptic curve parameters to the native - gnutls_x509_privkey_tformat. The output will be stored in- key.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.0 
gnutls_x509_privkey_import_openssl
- Function: int gnutls_x509_privkey_import_openssl (gnutls_x509_privkey_t key, const gnutls_datum_t * data, const char * password)
- key: The structure to store the parsed key - data: The DER or PEM encoded key. - password: the password to decrypt the key (if it is encrypted). - This function will convert the given PEM encrypted to the native gnutls_x509_privkey_t format. The output will be stored in - key.- The - passwordshould be in ASCII. If the password is not provided or wrong then- GNUTLS_E_DECRYPTION_FAILEDwill be returned.- If the Certificate is PEM encoded it should have a header of "PRIVATE KEY" and the "DEK-Info" header. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_import_pkcs8
- Function: int gnutls_x509_privkey_import_pkcs8 (gnutls_x509_privkey_t key, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, const char * password, unsigned int flags)
- key: The structure to store the parsed key - data: The DER or PEM encoded key. - format: One of DER or PEM - password: the password to decrypt the key (if it is encrypted). - flags: 0 if encrypted or GNUTLS_PKCS_PLAIN if not encrypted. - This function will convert the given DER or PEM encoded PKCS8 2.0 encrypted key to the native gnutls_x509_privkey_t format. The output will be stored in - key. Both RSA and DSA keys can be imported, and flags can only be used to indicate an unencrypted key.- The - passwordcan be either ASCII or UTF-8 in the default PBES2 encryption schemas, or ASCII for the PKCS12 schemas.- If the Certificate is PEM encoded it should have a header of "ENCRYPTED PRIVATE KEY", or "PRIVATE KEY". You only need to specify the flags if the key is DER encoded, since in that case the encryption status cannot be auto-detected. - If the - GNUTLS_PKCS_PLAINflag is specified and the supplied data are encrypted then- GNUTLS_E_DECRYPTION_FAILEDis returned.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_import_rsa_raw
- Function: int gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key, const gnutls_datum_t * m, const gnutls_datum_t * e, const gnutls_datum_t * d, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * u)
- key: The structure to store the parsed key - m: holds the modulus - e: holds the public exponent - d: holds the private exponent - p: holds the first prime (p) - q: holds the second prime (q) - u: holds the coefficient - This function will convert the given RSA raw parameters to the native - gnutls_x509_privkey_tformat. The output will be stored in- key.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_import_rsa_raw2
- Function: int gnutls_x509_privkey_import_rsa_raw2 (gnutls_x509_privkey_t key, const gnutls_datum_t * m, const gnutls_datum_t * e, const gnutls_datum_t * d, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * u, const gnutls_datum_t * e1, const gnutls_datum_t * e2)
- key: The structure to store the parsed key - m: holds the modulus - e: holds the public exponent - d: holds the private exponent - p: holds the first prime (p) - q: holds the second prime (q) - u: holds the coefficient (optional) - e1: holds e1 = d mod (p-1) (optional) - e2: holds e2 = d mod (q-1) (optional) - This function will convert the given RSA raw parameters to the native - gnutls_x509_privkey_tformat. The output will be stored in- key.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_init
- Function: int gnutls_x509_privkey_init (gnutls_x509_privkey_t * key)
- key: The structure to be initialized - This function will initialize an private key structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_privkey_sec_param
- Function: gnutls_sec_param_t gnutls_x509_privkey_sec_param (gnutls_x509_privkey_t key)
- key: a key structure - This function will return the security parameter appropriate with this private key. - Returns: On success, a valid security parameter is returned otherwise - GNUTLS_SEC_PARAM_UNKNOWNis returned.- Since: 2.12.0 
gnutls_x509_privkey_verify_params
- Function: int gnutls_x509_privkey_verify_params (gnutls_x509_privkey_t key)
- key: should contain a - gnutls_x509_privkey_tstructure- This function will verify the private key parameters. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
gnutls_x509_rdn_get
- Function: int gnutls_x509_rdn_get (const gnutls_datum_t * idn, char * buf, size_t * buf_size)
- idn: should contain a DER encoded RDN sequence - buf: a pointer to a structure to hold the peer’s name - buf_size: holds the size of - buf- This function will return the name of the given RDN sequence. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, or- GNUTLS_E_SHORT_MEMORY_BUFFERis returned and *- buf_sizeis updated if the provided buffer is not long enough, otherwise a negative error value.
gnutls_x509_rdn_get_by_oid
- Function: int gnutls_x509_rdn_get_by_oid (const gnutls_datum_t * idn, const char * oid, int indx, unsigned int raw_flag, void * buf, size_t * buf_size)
- idn: should contain a DER encoded RDN sequence - oid: an Object Identifier - indx: In case multiple same OIDs exist in the RDN indicates which to send. Use 0 for the first one. - raw_flag: If non-zero then the raw DER data are returned. - buf: a pointer to a structure to hold the peer’s name - buf_size: holds the size of - buf- This function will return the name of the given Object identifier, of the RDN sequence. The name will be encoded using the rules from RFC4514. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, or- GNUTLS_E_SHORT_MEMORY_BUFFERis returned and *- buf_sizeis updated if the provided buffer is not long enough, otherwise a negative error value.
gnutls_x509_rdn_get_oid
- Function: int gnutls_x509_rdn_get_oid (const gnutls_datum_t * idn, int indx, void * buf, size_t * buf_size)
- idn: should contain a DER encoded RDN sequence - indx: Indicates which OID to return. Use 0 for the first one. - buf: a pointer to a structure to hold the peer’s name OID - buf_size: holds the size of - buf- This function will return the specified Object identifier, of the RDN sequence. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, or- GNUTLS_E_SHORT_MEMORY_BUFFERis returned and *- buf_sizeis updated if the provided buffer is not long enough, otherwise a negative error value.- Since: 2.4.0 
gnutls_x509_trust_list_add_cas
- Function: int gnutls_x509_trust_list_add_cas (gnutls_x509_trust_list_t list, const gnutls_x509_crt_t * clist, unsigned clist_size, unsigned int flags)
- list: The structure of the list - clist: A list of CAs - clist_size: The length of the CA list - flags: should be 0 or an or’ed sequence of - GNUTLS_TLoptions.- This function will add the given certificate authorities to the trusted list. The list of CAs must not be deinitialized during this structure’s lifetime. - If the flag - GNUTLS_TL_NO_DUPLICATESis specified, then the provided- clistentries that are duplicates will not be added to the list and will be deinitialized.- Returns: The number of added elements is returned. - Since: 3.0.0 
gnutls_x509_trust_list_add_crls
- Function: int gnutls_x509_trust_list_add_crls (gnutls_x509_trust_list_t list, const gnutls_x509_crl_t * crl_list, int crl_size, unsigned int flags, unsigned int verification_flags)
- list: The structure of the list - crl_list: A list of CRLs - crl_size: The length of the CRL list - flags: if GNUTLS_TL_VERIFY_CRL is given the CRLs will be verified before being added. - verification_flags: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL - This function will add the given certificate revocation lists to the trusted list. The list of CRLs must not be deinitialized during this structure’s lifetime. - This function must be called after - gnutls_x509_trust_list_add_cas()to allow verifying the CRLs for validity.- Returns: The number of added elements is returned. - Since: 3.0 
gnutls_x509_trust_list_add_named_crt
- Function: int gnutls_x509_trust_list_add_named_crt (gnutls_x509_trust_list_t list, gnutls_x509_crt_t cert, const void * name, size_t name_size, unsigned int flags)
- list: The structure of the list - cert: A certificate - name: An identifier for the certificate - name_size: The size of the identifier - flags: should be 0. - This function will add the given certificate to the trusted list and associate it with a name. The certificate will not be be used for verification with - gnutls_x509_trust_list_verify_crt()but only with- gnutls_x509_trust_list_verify_named_crt().- In principle this function can be used to set individual "server" certificates that are trusted by the user for that specific server but for no other purposes. - The certificate must not be deinitialized during the lifetime of the trusted list. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.0.0 
gnutls_x509_trust_list_add_system_trust
- Function: int gnutls_x509_trust_list_add_system_trust (gnutls_x509_trust_list_t list, unsigned int tl_flags, unsigned int tl_vflags)
- list: The structure of the list - tl_flags: GNUTLS_TL_* - tl_vflags: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL - This function adds the system’s default trusted certificate authorities to the trusted list. Note that on unsupported system this function returns - GNUTLS_E_UNIMPLEMENTED_FEATURE.- Returns: The number of added elements or a negative error code on error. - Since: 3.1 
gnutls_x509_trust_list_add_trust_file
- Function: int gnutls_x509_trust_list_add_trust_file (gnutls_x509_trust_list_t list, const char * ca_file, const char * crl_file, gnutls_x509_crt_fmt_t type, unsigned int tl_flags, unsigned int tl_vflags)
- list: The structure of the list - ca_file: A file containing a list of CAs (optional) - crl_file: A file containing a list of CRLs (optional) - type: The format of the certificates - tl_flags: GNUTLS_TL_* - tl_vflags: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL - This function will add the given certificate authorities to the trusted list. pkcs11 URLs are also accepted, instead of files, by this function. - Returns: The number of added elements is returned. - Since: 3.1 
gnutls_x509_trust_list_add_trust_mem
- Function: int gnutls_x509_trust_list_add_trust_mem (gnutls_x509_trust_list_t list, const gnutls_datum_t * cas, const gnutls_datum_t * crls, gnutls_x509_crt_fmt_t type, unsigned int tl_flags, unsigned int tl_vflags)
- list: The structure of the list - cas: A buffer containing a list of CAs (optional) - crls: A buffer containing a list of CRLs (optional) - type: The format of the certificates - tl_flags: GNUTLS_TL_* - tl_vflags: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL - This function will add the given certificate authorities to the trusted list. - Returns: The number of added elements is returned. - Since: 3.1 
gnutls_x509_trust_list_deinit
- Function: void gnutls_x509_trust_list_deinit (gnutls_x509_trust_list_t list, unsigned int all)
- list: The structure to be deinitialized - all: if non-zero it will deinitialize all the certificates and CRLs contained in the structure. - This function will deinitialize a trust list. Note that the - allflag should be typically non-zero unless you have specified your certificates using- gnutls_x509_trust_list_add_cas()and you want to prevent them from being deinitialized by this function.- Since: 3.0.0 
gnutls_x509_trust_list_get_issuer
- Function: int gnutls_x509_trust_list_get_issuer (gnutls_x509_trust_list_t list, gnutls_x509_crt_t cert, gnutls_x509_crt_t * issuer, unsigned int flags)
- list: The structure of the list - cert: is the certificate to find issuer for - issuer: Will hold the issuer if any. Should be treated as constant. - flags: Use zero. - This function will attempt to find the issuer of the given certificate. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.0 
gnutls_x509_trust_list_init
- Function: int gnutls_x509_trust_list_init (gnutls_x509_trust_list_t * list, unsigned int size)
- list: The structure to be initialized - size: The size of the internal hash table. Use (0) for default size. - This function will initialize an X.509 trust list structure. - Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.0.0 
gnutls_x509_trust_list_remove_cas
- Function: int gnutls_x509_trust_list_remove_cas (gnutls_x509_trust_list_t list, const gnutls_x509_crt_t * clist, int clist_size)
- list: The structure of the list - clist: A list of CAs - clist_size: The length of the CA list - This function will remove the given certificate authorities from the trusted list. - Note that this function can accept certificates and authorities not yet known. In that case they will be kept in a separate black list that will be used during certificate verification. Unlike - gnutls_x509_trust_list_add_cas()there is no deinitialization restriction for certificate list provided in this function.- Returns: The number of removed elements is returned. - Since: 3.1.10 
gnutls_x509_trust_list_remove_trust_file
- Function: int gnutls_x509_trust_list_remove_trust_file (gnutls_x509_trust_list_t list, const char * ca_file, gnutls_x509_crt_fmt_t type)
- list: The structure of the list - ca_file: A file containing a list of CAs - type: The format of the certificates - This function will remove the given certificate authorities from the trusted list, and add them into a black list when needed. PKCS 11 URLs are also accepted, instead of files, by this function. - See also - gnutls_x509_trust_list_remove_cas().- Returns: The number of added elements is returned. - Since: 3.1.10 
gnutls_x509_trust_list_remove_trust_mem
- Function: int gnutls_x509_trust_list_remove_trust_mem (gnutls_x509_trust_list_t list, const gnutls_datum_t * cas, gnutls_x509_crt_fmt_t type)
- list: The structure of the list - cas: A buffer containing a list of CAs (optional) - type: The format of the certificates - This function will remove the provided certificate authorities from the trusted list, and add them into a black list when needed. - See also - gnutls_x509_trust_list_remove_cas().- Returns: The number of removed elements is returned. - Since: 3.1.10 
gnutls_x509_trust_list_verify_crt
- Function: int gnutls_x509_trust_list_verify_crt (gnutls_x509_trust_list_t list, gnutls_x509_crt_t * cert_list, unsigned int cert_list_size, unsigned int flags, unsigned int * voutput, gnutls_verify_output_function func)
- list: The structure of the list - cert_list: is the certificate list to be verified - cert_list_size: is the certificate list size - flags: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations. - voutput: will hold the certificate verification output. - func: If non-null will be called on each chain element verification with the output. - This function will try to verify the given certificate and return its status. The - verifyparameter will hold an OR’ed sequence of- gnutls_certificate_status_tflags.- Additionally a certificate verification profile can be specified from the ones in - gnutls_certificate_verification_profiles_tby ORing the result of- GNUTLS_PROFILE_TO_VFLAGS()to the verification flags.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.0 
gnutls_x509_trust_list_verify_named_crt
- Function: int gnutls_x509_trust_list_verify_named_crt (gnutls_x509_trust_list_t list, gnutls_x509_crt_t cert, const void * name, size_t name_size, unsigned int flags, unsigned int * voutput, gnutls_verify_output_function func)
- list: The structure of the list - cert: is the certificate to be verified - name: is the certificate’s name - name_size: is the certificate’s name size - flags: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations. - voutput: will hold the certificate verification output. - func: If non-null will be called on each chain element verification with the output. - This function will try to find a certificate that is associated with the provided name –see - gnutls_x509_trust_list_add_named_crt(). If a match is found the certificate is considered valid. In addition to that this function will also check CRLs. The- voutputparameter will hold an OR’ed sequence of- gnutls_certificate_status_tflags.- Additionally a certificate verification profile can be specified from the ones in - gnutls_certificate_verification_profiles_tby ORing the result of- GNUTLS_PROFILE_TO_VFLAGS()to the verification flags.- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.- Since: 3.0.0 
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
 
  This document was generated on May 31, 2014 using texi2html 5.0.
 
 
