| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
E.10 DANE API
The following functions are to be used for DANE certificate verification.
Their prototypes lie in ‘gnutls/dane.h’. Note that you need to link
with the libgnutls-dane library to use them.
dane_cert_type_name
- Function: const char * dane_cert_type_name (dane_cert_type_t type)
- type: is a DANE match type - Convert a - dane_cert_type_tvalue to a string.- Returns: a string that contains the name of the specified type, or - NULL.
dane_cert_usage_name
- Function: const char * dane_cert_usage_name (dane_cert_usage_t usage)
- usage: – undescribed – - Convert a - dane_cert_usage_tvalue to a string.- Returns: a string that contains the name of the specified type, or - NULL.
dane_match_type_name
- Function: const char * dane_match_type_name (dane_match_type_t type)
- type: is a DANE match type - Convert a - dane_match_type_tvalue to a string.- Returns: a string that contains the name of the specified type, or - NULL.
dane_query_data
- Function: int dane_query_data (dane_query_t q, unsigned int idx, unsigned int * usage, unsigned int * type, unsigned int * match, gnutls_datum_t * data)
- q: The query result structure - idx: The index of the query response. - usage: The certificate usage (see - dane_cert_usage_t)- type: The certificate type (see - dane_cert_type_t)- match: The DANE matching type (see - dane_match_type_t)- data: The DANE data. - This function will provide the DANE data from the query response. - Returns: On success, - DANE_E_SUCCESS(0) is returned, otherwise a negative error value.
dane_query_deinit
- Function: void dane_query_deinit (dane_query_t q)
- q: The structure to be deinitialized - This function will deinitialize a DANE query result structure. 
dane_query_entries
- Function: unsigned int dane_query_entries (dane_query_t q)
- q: The query result structure - This function will return the number of entries in a query. - Returns: The number of entries. 
dane_query_status
- Function: dane_query_status_t dane_query_status (dane_query_t q)
- q: The query result structure - This function will return the status of the query response. See - dane_query_status_tfor the possible types.- Returns: The status type. 
dane_query_tlsa
- Function: int dane_query_tlsa (dane_state_t s, dane_query_t * r, const char * host, const char * proto, unsigned int port)
- s: The DANE state structure - r: A structure to place the result - host: The host name to resolve. - proto: The protocol type (tcp, udp, etc.) - port: The service port number (eg. 443). - This function will query the DNS server for the TLSA (DANE) data for the given host. - Returns: On success, - DANE_E_SUCCESS(0) is returned, otherwise a negative error value.
dane_raw_tlsa
- Function: int dane_raw_tlsa (dane_state_t s, dane_query_t * r, char *const * dane_data, const int * dane_data_len, int secure, int bogus)
- s: The DANE state structure - r: A structure to place the result - dane_data: array of DNS rdata items, terminated with a NULL pointer; caller must guarantee that the referenced data remains valid until - dane_query_deinit()is called.- dane_data_len: the length n bytes of the dane_data items - secure: true if the result is validated securely, false if validation failed or the domain queried has no security info - bogus: if the result was not secure (secure = 0) due to a security failure, and the result is due to a security failure, bogus is true. - This function will fill in the TLSA (DANE) structure from the given raw DNS record data. - Returns: On success, - DANE_E_SUCCESS(0) is returned, otherwise a negative error value.
dane_state_deinit
- Function: void dane_state_deinit (dane_state_t s)
- s: The structure to be deinitialized - This function will deinitialize a DANE query structure. 
dane_state_init
- Function: int dane_state_init (dane_state_t * s, unsigned int flags)
- s: The structure to be initialized - flags: flags from the - dane_state_flagsenumeration- This function will initialize a DANE query structure. - Returns: On success, - DANE_E_SUCCESS(0) is returned, otherwise a negative error value.
dane_state_set_dlv_file
- Function: int dane_state_set_dlv_file (dane_state_t s, const char * file)
- s: The structure to be deinitialized - file: The file holding the DLV keys. - This function will set a file with trusted keys for DLV (DNSSEC Lookaside Validation). 
dane_strerror
- Function: const char * dane_strerror (int error)
- error: is a DANE error code, a negative error code - This function is similar to strerror. The difference is that it accepts an error number returned by a gnutls function; In case of an unknown error a descriptive string is sent instead of - NULL.- Error codes are always a negative error code. - Returns: A string explaining the DANE error message. 
dane_verification_status_print
- Function: int dane_verification_status_print (unsigned int status, gnutls_datum_t * out, unsigned int flags)
- status: The status flags to be printed - out: Newly allocated datum with (0) terminated string. - flags: should be zero - This function will pretty print the status of a verification process – eg. the one obtained by - dane_verify_crt().- The output - outneeds to be deallocated using- gnutls_free().- Returns: On success, - GNUTLS_E_SUCCESS(0) is returned, otherwise a negative error value.
dane_verify_crt
- Function: int dane_verify_crt (dane_state_t s, const gnutls_datum_t * chain, unsigned chain_size, gnutls_certificate_type_t chain_type, const char * hostname, const char * proto, unsigned int port, unsigned int sflags, unsigned int vflags, unsigned int * verify)
- s: A DANE state structure (may be NULL) - chain: A certificate chain - chain_size: The size of the chain - chain_type: The type of the certificate chain - hostname: The hostname associated with the chain - proto: The protocol of the service connecting (e.g. tcp) - port: The port of the service connecting (e.g. 443) - sflags: Flags for the the initialization of - s(if NULL)- vflags: Verification flags; an OR’ed list of - dane_verify_flags_t.- verify: An OR’ed list of - dane_verify_status_t.- This function will verify the given certificate chain against the CA constrains and/or the certificate available via DANE. If no information via DANE can be obtained the flag - DANE_VERIFY_NO_DANE_INFOis set. If a DNSSEC signature is not available for the DANE record then the verify flag- DANE_VERIFY_NO_DNSSEC_DATAis set.- Note that the CA constraint only applies for the directly certifying CA and does not account for long CA chains. Moreover this function does not validate the provided chain. - Due to the many possible options of DANE, there is no single threat model countered. When notifying the user about DANE verification results it may be better to mention: DANE verification did not reject the certificate, rather than mentioning a successful DANE verication. - If the - qparameter is provided it will be used for caching entries.- Returns: On success, - DANE_E_SUCCESS(0) is returned, otherwise a negative error value.
dane_verify_crt_raw
- Function: int dane_verify_crt_raw (dane_state_t s, const gnutls_datum_t * chain, unsigned chain_size, gnutls_certificate_type_t chain_type, dane_query_t r, unsigned int sflags, unsigned int vflags, unsigned int * verify)
- s: A DANE state structure (may be NULL) - chain: A certificate chain - chain_size: The size of the chain - chain_type: The type of the certificate chain - r: DANE data to check against - sflags: Flags for the the initialization of - s(if NULL)- vflags: Verification flags; an OR’ed list of - dane_verify_flags_t.- verify: An OR’ed list of - dane_verify_status_t.- This function will verify the given certificate chain against the CA constrains and/or the certificate available via DANE. If no information via DANE can be obtained the flag - DANE_VERIFY_NO_DANE_INFOis set. If a DNSSEC signature is not available for the DANE record then the verify flag- DANE_VERIFY_NO_DNSSEC_DATAis set.- Note that the CA constraint only applies for the directly certifying CA and does not account for long CA chains. - Due to the many possible options of DANE, there is no single threat model countered. When notifying the user about DANE verification results it may be better to mention: DANE verification did not reject the certificate, rather than mentioning a successful DANE verication. - If the - qparameter is provided it will be used for caching entries.- Returns: On success, - DANE_E_SUCCESS(0) is returned, otherwise a negative error value.
dane_verify_session_crt
- Function: int dane_verify_session_crt (dane_state_t s, gnutls_session_t session, const char * hostname, const char * proto, unsigned int port, unsigned int sflags, unsigned int vflags, unsigned int * verify)
- s: A DANE state structure (may be NULL) - session: A gnutls session - hostname: The hostname associated with the chain - proto: The protocol of the service connecting (e.g. tcp) - port: The port of the service connecting (e.g. 443) - sflags: Flags for the the initialization of - s(if NULL)- vflags: Verification flags; an OR’ed list of - dane_verify_flags_t.- verify: An OR’ed list of - dane_verify_status_t.- This function will verify session’s certificate chain against the CA constrains and/or the certificate available via DANE. See - dane_verify_crt()for more information.- This will not verify the chain for validity; unless the DANE verification is restricted to end certificates, this has to be performed separately using - gnutls_certificate_verify_peers3().- Returns: On success, - DANE_E_SUCCESS(0) is returned, otherwise a negative error value.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
 
  This document was generated on May 31, 2014 using texi2html 5.0.
 
 
