Blame doc/ocsp-api.texi

Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_add_cert
Packit 549fdc
@anchor{gnutls_ocsp_req_add_cert}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_add_cert} (gnutls_ocsp_req_t @var{req}, gnutls_digest_algorithm_t @var{digest}, gnutls_x509_crt_t @var{issuer}, gnutls_x509_crt_t @var{cert})
Packit 549fdc
@var{req}: should contain a @code{gnutls_ocsp_req_t}  type
Packit 549fdc
Packit 549fdc
@var{digest}: hash algorithm, a @code{gnutls_digest_algorithm_t}  value
Packit 549fdc
Packit 549fdc
@var{issuer}: issuer of  @code{subject} certificate
Packit 549fdc
Packit 549fdc
@var{cert}: certificate to request status for
Packit 549fdc
Packit 549fdc
This function will add another request to the OCSP request for a
Packit 549fdc
particular certificate.  The issuer name hash, issuer key hash, and
Packit 549fdc
serial number fields is populated as follows.  The issuer name and
Packit 549fdc
the serial number is taken from  @code{cert} .  The issuer key is taken
Packit 549fdc
from  @code{issuer} .  The hashed values will be hashed using the  @code{digest} algorithm, normally @code{GNUTLS_DIG_SHA1} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_add_cert_id
Packit 549fdc
@anchor{gnutls_ocsp_req_add_cert_id}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_add_cert_id} (gnutls_ocsp_req_t @var{req}, gnutls_digest_algorithm_t @var{digest}, const gnutls_datum_t * @var{issuer_name_hash}, const gnutls_datum_t * @var{issuer_key_hash}, const gnutls_datum_t * @var{serial_number})
Packit 549fdc
@var{req}: should contain a @code{gnutls_ocsp_req_t}  type
Packit 549fdc
Packit 549fdc
@var{digest}: hash algorithm, a @code{gnutls_digest_algorithm_t}  value
Packit 549fdc
Packit 549fdc
@var{issuer_name_hash}: hash of issuer's DN
Packit 549fdc
Packit 549fdc
@var{issuer_key_hash}: hash of issuer's public key
Packit 549fdc
Packit 549fdc
@var{serial_number}: serial number of certificate to check
Packit 549fdc
Packit 549fdc
This function will add another request to the OCSP request for a
Packit 549fdc
particular certificate having the issuer name hash of
Packit 549fdc
 @code{issuer_name_hash} and issuer key hash of  @code{issuer_key_hash} (both
Packit 549fdc
hashed using  @code{digest} ) and serial number  @code{serial_number} .
Packit 549fdc
Packit 549fdc
The information needed corresponds to the CertID structure:
Packit 549fdc
Packit 549fdc
<informalexample><programlisting>
Packit 549fdc
CertID	  ::=     SEQUENCE @{
Packit 549fdc
hashAlgorithm       AlgorithmIdentifier,
Packit 549fdc
issuerNameHash      OCTET STRING, -- Hash of Issuer's DN
Packit 549fdc
issuerKeyHash       OCTET STRING, -- Hash of Issuers public key
Packit 549fdc
serialNumber	CertificateSerialNumber @}
Packit 549fdc
</programlisting></informalexample>
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_deinit
Packit 549fdc
@anchor{gnutls_ocsp_req_deinit}
Packit 549fdc
@deftypefun {void} {gnutls_ocsp_req_deinit} (gnutls_ocsp_req_t @var{req})
Packit 549fdc
@var{req}: The data to be deinitialized
Packit 549fdc
Packit 549fdc
This function will deinitialize a OCSP request structure.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_export
Packit 549fdc
@anchor{gnutls_ocsp_req_export}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_export} (gnutls_ocsp_req_t @var{req}, gnutls_datum_t * @var{data})
Packit 549fdc
@var{req}: Holds the OCSP request
Packit 549fdc
Packit 549fdc
@var{data}: newly allocate buffer holding DER encoded OCSP request
Packit 549fdc
Packit 549fdc
This function will export the OCSP request to DER format.
Packit 549fdc
Packit 549fdc
@strong{Returns:} In case of failure a negative error code will be
Packit 549fdc
returned, and 0 on success.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_get_cert_id
Packit 549fdc
@anchor{gnutls_ocsp_req_get_cert_id}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_get_cert_id} (gnutls_ocsp_req_t @var{req}, unsigned @var{indx}, gnutls_digest_algorithm_t * @var{digest}, gnutls_datum_t * @var{issuer_name_hash}, gnutls_datum_t * @var{issuer_key_hash}, gnutls_datum_t * @var{serial_number})
Packit 549fdc
@var{req}: should contain a @code{gnutls_ocsp_req_t}  type
Packit 549fdc
Packit 549fdc
@var{indx}: Specifies which extension OID to get. Use (0) to get the first one.
Packit 549fdc
Packit 549fdc
@var{digest}: output variable with @code{gnutls_digest_algorithm_t}  hash algorithm
Packit 549fdc
Packit 549fdc
@var{issuer_name_hash}: output buffer with hash of issuer's DN
Packit 549fdc
Packit 549fdc
@var{issuer_key_hash}: output buffer with hash of issuer's public key
Packit 549fdc
Packit 549fdc
@var{serial_number}: output buffer with serial number of certificate to check
Packit 549fdc
Packit 549fdc
This function will return the certificate information of the
Packit 549fdc
 @code{indx} 'ed request in the OCSP request.  The information returned
