On 10/06/2012 03:34 AM, tehhzstar wrote:
Hi,

Currently, are there any code samples available that uses PK11_SetSymKeyUserData, PK11_GetSymKeyUserData? I am trying to store information relating to PK11SymKey:
- Start Date of when the keys were created
- End Date of when the keys will expire (this is set by users)
- Calculation of duration of keys' usage.

I tried to use these functions, but it causes my extension to crash without any notice.

Appreciate if someone can help me on this issue. Thank you.

Regards,
Brian Teh, Singapore
The S/MIME code uses these functions in the 'static' mode.

Without having access to a stack traceback (or knowing how you are using the data), it's not clear where your problem lies. Some things to make sure of:

1) You only set data on keys you created.
2) You only get to set one user data value. This means you need to create a structure to hold all 3 things you are trying to set. 3) If you supply a free func, it really needs to be able to free our user data structure. 4) You should be able to deal with a NULL userData when you call PK11_GetSymKeyUserData. 5) UserData is not persistent. It is only stored with the instance of the key you create. If you are dealing with a token key and need to store persistent data, then you need to use PKCS 11 attributes and PK11_WriteRawAttribute() and PK11_ReadRawAttribute().. (note this may not work with old dbm database keys).

bob

-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to