z/OS Cryptographic Services System SSL Programming
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


gsk_set_default_key()

z/OS Cryptographic Services System SSL Programming
SC14-7495-00

Sets the default key.

Format

#include <gskcms.h>

gsk_status gsk_set_default_key (
                                gsk_handle         db_handle,
                                gsk_int32          record_id)

Parameters

db_handle
Specifies the database handle returned by the gsk_create_database() routine or the gsk_open_database() routine.
record_id
Specifies the unique record identifier of the new default key.

Results

The function return value will be 0 if no error is detected. Otherwise, it will be one of the return codes listed in the gskcms.h include file. These are some possible errors:

[CMSERR_BACKUP_EXISTS]
The backup file already exists.
[CMSERR_BAD_HANDLE]
The database handle is not valid.
[CMSERR_INCORRECT_DBTYPE]
The database type does not support a default key.
[CMSERR_IO_ERROR]
Unable to write record.
[CMSERR_NO_MEMORY]
Insufficient storage is available.
[CMSERR_NO_PRIVATE_KEY]
The database record does not contain a private key.
[CMSERR_RECORD_NOT_FOUND]
Record is not found.
[CMSERR_UPDATE_NOT_ALLOWED]
Database is not open for update or update attempted on a FIPS mode database while in non-FIPS mode.

Usage

The gsk_set_default_key() routine sets the default key for a key database. If the key database already has a default key, the record for the old default key is updated to remove the GSKDB_RECFLAG_DEFAULT flag. The record for the new default key is then updated to add the GSKDB_RECFLAG_DEFAULT flag. The database must be open for update in order to set the default key. An error will be returned if the specified database record does not contain a private key.

The database file is updated as part of the gsk_set_default_key() processing. A temporary database file is created using the same name as the database file with ".new" appended to the name. The database file is then overwritten and the temporary database file is deleted. The temporary database file will not be deleted if an error occurs while rewriting the database file.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014