Packit 549fdc
corresponds to the CertID structure:
Packit 549fdc
Packit 549fdc
<informalexample><programlisting>
Packit 549fdc
CertID	  ::=     SEQUENCE @{
Packit 549fdc
hashAlgorithm       AlgorithmIdentifier,
Packit 549fdc
issuerNameHash      OCTET STRING, -- Hash of Issuer's DN
Packit 549fdc
issuerKeyHash       OCTET STRING, -- Hash of Issuers public key
Packit 549fdc
serialNumber	CertificateSerialNumber @}
Packit 549fdc
</programlisting></informalexample>
Packit 549fdc
Packit 549fdc
Each of the pointers to output variables may be NULL to indicate
Packit 549fdc
that the caller is not interested in that value.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.  If you have reached the last
Packit 549fdc
CertID available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be
Packit 549fdc
returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_get_extension
Packit 549fdc
@anchor{gnutls_ocsp_req_get_extension}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_get_extension} (gnutls_ocsp_req_t @var{req}, unsigned @var{indx}, gnutls_datum_t * @var{oid}, unsigned int * @var{critical}, gnutls_datum_t * @var{data})
Packit 549fdc
@var{req}: should contain a @code{gnutls_ocsp_req_t}  type
Packit 549fdc
Packit 549fdc
@var{indx}: Specifies which extension OID to get. Use (0) to get the first one.
Packit 549fdc
Packit 549fdc
@var{oid}: will hold newly allocated buffer with OID of extension, may be NULL
Packit 549fdc
Packit 549fdc
@var{critical}: output variable with critical flag, may be NULL.
Packit 549fdc
Packit 549fdc
@var{data}: will hold newly allocated buffer with extension data, may be NULL
Packit 549fdc
Packit 549fdc
This function will return all information about the requested
Packit 549fdc
extension in the OCSP request.  The information returned is the
Packit 549fdc
OID, the critical flag, and the data itself.  The extension OID
Packit 549fdc
will be stored as a string.  Any of  @code{oid} ,  @code{critical} , and  @code{data} may
Packit 549fdc
be NULL which means that the caller is not interested in getting
Packit 549fdc
that information back.
Packit 549fdc
Packit 549fdc
The caller needs to deallocate memory by calling @code{gnutls_free()}  on
Packit 549fdc
 @code{oid} ->data and  @code{data} ->data.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.  If you have reached the last
