NPKIT_x509KeyUsageInfo

Retrieves the information from the key usage extension of the certificate if a key usage extension is encoded in the certificate (formerly NWx509KeyUsageInfo).

Syntax

   #include "NPKIT_x509.h"
   
   NWRCODE NPKIT_x509KeyUsageInfo
   (
      NPKIT_x509Context     context,
      pnuint16               keyUsage
   );
   

Parameters

context
(IN) Specifies the NPKIT_x509 context handle for the request. This is a nuint32 value.
keyUsage
(OUT) Specifies the key usage value as encoded in the certificate. The following defines can be used with a bit-wise AND to determine which key usages are encoded.

Constant

Value

X509_KEY_USAGE_DIGITAL_SIGNATURE

0x8000

X509_KEY_USAGE_NON_REPUDIATION

0x4000

X509_KEY_USAGE_KEY_ENCIPHERMENT

0x2000

X509_KEY_USAGE_DATA_ENCIPHERMENT

0x1000

X509_KEY_USAGE_KEY_AGREEMENT

0x0800

X509_KEY_USAGE_KEY_CERT_SIGN

0x0400

X509_KEY_USAGE_CRL_SIGN

0x0200

X509_KEY_USAGE_ENCIPHER_ONLY

0x0100

X509_KEY_USAGE_DECIPHER_ONLY

0x0080

For more information about key usages, see Section 4.4, Key Usage Extension Values.

Return Values

Returns 0 if successful or a PKI error code if not successful. For a listing of NPKIT error codes, see Certificate Server Error Code Constants.

Remarks

Before calling this function, you must first successfully call NPKIT_x509DecodeCertificate. The key usage extension is optional. Therefore, not all certificates will have key usages.

See Also

NPKIT_x509DecodeCertificate, NPKIT_x509GetExtensionData