def C_DeriveKey(mechanism, base_key, template={})
      obj = @pk.C_DeriveKey(@sess, to_mechanism(mechanism), base_key, to_attributes(template))
      Object.new @pk, @sess, obj
    end
def C_DeriveKey(mechanism, base_key, template={})
      obj = @pk.C_DeriveKey(@sess, to_mechanism(mechanism), base_key, to_attributes(template))
      Object.new @pk, @sess, obj
    end
Derives a key from a base key, creating a new key object.

 @param [Hash, Symbol, Integer, PKCS11::CK_MECHANISM] mechanism  used mechanism
 @param [PKCS11::Object] base_key  key to derive
 @param [Hash] template  Attributes of the object to create.
 @return [PKCS11::Object]  key object of the new created key.
 @example Derive a AES key by XORing with some derivation data
     deriv_data = "\0"*16
     new_key = session.derive_key( {CKM_XOR_BASE_AND_DATA => {:pData => deriv_data}}, secret_key,
       :CLASS=>CKO_SECRET_KEY, :KEY_TYPE=>CKK_AES, :VALUE_LEN=>16, :ENCRYPT=>true )