Packit 549fdc
extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will
Packit 549fdc
be returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_get_nonce
Packit 549fdc
@anchor{gnutls_ocsp_req_get_nonce}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_get_nonce} (gnutls_ocsp_req_t @var{req}, unsigned int * @var{critical}, gnutls_datum_t * @var{nonce})
Packit 549fdc
@var{req}: should contain a @code{gnutls_ocsp_req_t}  type
Packit 549fdc
Packit 549fdc
@var{critical}: whether nonce extension is marked critical, or NULL
Packit 549fdc
Packit 549fdc
@var{nonce}: will hold newly allocated buffer with nonce data
Packit 549fdc
Packit 549fdc
This function will return the OCSP request nonce extension data.
Packit 549fdc
Packit 549fdc
The caller needs to deallocate memory by calling @code{gnutls_free()}  on
Packit 549fdc
 @code{nonce} ->data.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_get_version
Packit 549fdc
@anchor{gnutls_ocsp_req_get_version}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_get_version} (gnutls_ocsp_req_t @var{req})
Packit 549fdc
@var{req}: should contain a @code{gnutls_ocsp_req_t}  type
Packit 549fdc
Packit 549fdc
This function will return the version of the OCSP request.
Packit 549fdc
Typically this is always 1 indicating version 1.
Packit 549fdc
Packit 549fdc
@strong{Returns:} version of OCSP request, or a negative error code on error.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_import
Packit 549fdc
@anchor{gnutls_ocsp_req_import}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_import} (gnutls_ocsp_req_t @var{req}, const gnutls_datum_t * @var{data})
Packit 549fdc
@var{req}: The data to store the parsed request.
Packit 549fdc
Packit 549fdc
@var{data}: DER encoded OCSP request.
Packit 549fdc
Packit 549fdc
This function will convert the given DER encoded OCSP request to
Packit 549fdc
the native @code{gnutls_ocsp_req_t}  format. The output will be stored in
Packit 549fdc
 @code{req} .
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 gnutls_ocsp_req_init
Packit 549fdc
@anchor{gnutls_ocsp_req_init}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_init} (gnutls_ocsp_req_t * @var{req})
Packit 549fdc
@var{req}: A pointer to the type to be initialized
Packit 549fdc
Packit 549fdc
This function will initialize an OCSP request structure.
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 gnutls_ocsp_req_print
Packit 549fdc
@anchor{gnutls_ocsp_req_print}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_print} (gnutls_ocsp_req_t @var{req}, gnutls_ocsp_print_formats_t @var{format}, gnutls_datum_t * @var{out})
Packit 549fdc
@var{req}: The data to be printed
Packit 549fdc
Packit 549fdc
@var{format}: Indicate the format to use
Packit 549fdc
Packit 549fdc
@var{out}: Newly allocated datum with (0) terminated string.
Packit 549fdc
Packit 549fdc
This function will pretty print a OCSP request, suitable for
Packit 549fdc
display to a human.
Packit 549fdc
Packit 549fdc
If the format is @code{GNUTLS_OCSP_PRINT_FULL}  then all fields of the
Packit 549fdc
request will be output, on multiple lines.
Packit 549fdc
Packit 549fdc
The output  @code{out} ->data needs to be deallocate 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 gnutls_ocsp_req_randomize_nonce
Packit 549fdc
@anchor{gnutls_ocsp_req_randomize_nonce}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_randomize_nonce} (gnutls_ocsp_req_t @var{req})
Packit 549fdc
@var{req}: should contain a @code{gnutls_ocsp_req_t}  type
Packit 549fdc
Packit 549fdc
This function will add or update an nonce extension to the OCSP
Packit 549fdc
request with a newly generated random value.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_set_extension
Packit 549fdc
@anchor{gnutls_ocsp_req_set_extension}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_set_extension} (gnutls_ocsp_req_t @var{req}, const char * @var{oid}, unsigned int @var{critical}, const gnutls_datum_t * @var{data})
Packit 549fdc
@var{req}: should contain a @code{gnutls_ocsp_req_t}  type
Packit 549fdc
Packit 549fdc
@var{oid}: buffer with OID of extension as a string.
Packit 549fdc
Packit 549fdc
@var{critical}: critical flag, normally false.
Packit 549fdc
Packit 549fdc
@var{data}: the extension data
Packit 549fdc
Packit 549fdc
This function will add an extension to the OCSP request.  Calling
Packit 549fdc
this function multiple times for the same OID will overwrite values
Packit 549fdc
from earlier calls.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_req_set_nonce
Packit 549fdc
@anchor{gnutls_ocsp_req_set_nonce}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_req_set_nonce} (gnutls_ocsp_req_t @var{req}, unsigned int @var{critical}, const gnutls_datum_t * @var{nonce})
Packit 549fdc
@var{req}: should contain a @code{gnutls_ocsp_req_t}  type
Packit 549fdc
Packit 549fdc
@var{critical}: critical flag, normally false.
Packit 549fdc
Packit 549fdc
@var{nonce}: the nonce data
Packit 549fdc
Packit 549fdc
This function will add an nonce extension to the OCSP request.
Packit 549fdc
Calling this function multiple times will overwrite values from
Packit 549fdc
earlier calls.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_check_crt
Packit 549fdc
@anchor{gnutls_ocsp_resp_check_crt}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_check_crt} (gnutls_ocsp_resp_t @var{resp}, unsigned int @var{indx}, gnutls_x509_crt_t @var{crt})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{indx}: Specifies response number to get. Use (0) to get the first one.
Packit 549fdc
Packit 549fdc
@var{crt}: The certificate to check
Packit 549fdc
Packit 549fdc
This function will check whether the OCSP response
Packit 549fdc
is about the provided certificate.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.  
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.1.3
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_deinit
Packit 549fdc
@anchor{gnutls_ocsp_resp_deinit}
Packit 549fdc
@deftypefun {void} {gnutls_ocsp_resp_deinit} (gnutls_ocsp_resp_t @var{resp})
Packit 549fdc
@var{resp}: The data to be deinitialized
Packit 549fdc
Packit 549fdc
This function will deinitialize a OCSP response structure.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_export
Packit 549fdc
@anchor{gnutls_ocsp_resp_export}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_export} (gnutls_ocsp_resp_t @var{resp}, gnutls_datum_t * @var{data})
Packit 549fdc
@var{resp}: Holds the OCSP response
Packit 549fdc
Packit 549fdc
@var{data}: newly allocate buffer holding DER encoded OCSP response
Packit 549fdc
Packit 549fdc
This function will export the OCSP response to DER format.
Packit 549fdc
Packit 549fdc
@strong{Returns:} In case of failure a negative error code will be
Packit 549fdc
returned, and 0 on success.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_certs
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_certs}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_certs} (gnutls_ocsp_resp_t @var{resp}, gnutls_x509_crt_t ** @var{certs}, size_t * @var{ncerts})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{certs}: newly allocated array with @code{gnutls_x509_crt_t}  certificates
Packit 549fdc
Packit 549fdc
@var{ncerts}: output variable with number of allocated certs.
Packit 549fdc
Packit 549fdc
This function will extract the X.509 certificates found in the
Packit 549fdc
Basic OCSP Response.  The  @code{certs} output variable will hold a newly
Packit 549fdc
allocated zero-terminated array with X.509 certificates.
Packit 549fdc
Packit 549fdc
Every certificate in the array needs to be de-allocated with
Packit 549fdc
@code{gnutls_x509_crt_deinit()}  and the array itself must be freed using
Packit 549fdc
@code{gnutls_free()} .
Packit 549fdc
Packit 549fdc
Both the  @code{certs} and  @code{ncerts} variables may be NULL.  Then the
Packit 549fdc
function will work as normal but will not return the NULL:d
Packit 549fdc
information.  This can be used to get the number of certificates
Packit 549fdc
only, or to just get the certificate array without its size.
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 gnutls_ocsp_resp_get_extension
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_extension}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_extension} (gnutls_ocsp_resp_t @var{resp}, unsigned @var{indx}, gnutls_datum_t * @var{oid}, unsigned int * @var{critical}, gnutls_datum_t * @var{data})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{indx}: Specifies which extension OID to get. Use (0) to get the first one.
Packit 549fdc
Packit 549fdc
@var{oid}: will hold newly allocated buffer with OID of extension, may be NULL
Packit 549fdc
Packit 549fdc
@var{critical}: output variable with critical flag, may be NULL.
Packit 549fdc
Packit 549fdc
@var{data}: will hold newly allocated buffer with extension data, may be NULL
Packit 549fdc
Packit 549fdc
This function will return all information about the requested
Packit 549fdc
extension in the OCSP response.  The information returned is the
Packit 549fdc
OID, the critical flag, and the data itself.  The extension OID
Packit 549fdc
will be stored as a string.  Any of  @code{oid} ,  @code{critical} , and  @code{data} may
Packit 549fdc
be NULL which means that the caller is not interested in getting
Packit 549fdc
that information back.
Packit 549fdc
Packit 549fdc
The caller needs to deallocate memory by calling @code{gnutls_free()}  on
Packit 549fdc
 @code{oid} ->data and  @code{data} ->data.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.  If you have reached the last
