Redharing wrote: > I tried to read code from > http://docs.sun.com/app/docs/doc/816-4863/6mb20lvgv?a=view#chapter2-14 > I thing it's nearest for solve my problem. but In code use fix key > for encrypt and decrypt I can't to use fix key I need to use key > local in sca6000. Please someone show the code for use key local form > sca6000. > > Thank you. Redharing. >
The example you link to is nearly what your looking for... I don't have a code example of exactly what you're looking for, but make sure you follow link the info that g-morton provided on how to setup the sca6000 as the keystore in metaslot. Also take note of the restrictions on objects that can be on the sca6000 in and following table 6.1. Once you have that you just need to use C_Login after C_OpenSession and then you should be ready to generate, create, or find a key.. sca6000 requires objects be CKA_PRIVATE=true, so therefore you have to login.. All this would be the same if you were using a CKA_PRIVATE=true object in the softtoken keystoure.. login would look something like C_Login (handle, CKU_USER, pin, pinlen); and finding a object in the keystore that has already been created or generated, the code snippet would look something like.. CK_ATTRIBUTE search[] = { { CKA_LABEL, label, strlen ((char *) label) }, { CKA_CLASS, &class, sizeof (class) } }; C_FindObjectsInit (handle, search, 2); C_FindObjects (handle, &key, 1, &count); C_FindObjectsFinal (handle); where key is a CK_OBJECT_HANDLE that the found object is placed..