openssl rsa -passin pass:mypasswd -out ukey.pub -in ukey.pvt -pubout

user_setup: api_flac_test api_ibac_test ukey.pvt ukey.pub if ! grep -q wliusr1 /etc/passwd; then \

useradd wliusr1; \

chown wliusr1 flac_test; chmod a+w flac_test; \ chown wliusr1 ibac_test; chmod a+w ibac_test; \ chown wliusr1 api_flac_test; chmod u+w flac_test; \ chown wliusr1 api_ibac_test; chmod u+w ibac_test; \ chown wliusr1 ukey.pvt; chmod go-w ukey.pvt; \ chown wliusr1 ukey.pub; chmod go-w ukey.pub; \

clean:

rm -f *.o api_flac_test api_ibac_test if grep -q wliusr1 /etc/passwd; then \

userdel -F wliusr1; \

fi

rm -f flac_test ibac_test rm -f ukey.pub ukey.pvt

A.3 FLAC add and delete program

/*

*(C) Copyright 2010 Hewlett-Packard Development Company, L.P.

*Description:

*api_flac_test.c

*/

 

#include<stdio.h>

 

#include<fcntl.h>

 

#include<sys/errno.h>

 

#include<api.h>

 

#define FLAC_TEST

"flac_test"

main(int argc, char *argv[])

{

 

wli_fap_t

ptype = WLIAPI_FAP_FLAC;

wliapi_err_t

err = WLIAPI_SUCCESS;

int

fd = 0;

fd = open(FLAC_TEST, O_CREATO_TRUNCO_RDWR, 0666); if ( fd < 0 ) {

(void) fprintf(stderr,

"Failed to create a test file; error %d\n", errno); return(-1);

}

close(fd);

err = wli_add_fap(FLAC_TEST, ptype); if (err) {

(void) fprintf(stderr,

"Failed to add fap %d\n", err); return(-1);

}

err = wli_del_fap(FLAC_TEST, ptype); if (err) {

fprintf(stderr,

"Failed to del fap %d\n", err);

}

return(err);

}

A.4 IBAC add and delete program

/*

*(C) Copyright 2010 Hewlett-Packard Development Company, L.P.

*Description:

46libwliapi example

Page 46
Image 46
HP UX Security Products and Features Software manual Flac add and delete program, Ibac add and delete program