Packit 549fdc
extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will
Packit 549fdc
be returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_nonce
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_nonce}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_nonce} (gnutls_ocsp_resp_t @var{resp}, unsigned int * @var{critical}, gnutls_datum_t * @var{nonce})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{critical}: whether nonce extension is marked critical
Packit 549fdc
Packit 549fdc
@var{nonce}: will hold newly allocated buffer with nonce data
Packit 549fdc
Packit 549fdc
This function will return the Basic OCSP Response nonce extension
Packit 549fdc
data.
Packit 549fdc
Packit 549fdc
The caller needs to deallocate memory by calling @code{gnutls_free()}  on
Packit 549fdc
 @code{nonce} ->data.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_produced
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_produced}
Packit 549fdc
@deftypefun {time_t} {gnutls_ocsp_resp_get_produced} (gnutls_ocsp_resp_t @var{resp})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
This function will return the time when the OCSP response was
Packit 549fdc
signed.
Packit 549fdc
Packit 549fdc
@strong{Returns:} signing time, or (time_t)-1 on error.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_responder
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_responder}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_responder} (gnutls_ocsp_resp_t @var{resp}, gnutls_datum_t * @var{dn})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{dn}: newly allocated buffer with name
Packit 549fdc
Packit 549fdc
This function will extract the name of the Basic OCSP Response in
Packit 549fdc
the provided buffer. The name will be in the form
Packit 549fdc
"C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253. The output string
Packit 549fdc
will be ASCII or UTF-8 encoded, depending on the certificate data.
Packit 549fdc
Packit 549fdc
If the responder ID is not a name but a hash, this function
Packit 549fdc
will return zero and the  @code{dn} elements will be set to @code{NULL} .
Packit 549fdc
Packit 549fdc
The caller needs to deallocate memory by calling @code{gnutls_free()}  on
Packit 549fdc
 @code{dn} ->data.
