Blame doc/ocsp-api.texi

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