Change this program example to suit your needs for deleting retained keys.
/*-------------------------------------------------------------------*/ /* Delete a retained key */ /* */ /* */ /* COPYRIGHT 5769-SS1 (C) IBM CORP. 2000, 2000 */ /* */ /* This material contains programming source code for your */ /* consideration. These examples have not been thoroughly */ /* tested under all conditions. IBM, therefore, cannot */ /* guarantee or imply reliability, serviceability, or function */ /* of these program. All programs contained herein are */ /* provided to you "AS IS". THE IMPLIED WARRANTIES OF */ /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ /* ARE EXPRESSLY DISCLAIMED. IBM provides no program services for */ /* these programs and files. */ /* */ /* */ /* Note: Input format is more fully described in Chapter 2 of */ /* IBM CCA Basic Services Reference and Guide */ /* (SC31-8609) publication. */ /* */ /* Parameters: */ /* none. */ /* */ /* Example: */ /* CALL PGM(DLTRTNKEY) (SSLPRIV.KEY.ONE) */ /* */ /* */ /* Note: This program assumes the card with the profile is */ /* already identified either by defaulting to the CRP01 */ /* device or by being explicitly named using the */ /* Cryptographic_Resource_Allocate verb. Also this */ /* device must be varied on and you must be authorized */ /* to use this device description. */ /* */ /* The Common Cryptographic Architecture (CCA) verb used is */ /* Retained_Key_Delete (CSNDRKD). */ /* */ /* Use these commands to compile this program on the system: */ /* ADDLIBLE LIB(QCCA) */ /* CRTCMOD MODULE(DLTRTNKEY) SRCFILE(SAMPLE) */ /* CRTPGM PGM(DLTRTNKEY) MODULE(DLTRTNKEY) */ /* BNDSRVPGM(QCCA/CSNDRKD) */ /* */ /* Note: Authority to the CSNDRKD service program in the */ /* QCCA library is assumed. */ /* */ /* */ /*-------------------------------------------------------------------*/ #include <string.h> #include <stdio.h> #include "csucincl.h" /*-------------------------------------------------------------------*/ /* standard return codes */ /*-------------------------------------------------------------------*/ #define OK 0 #define WARNING 4 void main(int argc, char * argv[1]) { /*-----------------------------------------------------------------*/ /* standard CCA parameters */ /*-----------------------------------------------------------------*/ long return_code; long reason_code; long exit_data_length; unsigned char exit_data[2]; long rule_array_count = 0; unsigned char rule_array[1][8]; unsigned char key_label[64]; /*-------------------------------------------------------------------*/ /* Process the parameters */ /*-------------------------------------------------------------------*/ if (argc < 1) { printf("Key label parameter must be specified.\n"); return; } /*-------------------------------------------------------------------*/ /* Set up the key label */ /*-------------------------------------------------------------------*/ memset(key_label, ' ', 64 ); memcpy(key_label, argv[1], strlen(argv[1]) ); /*-------------------------------------------------------------------*/ /* Call the Retained Key List SAPI */ /*-------------------------------------------------------------------*/ CSNDRKD(&return_code, &reason_code, &exit_data_length, exit_data, &rule_array_count, (unsigned char*)rule_array, key_label); /*-------------------------------------------------------------------*/ /* Check the return code and display the results */ /*-------------------------------------------------------------------*/ if ( (return_code == OK) || (return_code == WARNING) ) { printf("Request was successful\n"); return; } else { printf("Request failed with return/reason codes: %d/%d \n", return_code, reason_code); return; } }