Packit 549fdc
Packit 549fdc
This function does not output a fully RFC4514 compliant string, if
Packit 549fdc
that is required see @code{gnutls_ocsp_resp_get_responder2()} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned. When no data exist it will
Packit 549fdc
return success and set  @code{dn} elements to zero.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_responder2
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_responder2}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_responder2} (gnutls_ocsp_resp_t @var{resp}, gnutls_datum_t * @var{dn}, unsigned @var{flags})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{dn}: newly allocated buffer with name
Packit 549fdc
Packit 549fdc
@var{flags}: zero or @code{GNUTLS_X509_DN_FLAG_COMPAT} 
Packit 549fdc
Packit 549fdc
This function will extract the name of the Basic OCSP Response in
Packit 549fdc
the provided buffer. The name will be in the form
Packit 549fdc
"C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253. The output string
Packit 549fdc
will be ASCII or UTF-8 encoded, depending on the certificate data.
Packit 549fdc
Packit 549fdc
If the responder ID is not a name but a hash, this function
Packit 549fdc
will return zero and the  @code{dn} elements will be set to @code{NULL} .
Packit 549fdc
Packit 549fdc
The caller needs to deallocate memory by calling @code{gnutls_free()}  on
Packit 549fdc
 @code{dn} ->data.
Packit 549fdc
Packit 549fdc
When the flag @code{GNUTLS_X509_DN_FLAG_COMPAT}  is specified, the output
Packit 549fdc
format will match the format output by previous to 3.5.6 versions of GnuTLS
Packit 549fdc
which was not not fully RFC4514-compliant.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned. When no data exist it will return
Packit 549fdc
@code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} .
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_responder_raw_id
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_responder_raw_id}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_responder_raw_id} (gnutls_ocsp_resp_t @var{resp}, unsigned @var{type}, gnutls_datum_t * @var{raw})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{type}: should be @code{GNUTLS_OCSP_RESP_ID_KEY}  or @code{GNUTLS_OCSP_RESP_ID_DN} 
Packit 549fdc
Packit 549fdc
@var{raw}: newly allocated buffer with the raw ID
Packit 549fdc
Packit 549fdc
This function will extract the raw key (or DN) ID of the Basic OCSP Response in
Packit 549fdc
the provided buffer. If the responder ID is not a key ID then
Packit 549fdc
this function will return @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} .
Packit 549fdc
Packit 549fdc
The caller needs to deallocate memory by calling @code{gnutls_free()}  on
Packit 549fdc
 @code{dn} ->data.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_response
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_response}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_response} (gnutls_ocsp_resp_t @var{resp}, gnutls_datum_t * @var{response_type_oid}, gnutls_datum_t * @var{response})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{response_type_oid}: newly allocated output buffer with response type OID
Packit 549fdc
Packit 549fdc
@var{response}: newly allocated output buffer with DER encoded response
Packit 549fdc
Packit 549fdc
This function will extract the response type OID in and the
Packit 549fdc
response data from an OCSP response.  Normally the
Packit 549fdc
 @code{response_type_oid} is always "1.3.6.1.5.5.7.48.1.1" which means the
