1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | [root@draeger /root]# /usr/lib/pkcs11/methods/pkcsconf -I -c 0 Enter the SO PIN: 87654321 Enter a unique token label: DraegerICA [root@draeger /root]# /usr/lib/pkcs11/methods/pkcsconf -t -c 0 Token #0 Info: Label: DraegerICA Model: IBM ICA Serial Number: 123 Flags: 0x45 Sessions: -1/-1 R/W Sessions: -1/-1 PIN Length: 4-8 Public Memory: 0xFFFFFFFF/0xFFFFFFFF Private Memory: 0xFFFFFFFF/0xFFFFFFFF Hardware Version: 1.0 Firmware Version: 1.0 Time: 11:14:17 AM |
1 2 3 4 | [root@draeger /root]# /usr/lib/pkcs11/methods/pkcsconf -P -c 0 Enter the SO PIN: 87654321 Enter the new SO PIN: fredrules Re-enter the new SO PIN: fredrules |
1 2 3 4 | [root@draeger /root]# /usr/lib/pkcs11/methods/pkcsconf -u -c 0 Enter the SO PIN: fredrules Enter the new user PIN: billybob Re-enter the new user PIN: billybob |
1 2 3 4 | [root@draeger /root]# /usr/lib/pkcs11/methods/pkcsconf -p -c 0 Enter user PIN: billybob Enter the new user PIN: 12345678 Re-enter the new user PIN: 12345678 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | CK_FUNCTION_LIST *funcs; int do_GetFunctionList( void ) { CK_RV rc; CK_RV (*pfoo)(); void *d; char *e; char f[]="/usr/lib/pkcs11/PKCS11_API.so"; printf("do_GetFunctionList... "); d = dlopen(f,RTLD_NOW); if ( d == NULL ) { return FALSE; } pfoo = (CK_RV (*)())dlsym(d,"C_GetFunctionList"); if (pfoo == NULL ) { return FALSE; } rc = pfoo(&funcs); if (rc != CKR_OK) { show_error(" C_GetFunctionList", rc ); return FALSE; } printf("Looks okay... "); return TRUE; } |
1 2 3 | CK_C_INITIALIZE_ARGS cinit_args; memset(&cinit_args,0x0,sizeof(cinit_args)); funcs->C_Initialize(&cinit_args); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | VPATH = .. INCS = -I../. -I../../../../../include/pkcs11 CFLAGS = $(OPTLVL) $(INCS) -DAPI -DDEV -D_THREAD_SAFE -DLINUX -DDEBUG -DSPINXPL CC = gcc LD = gcc LIBS = -ldl -lpthread OBJS = sample.o .c.o: ; $(CC) -c $(CFLAGS) -o $@ $< all: sample sample: $(OBJS) ${CC} ${OBJS} $(LIBS) -o $@ TARGET = sample build: $(TARGET) clean: rm -f *.so *.o $(TARGET) |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |