Blame doc/dane-api.texi

Packit 549fdc
Packit 549fdc
@subheading dane_cert_type_name
Packit 549fdc
@anchor{dane_cert_type_name}
Packit 549fdc
@deftypefun {const char *} {dane_cert_type_name} (dane_cert_type_t @var{type})
Packit 549fdc
@var{type}: is a DANE match type
Packit 549fdc
Packit 549fdc
Convert a @code{dane_cert_type_t}  value to a string.
Packit 549fdc
Packit 549fdc
@strong{Returns:} a string that contains the name of the specified
Packit 549fdc
type, or @code{NULL} .
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_cert_usage_name
Packit 549fdc
@anchor{dane_cert_usage_name}
Packit 549fdc
@deftypefun {const char *} {dane_cert_usage_name} (dane_cert_usage_t @var{usage})
Packit 549fdc
@var{usage}: is a DANE certificate usage
Packit 549fdc
Packit 549fdc
Convert a @code{dane_cert_usage_t}  value to a string.
Packit 549fdc
Packit 549fdc
@strong{Returns:} a string that contains the name of the specified
Packit 549fdc
type, or @code{NULL} .
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_match_type_name
Packit 549fdc
@anchor{dane_match_type_name}
Packit 549fdc
@deftypefun {const char *} {dane_match_type_name} (dane_match_type_t @var{type})
Packit 549fdc
@var{type}: is a DANE match type
Packit 549fdc
Packit 549fdc
Convert a @code{dane_match_type_t}  value to a string.
Packit 549fdc
Packit 549fdc
@strong{Returns:} a string that contains the name of the specified
Packit 549fdc
type, or @code{NULL} .
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_query_data
Packit 549fdc
@anchor{dane_query_data}
Packit 549fdc
@deftypefun {int} {dane_query_data} (dane_query_t @var{q}, unsigned int @var{idx}, unsigned int * @var{usage}, unsigned int * @var{type}, unsigned int * @var{match}, gnutls_datum_t * @var{data})
Packit 549fdc
@var{q}: The query result structure
Packit 549fdc
Packit 549fdc
@var{idx}: The index of the query response.
Packit 549fdc
Packit 549fdc
@var{usage}: The certificate usage (see @code{dane_cert_usage_t} )
Packit 549fdc
Packit 549fdc
@var{type}: The certificate type (see @code{dane_cert_type_t} )
Packit 549fdc
Packit 549fdc
@var{match}: The DANE matching type (see @code{dane_match_type_t} )
Packit 549fdc
Packit 549fdc
@var{data}: The DANE data.
Packit 549fdc
Packit 549fdc
This function will provide the DANE data from the query
Packit 549fdc
response.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{DANE_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_query_deinit
Packit 549fdc
@anchor{dane_query_deinit}
Packit 549fdc
@deftypefun {void} {dane_query_deinit} (dane_query_t @var{q})
Packit 549fdc
@var{q}: The structure to be deinitialized
Packit 549fdc
Packit 549fdc
This function will deinitialize a DANE query result structure.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_query_entries
Packit 549fdc
@anchor{dane_query_entries}
Packit 549fdc
@deftypefun {unsigned int} {dane_query_entries} (dane_query_t @var{q})
Packit 549fdc
@var{q}: The query result structure
Packit 549fdc
Packit 549fdc
This function will return the number of entries in a query.
Packit 549fdc
Packit 549fdc
@strong{Returns:} The number of entries.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_query_status
Packit 549fdc
@anchor{dane_query_status}
Packit 549fdc
@deftypefun {dane_query_status_t} {dane_query_status} (dane_query_t @var{q})
Packit 549fdc
@var{q}: The query result structure
Packit 549fdc
Packit 549fdc
This function will return the status of the query response.
Packit 549fdc
See @code{dane_query_status_t}  for the possible types.
Packit 549fdc
Packit 549fdc
@strong{Returns:} The status type.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_query_tlsa
Packit 549fdc
@anchor{dane_query_tlsa}
Packit 549fdc
@deftypefun {int} {dane_query_tlsa} (dane_state_t @var{s}, dane_query_t * @var{r}, const char * @var{host}, const char * @var{proto}, unsigned int @var{port})
Packit 549fdc
@var{s}: The DANE state structure
Packit 549fdc
Packit 549fdc
@var{r}: A structure to place the result
Packit 549fdc
Packit 549fdc
@var{host}: The host name to resolve.
Packit 549fdc
Packit 549fdc
@var{proto}: The protocol type (tcp, udp, etc.)
Packit 549fdc
Packit 549fdc
@var{port}: The service port number (eg. 443).
Packit 549fdc
Packit 549fdc
This function will query the DNS server for the TLSA (DANE)
Packit 549fdc
data for the given host.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{DANE_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_query_to_raw_tlsa
Packit 549fdc
@anchor{dane_query_to_raw_tlsa}
Packit 549fdc
@deftypefun {int} {dane_query_to_raw_tlsa} (dane_query_t @var{q}, unsigned int * @var{data_entries}, char *** @var{dane_data}, int ** @var{dane_data_len}, int * @var{secure}, int * @var{bogus})
Packit 549fdc
@var{q}: The query result structure
Packit 549fdc
Packit 549fdc
@var{data_entries}: Pointer set to the number of entries in the query
Packit 549fdc
Packit 549fdc
@var{dane_data}: Pointer to contain an array of DNS rdata items, terminated with a NULL pointer;
Packit 549fdc
caller must guarantee that the referenced data remains
Packit 549fdc
valid until @code{dane_query_deinit()}  is called.
Packit 549fdc
Packit 549fdc
@var{dane_data_len}: Pointer to contain the length n bytes of the dane_data items
Packit 549fdc
Packit 549fdc
@var{secure}: Pointer set true if the result is validated securely, false if
Packit 549fdc
validation failed or the domain queried has no security info
Packit 549fdc
Packit 549fdc
@var{bogus}: Pointer set true if the result was not secure due to a security failure
Packit 549fdc
Packit 549fdc
This function will provide the DANE data from the query
Packit 549fdc
response.
Packit 549fdc
Packit 549fdc
The pointers dane_data and dane_data_len are allocated with @code{gnutls_malloc()} 
Packit 549fdc
to contain the data from the query result structure (individual
Packit 549fdc
 @code{dane_data} items simply point to the original data and are not allocated separately).
Packit 549fdc
The returned  @code{dane_data} are only valid during the lifetime of  @code{q} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{DANE_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_raw_tlsa
Packit 549fdc
@anchor{dane_raw_tlsa}
Packit 549fdc
@deftypefun {int} {dane_raw_tlsa} (dane_state_t @var{s}, dane_query_t * @var{r}, char *const * @var{dane_data}, const int * @var{dane_data_len}, int @var{secure}, int @var{bogus})
Packit 549fdc
@var{s}: The DANE state structure
Packit 549fdc
Packit 549fdc
@var{r}: A structure to place the result
Packit 549fdc
Packit 549fdc
@var{dane_data}: array of DNS rdata items, terminated with a NULL pointer;
Packit 549fdc
caller must guarantee that the referenced data remains
Packit 549fdc
valid until @code{dane_query_deinit()}  is called.
Packit 549fdc
Packit 549fdc
@var{dane_data_len}: the length n bytes of the dane_data items
Packit 549fdc
Packit 549fdc
@var{secure}: true if the result is validated securely, false if
Packit 549fdc
validation failed or the domain queried has no security info
Packit 549fdc
Packit 549fdc
@var{bogus}: if the result was not secure (secure = 0) due to a security failure,
Packit 549fdc
and the result is due to a security failure, bogus is true.
Packit 549fdc
Packit 549fdc
This function will fill in the TLSA (DANE) structure from
Packit 549fdc
the given raw DNS record data. The  @code{dane_data} must be valid
Packit 549fdc
during the lifetime of the query.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{DANE_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_state_deinit
Packit 549fdc
@anchor{dane_state_deinit}
Packit 549fdc
@deftypefun {void} {dane_state_deinit} (dane_state_t @var{s})
Packit 549fdc
@var{s}: The structure to be deinitialized
Packit 549fdc
Packit 549fdc
This function will deinitialize a DANE query structure.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_state_init
Packit 549fdc
@anchor{dane_state_init}
Packit 549fdc
@deftypefun {int} {dane_state_init} (dane_state_t * @var{s}, unsigned int @var{flags})
Packit 549fdc
@var{s}: The structure to be initialized
Packit 549fdc
Packit 549fdc
@var{flags}: flags from the @code{dane_state_flags}  enumeration
Packit 549fdc
Packit 549fdc
This function will initialize the backend resolver. It is
Packit 549fdc
intended to be used in scenarios where multiple resolvings
Packit 549fdc
occur, to optimize against multiple re-initializations.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{DANE_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_state_set_dlv_file
Packit 549fdc
@anchor{dane_state_set_dlv_file}
Packit 549fdc
@deftypefun {int} {dane_state_set_dlv_file} (dane_state_t @var{s}, const char * @var{file})
Packit 549fdc
@var{s}: The structure to be deinitialized
Packit 549fdc
Packit 549fdc
@var{file}: The file holding the DLV keys.
Packit 549fdc
Packit 549fdc
This function will set a file with trusted keys
Packit 549fdc
for DLV (DNSSEC Lookaside Validation).
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_strerror
Packit 549fdc
@anchor{dane_strerror}
Packit 549fdc
@deftypefun {const char *} {dane_strerror} (int @var{error})
Packit 549fdc
@var{error}: is a DANE error code, a negative error code
Packit 549fdc
Packit 549fdc
This function is similar to strerror.  The difference is that it
Packit 549fdc
accepts an error number returned by a gnutls function; In case of
Packit 549fdc
an unknown error a descriptive string is sent instead of @code{NULL} .
Packit 549fdc
Packit 549fdc
Error codes are always a negative error code.
Packit 549fdc
Packit 549fdc
@strong{Returns:} A string explaining the DANE error message.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_verification_status_print
Packit 549fdc
@anchor{dane_verification_status_print}
Packit 549fdc
@deftypefun {int} {dane_verification_status_print} (unsigned int @var{status}, gnutls_datum_t * @var{out}, unsigned int @var{flags})
Packit 549fdc
@var{status}: The status flags to be printed
Packit 549fdc
Packit 549fdc
@var{out}: Newly allocated datum with (0) terminated string.
Packit 549fdc
Packit 549fdc
@var{flags}: should be zero
Packit 549fdc
Packit 549fdc
This function will pretty print the status of a verification
Packit 549fdc
process -- eg. the one obtained by @code{dane_verify_crt()} .
Packit 549fdc
Packit 549fdc
The output  @code{out} needs to be deallocated using @code{gnutls_free()} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_verify_crt
Packit 549fdc
@anchor{dane_verify_crt}
Packit 549fdc
@deftypefun {int} {dane_verify_crt} (dane_state_t @var{s}, const gnutls_datum_t * @var{chain}, unsigned @var{chain_size}, gnutls_certificate_type_t @var{chain_type}, const char * @var{hostname}, const char * @var{proto}, unsigned int @var{port}, unsigned int @var{sflags}, unsigned int @var{vflags}, unsigned int * @var{verify})
Packit 549fdc
@var{s}: A DANE state structure (may be NULL)
Packit 549fdc
Packit 549fdc
@var{chain}: A certificate chain
Packit 549fdc
Packit 549fdc
@var{chain_size}: The size of the chain
Packit 549fdc
Packit 549fdc
@var{chain_type}: The type of the certificate chain
Packit 549fdc
Packit 549fdc
@var{hostname}: The hostname associated with the chain
Packit 549fdc
Packit 549fdc
@var{proto}: The protocol of the service connecting (e.g. tcp)
Packit 549fdc
Packit 549fdc
@var{port}: The port of the service connecting (e.g. 443)
Packit 549fdc
Packit 549fdc
@var{sflags}: Flags for the initialization of  @code{s} (if NULL)
Packit 549fdc
Packit 549fdc
@var{vflags}: Verification flags; an OR'ed list of @code{dane_verify_flags_t} .
Packit 549fdc
Packit 549fdc
@var{verify}: An OR'ed list of @code{dane_verify_status_t} .
Packit 549fdc
Packit 549fdc
This function will verify the given certificate chain against the
Packit 549fdc
CA constrains and/or the certificate available via DANE.
Packit 549fdc
If no information via DANE can be obtained the flag @code{DANE_VERIFY_NO_DANE_INFO} 
Packit 549fdc
is set. If a DNSSEC signature is not available for the DANE
Packit 549fdc
record then the verify flag @code{DANE_VERIFY_NO_DNSSEC_DATA}  is set.
Packit 549fdc
Packit 549fdc
Due to the many possible options of DANE, there is no single threat
Packit 549fdc
model countered. When notifying the user about DANE verification results
Packit 549fdc
it may be better to mention: DANE verification did not reject the certificate,
Packit 549fdc
rather than mentioning a successful DANE verication.
Packit 549fdc
Packit 549fdc
Note that this function is designed to be run in addition to
Packit 549fdc
PKIX - certificate chain - verification. To be run independently
Packit 549fdc
the @code{DANE_VFLAG_ONLY_CHECK_EE_USAGE}  flag should be specified; 
Packit 549fdc
then the function will check whether the key of the peer matches the
Packit 549fdc
key advertized in the DANE entry.
Packit 549fdc
Packit 549fdc
@strong{Returns:} a negative error code on error and @code{DANE_E_SUCCESS}  (0)
Packit 549fdc
when the DANE entries were successfully parsed, irrespective of
Packit 549fdc
whether they were verified (see  @code{verify} for that information). If
Packit 549fdc
no usable entries were encountered @code{DANE_E_REQUESTED_DATA_NOT_AVAILABLE} 
Packit 549fdc
will be returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_verify_crt_raw
Packit 549fdc
@anchor{dane_verify_crt_raw}
Packit 549fdc
@deftypefun {int} {dane_verify_crt_raw} (dane_state_t @var{s}, const gnutls_datum_t * @var{chain}, unsigned @var{chain_size}, gnutls_certificate_type_t @var{chain_type}, dane_query_t @var{r}, unsigned int @var{sflags}, unsigned int @var{vflags}, unsigned int * @var{verify})
Packit 549fdc
@var{s}: A DANE state structure (may be NULL)
Packit 549fdc
Packit 549fdc
@var{chain}: A certificate chain
Packit 549fdc
Packit 549fdc
@var{chain_size}: The size of the chain
Packit 549fdc
Packit 549fdc
@var{chain_type}: The type of the certificate chain
Packit 549fdc
Packit 549fdc
@var{r}: DANE data to check against
Packit 549fdc
Packit 549fdc
@var{sflags}: Flags for the initialization of  @code{s} (if NULL)
Packit 549fdc
Packit 549fdc
@var{vflags}: Verification flags; an OR'ed list of @code{dane_verify_flags_t} .
Packit 549fdc
Packit 549fdc
@var{verify}: An OR'ed list of @code{dane_verify_status_t} .
Packit 549fdc
Packit 549fdc
This is the low-level function of @code{dane_verify_crt()} . See the
Packit 549fdc
high level function for documentation.
Packit 549fdc
Packit 549fdc
This function does not perform any resolving, it utilizes
Packit 549fdc
cached entries from  @code{r} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} a negative error code on error and @code{DANE_E_SUCCESS}  (0)
Packit 549fdc
when the DANE entries were successfully parsed, irrespective of
Packit 549fdc
whether they were verified (see  @code{verify} for that information). If
Packit 549fdc
no usable entries were encountered @code{DANE_E_REQUESTED_DATA_NOT_AVAILABLE} 
Packit 549fdc
will be returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading dane_verify_session_crt
Packit 549fdc
@anchor{dane_verify_session_crt}
Packit 549fdc
@deftypefun {int} {dane_verify_session_crt} (dane_state_t @var{s}, gnutls_session_t @var{session}, const char * @var{hostname}, const char * @var{proto}, unsigned int @var{port}, unsigned int @var{sflags}, unsigned int @var{vflags}, unsigned int * @var{verify})
Packit 549fdc
@var{s}: A DANE state structure (may be NULL)
Packit 549fdc
Packit 549fdc
@var{session}: A gnutls session
Packit 549fdc
Packit 549fdc
@var{hostname}: The hostname associated with the chain
Packit 549fdc
Packit 549fdc
@var{proto}: The protocol of the service connecting (e.g. tcp)
Packit 549fdc
Packit 549fdc
@var{port}: The port of the service connecting (e.g. 443)
Packit 549fdc
Packit 549fdc
@var{sflags}: Flags for the initialization of  @code{s} (if NULL)
Packit 549fdc
Packit 549fdc
@var{vflags}: Verification flags; an OR'ed list of @code{dane_verify_flags_t} .
Packit 549fdc
Packit 549fdc
@var{verify}: An OR'ed list of @code{dane_verify_status_t} .
Packit 549fdc
Packit 549fdc
This function will verify session's certificate chain against the
Packit 549fdc
CA constrains and/or the certificate available via DANE.
Packit 549fdc
See @code{dane_verify_crt()}  for more information.
Packit 549fdc
Packit 549fdc
This will not verify the chain for validity; unless the DANE
Packit 549fdc
verification is restricted to end certificates, this must be
Packit 549fdc
be performed separately using @code{gnutls_certificate_verify_peers3()} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} a negative error code on error and @code{DANE_E_SUCCESS}  (0)
Packit 549fdc
when the DANE entries were successfully parsed, irrespective of
Packit 549fdc
whether they were verified (see  @code{verify} for that information). If
Packit 549fdc
no usable entries were encountered @code{DANE_E_REQUESTED_DATA_NOT_AVAILABLE} 
Packit 549fdc
will be returned.
Packit 549fdc
@end deftypefun
Packit 549fdc