Packit 549fdc
 @code{response} should be decoded as a Basic OCSP Response, but
Packit 549fdc
technically other response types could be used.
Packit 549fdc
Packit 549fdc
This function is typically only useful when you want to extract the
Packit 549fdc
response type OID of an response for diagnostic purposes.
Packit 549fdc
Otherwise @code{gnutls_ocsp_resp_import()}  will decode the basic OCSP
Packit 549fdc
response part and the caller need not worry about that aspect.
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 gnutls_ocsp_resp_get_signature
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_signature}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_signature} (gnutls_ocsp_resp_t @var{resp}, gnutls_datum_t * @var{sig})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{sig}: newly allocated output buffer with signature data
Packit 549fdc
Packit 549fdc
This function will extract the signature field of a OCSP response.
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 gnutls_ocsp_resp_get_signature_algorithm
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_signature_algorithm}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_signature_algorithm} (gnutls_ocsp_resp_t @var{resp})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
This function will return a value of the @code{gnutls_sign_algorithm_t} 
Packit 549fdc
enumeration that is the signature algorithm that has been used to
Packit 549fdc
sign the OCSP response.
Packit 549fdc
Packit 549fdc
@strong{Returns:} a @code{gnutls_sign_algorithm_t}  value, or a negative error code
Packit 549fdc
on error.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_single
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_single}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_single} (gnutls_ocsp_resp_t @var{resp}, unsigned @var{indx}, gnutls_digest_algorithm_t * @var{digest}, gnutls_datum_t * @var{issuer_name_hash}, gnutls_datum_t * @var{issuer_key_hash}, gnutls_datum_t * @var{serial_number}, unsigned int * @var{cert_status}, time_t * @var{this_update}, time_t * @var{next_update}, time_t * @var{revocation_time}, unsigned int * @var{revocation_reason})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{indx}: Specifies response number to get. Use (0) to get the first one.
Packit 549fdc
Packit 549fdc
@var{digest}: output variable with @code{gnutls_digest_algorithm_t}  hash algorithm
Packit 549fdc
Packit 549fdc
@var{issuer_name_hash}: output buffer with hash of issuer's DN
Packit 549fdc
Packit 549fdc
@var{issuer_key_hash}: output buffer with hash of issuer's public key
Packit 549fdc
Packit 549fdc
@var{serial_number}: output buffer with serial number of certificate to check
Packit 549fdc
Packit 549fdc
@var{cert_status}: a certificate status, a @code{gnutls_ocsp_cert_status_t}  enum.
Packit 549fdc
Packit 549fdc
@var{this_update}: time at which the status is known to be correct.
Packit 549fdc
Packit 549fdc
@var{next_update}: when newer information will be available, or (time_t)-1 if unspecified
Packit 549fdc
Packit 549fdc
@var{revocation_time}: when  @code{cert_status} is @code{GNUTLS_OCSP_CERT_REVOKED} , holds time of revocation.
Packit 549fdc
Packit 549fdc
@var{revocation_reason}: revocation reason, a @code{gnutls_x509_crl_reason_t}  enum.
Packit 549fdc
Packit 549fdc
This function will return the certificate information of the
Packit 549fdc
 @code{indx} 'ed response in the Basic OCSP Response  @code{resp} .  The
