def C_GenerateKey(mechanism, template={})
      obj = @pk.C_GenerateKey(@sess, to_mechanism(mechanism), to_attributes(template))
      Object.new @pk, @sess, obj
    end
def C_GenerateKey(mechanism, template={})
      obj = @pk.C_GenerateKey(@sess, to_mechanism(mechanism), to_attributes(template))
      Object.new @pk, @sess, obj
    end
Generates a secret key Object or set of domain parameters, creating a new
 Object.

 @param [Hash, Symbol, Integer, PKCS11::CK_MECHANISM] mechanism  used mechanism
 @param [Hash] template  Attributes of the key to create.
 @return [PKCS11::Object]  key Object of the new created key.
 @example generate 112 bit DES key
     key = session.generate_key(:DES2_KEY_GEN,
       {:ENCRYPT=>true, :WRAP=>true, :DECRYPT=>true, :UNWRAP=>true})