Sure, you need to set the WPA options such as the wpa_psk, authen, encrypt, etc. However, you do have to fill out the whole structure, not just the parts you want to change. If you're not already, try getting the current structure first using wln_get_params, modify what you want to change the encryption, authentication, keys, etc, to, and then call wln_set_params.
If you're still having problems you need to debug as mentioned above.