gsk_attribute_set_buffer()--Set character information for a secure session or an SSL environment


  Syntax

 #include <gskssl.h>

 int gsk_attribute_set_buffer(gsk_handle my_gsk_handle,
                              GSK_BUF_ID bufID,
                              const char *buffer,
                              int bufSize);

  Service Program Name: QSYS/QSOSSLSR

  Default Public Authority: *USE

  Threadsafe: Yes

The gsk_attribute_set_buffer() function is used to set a specified buffer attribute to a value inside the specified secure session or SSL environment.


Parameters

my_gsk_handle  (Input) 
Indicates one of the following handles:
bufID  (Input) 
Indicates one of the following operations:


buffer  (Input) 
A pointer to the information to be used for the secure session or the SSL environment.

The data in the buffer is assumed to be represented in the CCSID (coded character set identifier) currently in effect for the job. If the CCSID of the job is 65535, this buffer is assumed to be represented in the default CCSID of the job.

bufSize  (Input) 
The length of the buffer information. If bufSize is specified as 0, the length of bufSize will be calculated.

Authorities

No authorization is required.


Return Value

gsk_attribute_set_buffer() returns an integer. Possible values are:

[GSK_OK]
gsk_attribute_set_buffer() was successful.

[GSK_ATTRIBUTE_INVALID_ID]
The bufID value is not a valid identifier.

[GSK_ATTRIBUTE_INVALID_LENGTH]
The bufSize specified or the length of buffer is not valid.

[GSK_INVALID_HANDLE]
my_gsk_handle is not a valid handle that was received from issuing gsk_environment_open() or gsk_secure_soc_open().

[GSK_AS400_ERROR_INVALID_POINTER]
The buffer pointer is not valid.

[GSK_INVALID_STATE]
One of the following occurred:
Start of change[GSK_INVALID_PARAMETER]
The buffer value contains an invalid value for the bufID being set. For example an invalid cipher suite was specified.

[GSK_ERROR_BAD_V3_CIPHER]
An SSLV3 cipher suite was specified that is not valid.

[GSK_ERROR_BAD_V2_CIPHER]
An SSLV2 cipher suite was specified that is not valid.
End of change
[GSK_ERROR_UNSUPPORTED]
The bufID value is currently not supported.

