Blob Blame History Raw




@deftypefun {int} {gnutls_x509_crt_get_key_usage} (gnutls_x509_crt_t @var{cert}, unsigned int * @var{key_usage}, unsigned int * @var{critical})
@var{cert}: should contain a @code{gnutls_x509_crt_t}  type

@var{key_usage}: where the key usage bits will be stored

@var{critical}: will be non-zero if the extension is marked as critical

This function will return certificate's key usage, by reading the
keyUsage X.509 extension (2.5.29.15). The key usage value will ORed
values of the: @code{GNUTLS_KEY_DIGITAL_SIGNATURE} ,
@code{GNUTLS_KEY_NON_REPUDIATION} , @code{GNUTLS_KEY_KEY_ENCIPHERMENT} ,
@code{GNUTLS_KEY_DATA_ENCIPHERMENT} , @code{GNUTLS_KEY_KEY_AGREEMENT} ,
@code{GNUTLS_KEY_KEY_CERT_SIGN} , @code{GNUTLS_KEY_CRL_SIGN} ,
@code{GNUTLS_KEY_ENCIPHER_ONLY} , @code{GNUTLS_KEY_DECIPHER_ONLY} .

@strong{Returns:} zero on success, or a negative error code in case of
parsing error.  If the certificate does not contain the keyUsage
extension @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be
returned.
@end deftypefun