GetAttr

Get a single attribute of an object.

Synopsis

CK_RV GetAttr(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE obj,
CK_ATTRIBUTE_TYPE type,
CK_VOID_PTR buf,
CK_SIZE len,
CK_SIZE_PTR size);
Parameter Description
hSession Open session on the slot containing the object
obj Object whose attribute is to be retrieved
type Attribute to retrieve
buf Buffer to hold the attribute value
len Total number of bytes referenced by buf
size Reference to CK_SIZE to hold the number of bytes copied into buf

On Successful Return

buf — contains the attribute value

*size — number of bytes copied to buf

If buf is too small to hold the attribute value (that is, len is < attribute value length), then CKR_ATTRIBUTE_TYPE_INVALID is returned. 

To determine the attribute value length, pass in 0 for len, and check the resulting value of *size.