[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_set_buffer() 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. The following GSK_BUF_ID values may be set in the SSL environment after gsk_environment_open() and before gsk_environment_init(). They are used as defaults for subsequent secure sessions:


  2. The following GSK_BUF_ID values may be set for each individual secure session after gsk_secure_soc_open() and before gsk_secure_soc_init(). These values will override values set in the SSL environment:


  3. Start of change This table shows the mapping between the three different representations of a cipher specification on the system. For each protocol version the cipher specifications that are supported when the operating system is installed are indicated by the "X" in the appropriate column.

    GSK_XX_CIPHER_SPECS
    Representation
    GSK_XX_CIPHER_SPECS_EX
    Representation
    QSSLCSL System Value
    Representation
    TLSV12 TLSV11 TLSV10 SSLV3
    3D TLS_RSA_WITH_AES_256_CBC_SHA256 *RSA_AES_256_CBC_SHA256 X      
    3C TLS_RSA_WITH_AES_128_CBC_SHA256 *RSA_AES_128_CBC_SHA256 X      
    35 TLS_RSA_WITH_AES_256_CBC_SHA *RSA_AES_256_CBC_SHA X X X  
    2F TLS_RSA_WITH_AES_128_CBC_SHA *RSA_AES_128_CBC_SHA X X X  
    0A TLS_RSA_WITH_3DES_EDE_CBC_SHA *RSA_3DES_EDE_CBC_SHA X X X X
    05 TLS_RSA_WITH_RC4_128_SHA *RSA_RC4_128_SHA X X X X
    04 TLS_RSA_WITH_RC4_128_MD5 *RSA_RC4_128_MD5 X X X X
    09 TLS_RSA_WITH_DES_CBC_SHA *RSA_DES_CBC_SHA   X X X
    03 TLS_RSA_EXPORT_WITH_RC4_40_MD5 *RSA_EXPORT_RC4_40_MD5     X X
    06 TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 *RSA_EXPORT_RC2_CBC_40_MD5     X X
    3B TLS_RSA_WITH_NULL_SHA256 *RSA_NULL_SHA256 X      
    02 TLS_RSA_WITH_NULL_SHA *RSA_NULL_SHA X X X X
    01 TLS_RSA_WITH_NULL_MD5 *RSA_NULL_MD5 X X X X

  4. TLS Version 1.2 is disabled when the operating system is installed. If TLS Version 1.2 is enabled, the following GSK_TLSV12_CIPHER_SPECS_EX string is the default TLS Version 1.2 cipher list used when the operating system is installed:
    Start of change
      'TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,
       TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA'End of change
    
    The GSK_TLSV12_CIPHER_SPECS equivalent list is Start of change'3C2F3D35'End of change.

  5. TLS Version 1.1 is disabled when the operating system is installed. If TLS Version 1.1 is enabled, the following GSK_TLSV11_CIPHER_SPECS_EX string is the default TLS Version 1.1 cipher list used when the operating system is installed:
    Start of change
      'TLS_RSA_WITH_AES_128_CBC_SHA,
       TLS_RSA_WITH_AES_256_CBC_SHA'End of change
    
    The GSK_TLSV11_CIPHER_SPECS equivalent list is Start of change'2F35'End of change.

  6. The following GSK_TLSV10_CIPHER_SPECS_EX string is the default TLS Version 1.0 cipher list used when the operating system is installed:
    Start of change
      'TLS_RSA_WITH_AES_128_CBC_SHA,
       TLS_RSA_WITH_AES_256_CBC_SHA'End of change
    
    The GSK_TLSV10_CIPHER_SPECS equivalent list is Start of change'2F35'End of change.

  7. The following GSK_V3_CIPHER_SPECS_EX string is the default SSL Version 3 cipher list used when the operating system is installed:
    Start of change
      'TLS_RSA_WITH_AES_128_CBC_SHA,
       TLS_RSA_WITH_AES_256_CBC_SHA'End of change
    
    The GSK_V3_CIPHER_SPECS equivalent list is Start of change'2F35'End of change.

  8. SSL Version 2 support is disabled when the operating system is installed resulting in no SSL Version 2 ciphers being supported. If SSL Version 2 is enabled (not recommended), the following GSK_V2_CIPHER_SPECS values are the SSL Version 2 ciphers that would be supported if the shipped supported cipher list has not been altered.
        1 = *RSA_RC4_128_MD5
        2 = *RSA_EXPORT_RC4_40_MD5
        4 = *RSA_EXPORT_RC2_CBC_40_MD5
        NULL = Default cipher specs are used, Start of changehowever no SSLv2 ciphers are eligible
            to be default cipher specs.   Thus, the default list contains no ciphers.End of change
    
    The following GSK_V2_CIPHER_SPECS values are the SSL Version 2 ciphers potentially supported if an administrator later enables SSL Version 2:
        1 = *RSA_RC4_128_MD5
        2 = *RSA_EXPORT_RC4_40_MD5
        3 = *RSA_RC2_CBC_128_MD5
        4 = *RSA_EXPORT_RC2_CBC_40_MD5
        6 = *RSA_DES_CBC_MD5
        7 = *RSA_3DES_EDE_CBC_MD5
        NULL = Default cipher specs are used, Start of changehowever no SSLv2 ciphers are eligible
            to be default cipher specs.   Thus, the default list contains no ciphers.End of change
    
  9. The following GSK_SSL_EXTN_SIGALG strings represent the signature algorithms supported when the operating system is installed:

    The following GSK_SSL_EXTN_SIGALG string is the default ordered list used when the operating system is installed:
      'GSK_TLS_SIGALG_RSA_WITH_SHA512,GSK_TLS_SIGALG_RSA_WITH_SHA384,GSK_TLS_SIGALG_RSA_WITH_SHA256,
       GSK_TLS_SIGALG_RSA_WITH_SHA224,GSK_TLS_SIGALG_RSA_WITH_SHA1,GSK_TLS_SIGALG_RSA_WITH_MD5'
    
    The default string used by System SSL can be changed using System Service Tools (SST) Advanced Analysis Command SSLCONFIG.
    End of change

  10. The list of supported cipher suites and the ordered list of default cipher suites are configurable from the Change System Value (CHGSYSVAL) command. The Display System Value (DSPSYSVAL) command or the Retrieve System Values (QWCRSVAL) API can be used to determine the current settings of the supported ciphers (QSSLCSL) and protocols (QSSLPCL) for system SSL.

  11. The following are the possible scenerios for the use of GSK_KEYRING_LABEL:


  12. If GSK_OS400_APPLICATION_ID is set, the GSK_KEYRING_FILE, the GSK_KEYRING_LABEL, and the GSK_KEYRING_PASSWORD values are ignored.

  13. Start of change When GSK_OS400_APPLICATION_ID is set, the settings of some of the SSL environment attributes will be determined by the corresponding value in the Application ID definition in Digital Certificate Manager (DCM). These are the buffer attributes that can be overwritten by DCM during the call to gsk_environment_init():
  14. When GSK_OS400_APPLICATION_ID is set, the settings of some of the SSL environment attributes will be affected by the corresponding value in the Application ID definition in Digital Certificate Manager (DCM). These are the buffer attributes that can be appended by DCM to the end of the existing SSL environment buffer attributes during the call to gsk_environment_init():
  15. There are two ways to enable OCSP that can be used either separately or together:


    When both attributes are set the GSK_OCSP_ENABLE functionality will only be used if GSK_OCSP_URL functionality results in an undetermined revocation status. The definition of undetermined revocation status is located in the Secure Sockets Layer topic.

    Note: Using OCSP results in a performance impact to System SSL.

  16. Per RFC 6066 Transport Layer Security (TLS) Extensions: Extension Definitions , the main purpose of Server Name Indication (SNI) support is to allow TLS clients to provide to the TLS server the name of the server they are contacting. This functionality is desirable in order to facilitate secure connections to servers that host multiple 'virtual' servers at a single underlying network address.

    TLS servers that do not host multiple 'virtual' servers may find that configuring GSK_SSL_EXTN_SERVERNAME_LIST allows for improved interoperability with TLS clients that are using the equivalent of GSK_SSL_EXTN_SERVERNAME_CRITICAL_REQUEST on their platform.

  17. The following is a possible scenario for the use of GSK_TLSV12_CIPHER_SPECS_EX:
        gsk_attribute_set_buffer(GSK_TLSV12_CIPHER_SPECS_EX)
        gsk_attribute_get_buffer(GSK_TLSV12_CIPHER_SPECS_EX)
        gsk_attribute_set_buffer(GSK_TLSV12_CIPHER_SPECS)
    
    In the example above, the two calls to gsk_attribute_set_buffer() using GSK_TLSV12_CIPHER_SPECS_EX and GSK_TLSV12_CIPHER_SPECS will modify the same cipher list. The buffer returned to gsk_attribute_get_buffer() will no longer be accurate after the second set call. The cipher spec list was modified by the second set, so another get call would be necessary to retrieve the current cipher list. This also applies to GSK_TLSV11_CIPHER_SPECS_EX, GSK_TLSV10_CIPHER_SPECS_EX, and GSK_V3_CIPHER_SPECS_EX.
    End of change

  18. The following GSK_BUF_ID values currently are not supported in the IBM® i implementation:


Related Information



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