/** * Returns the PKCS#11 attributes of an object. The array * contains CK_ATTRIBUTE objects, one for each set attribute of this object; * e.g. for each attribute that is not null. * The array can be used directly as input for the PKCS#11 wrapper. The * Session class uses this method for various object operations. * * @param object * The iaik.pkcs.pkcs11.object.Object object to get the attributes * from. * @return An array of CK_ATTRIBUTE objects. null, if the given object is * null. * @exception PKCS11Exception * If setting the attribute values. * @preconditions * @postconditions */ public static CK_ATTRIBUTE[] getSetAttributes(PKCS11Object object) throws PKCS11Exception { Vector<CK_ATTRIBUTE> setAttributes = (object != null) ? object.getSetAttributes() : null; CK_ATTRIBUTE[] ckAttributes = (setAttributes != null) ? Util.convertAttributesVectorToArray(setAttributes) : null; return ckAttributes; }
/** * Initializes a find operations that provides means to find objects by * passing a template object. This method gets all set attributes of the * template object and searches for all objects on the token that match with * these attributes. * * @param templateObject * The object that serves as a template for searching. If this * object is null, the find operation will find all objects that * this session can see. Notice, that only a user session will see * private objects. * @exception TokenException * If initializing the find operation fails. * @preconditions * @postconditions */ public void findObjectsInit(PKCS11Object templateObject) throws TokenException { CK_ATTRIBUTE[] ckAttributes = PKCS11Object.getSetAttributes(templateObject); try { pkcs11Module.C_FindObjectsInit(sessionHandle, ckAttributes); } catch (sun.security.pkcs11.wrapper.PKCS11Exception ex) { throw new PKCS11Exception(ex); } }
long objectToUpdateHandle = objectToUpdate.getObjectHandle(); CK_ATTRIBUTE[] ckAttributesTemplates = PKCS11Object.getSetAttributes(templateObject); try { pkcs11Module.C_SetAttributeValue(sessionHandle,
throws TokenException { CK_ATTRIBUTE[] ckPublicKeyAttributes = PKCS11Object.getSetAttributes(publicKeyTemplate); CK_ATTRIBUTE[] ckPrivateKeyAttributes = PKCS11Object.getSetAttributes(privateKeyTemplate);
CK_ATTRIBUTE[] ckAttributes = PKCS11Object.getSetAttributes(templateObject); long objectHandle; try {
PKCS11Object templateObject) throws TokenException { long sourceObjectHandle = sourceObject.getObjectHandle(); CK_ATTRIBUTE[] ckAttributes = PKCS11Object.getSetAttributes(templateObject); long newObjectHandle; try {
CK_ATTRIBUTE[] ckAttributes = PKCS11Object.getSetAttributes(template);
Util.requireNonNull("wrappedKey", wrappedKey); CK_ATTRIBUTE[] ckAttributes = PKCS11Object.getSetAttributes(keyTemplate);
CK_MECHANISM ckMechanism = toCkMechanism(mechanism); Params params = mechanism.getParams(); CK_ATTRIBUTE[] ckAttributes = PKCS11Object.getSetAttributes(template);