Packit 549fdc
information returned corresponds to the OCSP SingleResponse structure
Packit 549fdc
except the final singleExtensions.
Packit 549fdc
Packit 549fdc
Each of the pointers to output variables may be NULL to indicate
Packit 549fdc
that the caller is not interested in that value.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error code is returned.  If you have reached the last
Packit 549fdc
CertID available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be
Packit 549fdc
returned.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_status
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_status}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_status} (gnutls_ocsp_resp_t @var{resp})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
This function will return the status of a OCSP response, an
Packit 549fdc
@code{gnutls_ocsp_resp_status_t}  enumeration.
Packit 549fdc
Packit 549fdc
@strong{Returns:} status of OCSP request as a @code{gnutls_ocsp_resp_status_t} , or
Packit 549fdc
a negative error code on error.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_get_version
Packit 549fdc
@anchor{gnutls_ocsp_resp_get_version}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_get_version} (gnutls_ocsp_resp_t @var{resp})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
This function will return the version of the Basic OCSP Response.
Packit 549fdc
Typically this is always 1 indicating version 1.
Packit 549fdc
Packit 549fdc
@strong{Returns:} version of Basic OCSP response, or a negative error code
Packit 549fdc
on error.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_ocsp_resp_import
Packit 549fdc
@anchor{gnutls_ocsp_resp_import}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_import} (gnutls_ocsp_resp_t @var{resp}, const gnutls_datum_t * @var{data})
Packit 549fdc
@var{resp}: The data to store the parsed response.
Packit 549fdc
Packit 549fdc
@var{data}: DER encoded OCSP response.
Packit 549fdc
Packit 549fdc
This function will convert the given DER encoded OCSP response to
Packit 549fdc
the native @code{gnutls_ocsp_resp_t}  format.  It also decodes the Basic
Packit 549fdc
OCSP Response part, if any.  The output will be stored in  @code{resp} .
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 gnutls_ocsp_resp_init
Packit 549fdc
@anchor{gnutls_ocsp_resp_init}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_init} (gnutls_ocsp_resp_t * @var{resp})
Packit 549fdc
@var{resp}: A pointer to the type to be initialized
Packit 549fdc
Packit 549fdc
This function will initialize an OCSP response structure.
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 gnutls_ocsp_resp_print
Packit 549fdc
@anchor{gnutls_ocsp_resp_print}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_print} (gnutls_ocsp_resp_t @var{resp}, gnutls_ocsp_print_formats_t @var{format}, gnutls_datum_t * @var{out})
Packit 549fdc
@var{resp}: The data to be printed
Packit 549fdc
Packit 549fdc
@var{format}: Indicate the format to use
Packit 549fdc
Packit 549fdc
@var{out}: Newly allocated datum with (0) terminated string.
Packit 549fdc
Packit 549fdc
This function will pretty print a OCSP response, suitable for
Packit 549fdc
display to a human.
Packit 549fdc
Packit 549fdc
If the format is @code{GNUTLS_OCSP_PRINT_FULL}  then all fields of the
Packit 549fdc
response will be output, on multiple lines.
Packit 549fdc
Packit 549fdc
The output  @code{out} ->data needs to be deallocate 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 gnutls_ocsp_resp_verify
Packit 549fdc
@anchor{gnutls_ocsp_resp_verify}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_verify} (gnutls_ocsp_resp_t @var{resp}, gnutls_x509_trust_list_t @var{trustlist}, unsigned int * @var{verify}, unsigned int @var{flags})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{trustlist}: trust anchors as a @code{gnutls_x509_trust_list_t}  type
Packit 549fdc
Packit 549fdc
@var{verify}: output variable with verification status, an @code{gnutls_ocsp_verify_reason_t} 
Packit 549fdc
Packit 549fdc
@var{flags}: verification flags from @code{gnutls_certificate_verify_flags} 
Packit 549fdc
Packit 549fdc
Verify signature of the Basic OCSP Response against the public key
Packit 549fdc
in the certificate of a trusted signer.  The  @code{trustlist} should be
Packit 549fdc
populated with trust anchors.  The function will extract the signer
Packit 549fdc
certificate from the Basic OCSP Response and will verify it against
Packit 549fdc
the  @code{trustlist} .  A trusted signer is a certificate that is either
Packit 549fdc
in  @code{trustlist} , or it is signed directly by a certificate in
Packit 549fdc
 @code{trustlist} and has the id-ad-ocspSigning Extended Key Usage bit
