gsk_attribute_get_cert_info()--Get information about a local or partner certificate


  Syntax

 #include <gskssl.h>

 int gsk_attribute_get_cert_info(gsk_handle my_gsk_handle,
                                 GSK_CERT_ID certID,
                                 const gsk_cert_data_elem **certDataElem,  
                                 int *certDataElemCount);
         
  Service Program Name: QSYS/QSOSSLSR

  Default Public Authority: *USE

  Threadsafe: Yes

The gsk_attribute_get_cert_info() function is used to obtain specific information about either the server or client certificate for a secure session or an SSL environment.


Parameters

my_gsk_handle  (Input) 
Indicates one of the following handles:


certID  (Input) 
Indicates one of the following:
certDataElem  (Output) 
The address of a pointer to the certificate information returned from this function call. On output, certDataElem will contain the pointer to the information. The storage for this information was allocated by the system from user heap storage and will be freed by the gsk_secure_soc_close() API or the gsk_environment_close() API.

certDataElemCount  (Output) 
A pointer to an integer that will contain the number of certificate data elements returned from this function call.

Authorities

No authorization is required.


Return Value

gsk_attribute_get_cert_info() returns an integer. Possible values are:

[GSK_OK]
gsk_attribute_get_cert_info() was successful.

[GSK_ATTRIBUTE_INVALID_ID]
The specified certID was not valid.

[GSK_INVALID_HANDLE]
The handle passed in to this function was not valid.

[GSK_INVALID_STATE]
One of the following occurred:
[GSK_AS400_ERROR_INVALID_POINTER]
The certDataElem or certDataElemCount pointer is not valid.

[GSK_INSUFFICIENT_STORAGE]
Not able to allocate storage for the requested operation.

[GSK_ERROR_IO]
An error occurred in SSL processing, check the errno value.

Error Conditions

When the gsk_attribute_get_cert_info() API fails with return code [GSK_ERROR_IO], errno can be set to:

[EINTR]
Interrupted function call.

[EDEADLK]
Resource deadlock avoided.

[ETERM]
Operation terminated.

If an errno is returned that is not in this list, look in Errno Values for UNIX®-Type Functions for a description of the errno.


Usage Notes

  1. After gsk_attribute_get_cert_info() returns with a GSK_OK return value, certDataElem points to an array of structures of type gsk_cert_data_elem. The following structure is the gsk_cert_data_elem structure:
    typedef struct gsk_cert_data_elem_t
    {
      GSK_CERT_DATA_ID cert_data_id;
      char *cert_data_p;
      int cert_data_l;
    
    } gsk_cert_data_elem;
    
    

    Each element consists of the following fields:



  2. Many fields are character strings and are terminated with a trailing null. The length does not include the null.

  3. Other fields (CERT_BODY_DER, CERT_DN_DER, and so on) may have imbedded nulls and therefore must use the integer length for processing.

  4. Not all certificates contain all fields, so the number of fields returned depends on the certificate being processed. This open-ended approach means new fields can be added from time to time without disrupting existing usage.

  5. All certificate data is returned in ASCII CCSID 850.

  6. You can reference the certDataElem pointers as long as the handle for the secure session or SSL environment is open.

Related Information



API introduced: V5R1
Top | UNIX-Type APIs | APIs by category