[Opendnssec-user] proper C_FindObjectsInit

Rickard Bellgrim rickard at opendnssec.org
Mon Jan 20 10:12:14 UTC 2014


>         {CKA_LABEL, (void *)"card_data", sizeof("card_data" -1) },
>

Maybe just a typo in the email, but the -1 should be outside the
parentheses.


> i compute 6 elements total, But then in the C_FindObjectsInit, i pass
> ulCount - 1
> and i get no matches.
>
> should i be doing
>
> *  rv = C_FindObjectsInit( g_session, Template, ulCount );*
>
> am i doing this wrong?  Tia, jackc
>

The indexing of the array goes from 0 to 5. But when you count the content
of the array then it goes from 1 to 6. So ulCount should be equal to 6.

However, you should get a match with just 5 attributes. The extra attribute
will just narrow the search. Is the object a private object? Then you also
need to C_Login() on your session before searching.

When searching for objects you usually just search using the CKA_CLASS and
CKA_ID. E.g. a private key with ID 1234.

This is the code that OpenDNSSEC uses when searching for objects.
http://fisheye.opendnssec.org/browse/~br=trunk/opendnssec/trunk/OpenDNSSEC/libhsm/src/lib/libhsm.c?hb=true#to1132

// Rickard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opendnssec.org/pipermail/opendnssec-user/attachments/20140120/b600fd6e/attachment.htm>


More information about the Opendnssec-user mailing list