Packit 549fdc
set.
Packit 549fdc
Packit 549fdc
The output  @code{verify} variable will hold verification status codes
Packit 549fdc
(e.g., @code{GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND} ,
Packit 549fdc
@code{GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM} ) which are only valid if the
Packit 549fdc
function returned @code{GNUTLS_E_SUCCESS} .
Packit 549fdc
Packit 549fdc
Note that the function returns @code{GNUTLS_E_SUCCESS}  even when
Packit 549fdc
verification failed.  The caller must always inspect the  @code{verify} variable to find out the verification status.
Packit 549fdc
Packit 549fdc
The  @code{flags} variable should be 0 for now.
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 gnutls_ocsp_resp_verify_direct
Packit 549fdc
@anchor{gnutls_ocsp_resp_verify_direct}
Packit 549fdc
@deftypefun {int} {gnutls_ocsp_resp_verify_direct} (gnutls_ocsp_resp_t @var{resp}, gnutls_x509_crt_t @var{issuer}, unsigned int * @var{verify}, unsigned int @var{flags})
Packit 549fdc
@var{resp}: should contain a @code{gnutls_ocsp_resp_t}  type
Packit 549fdc
Packit 549fdc
@var{issuer}: certificate believed to have signed the response
Packit 549fdc
Packit 549fdc
@var{verify}: output variable with verification status, an @code{gnutls_ocsp_verify_reason_t} 
Packit 549fdc
Packit 549fdc
@var{flags}: verification flags from @code{gnutls_certificate_verify_flags} 
Packit 549fdc
Packit 549fdc
Verify signature of the Basic OCSP Response against the public key
Packit 549fdc
in the  @code{issuer} certificate.
Packit 549fdc
Packit 549fdc
The output  @code{verify} variable will hold verification status codes
Packit 549fdc
(e.g., @code{GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND} ,
Packit 549fdc
@code{GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM} ) which are only valid if the
Packit 549fdc
function returned @code{GNUTLS_E_SUCCESS} .
Packit 549fdc
Packit 549fdc
Note that the function returns @code{GNUTLS_E_SUCCESS}  even when
Packit 549fdc
verification failed.  The caller must always inspect the  @code{verify} variable to find out the verification status.
Packit 549fdc
Packit 549fdc
The  @code{flags} variable should be 0 for now.
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