Change this program example to suit your needs for changing an existing profile for your Coprocessor.
If you choose to use this program example, change it to suit your specific needs. For security reasons, IBM® recommends that you individualize these program examples rather than using the default values provided.
/*-------------------------------------------------------------------*/ /* Change certain fields in a user profile on the */ /* card. This program changes the expiration date using a new */ /* date in the form YYYYMMDD. */ /* */ /* */ /* COPYRIGHT 5769-SS1 (C) IBM CORP. 1999, 1999 */ /* */ /* 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(CHG_PROF) */ /* */ /* */ /* 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 */ /* Access_Control_Initialization (CSUAACI). */ /* */ /* Use these commands to compile this program on the system: */ /* ADDLIBLE LIB(QCCA) */ /* CRTCMOD MODULE(CHG_PROF) SRCFILE(SAMPLE) */ /* CRTPGM PGM(CHG_PROF) MODULE(CHG_PROF) */ /* BNDSRVPGM(QCCA/CSUAACI) */ /* */ /* Note: Authority to the CSUAACI service program in the */ /* QCCA library is assumed. */ /* */ /* The Common Cryptographic Architecture (CCA) verb used is */ /* Access_Control_Initialization (CSUAACI). */ /* */ /*-------------------------------------------------------------------*/ #include "csucincl.h" /* header file for CCA Cryptographic */ /* Service Provider */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <decimal.h> /*-------------------------------------------------------------------*/ /* standard return codes */ /*-------------------------------------------------------------------*/ #define ERROR -1 #define OK 0 #define WARNING 4 int main(int argc, char *argv[]) { /*-------------------------------------------------------------------*/ /* standard CCA parameters */ /*-------------------------------------------------------------------*/ long return_code = 0; long reason_code = 0; long exit_data_length = 2; char exit_data[4]; char rule_array[8]; long rule_array_count = 1; /*-------------------------------------------------------------------*/ /* fields unique to this sample program */ /*-------------------------------------------------------------------*/ long verb_data_length; char * verb_data; long verb_data_length2; char * verb_data2; memcpy(rule_array,"CHGEXPDT",8); /* set rule array keywords */ verb_data_length = 8; verb_data = "SECOFR1 "; /* set the profile name */ verb_data_length2 = 8; verb_data2 = "20010621"; /* set the new date */ /* invoke verb to change the expiration date in specified profile */ CSUAACI( &return_code, &reason_code, &exit_data_length, exit_data, &rule_array_count, (char *)rule_array, &verb_data_length, verb_data, &verb_data_length2, verb_data2); if ( (return_code == OK) | (return_code == WARNING) ) { printf("Profile expiration date was changed successfully"); printf(" with return/reason codes "); printf("%ld/%ld\n\n", return_code, reason_code); return(OK); } else { printf("Change of expiration date failed with return/"); printf("reason codes "); printf(" %ld/%ld\n\n", return_code, reason_code); return(ERROR); } }