I want to manage my wireless connections through the terminal. I use:

/etc/init.d/wicd start
ifconfig wlan0 start
iwconfig wlan0 essid (name)
iwconfig wlan0 enc (key)
dhclient wlan0

It works fine with WEP. However, when I do iwconfig wlan0 enc (WPA2 key) it says: Error for wireless request "Set Encode" (8B2A): invalid arguement "(key)".

Is there something special when connecting to WPA or WPA2 networks?