# wpa_supplicant and PSK - How do I escape characters?



## Orum (Apr 19, 2012)

I'm trying to use wpa_supplicant in PSK mode, but my key has a few troublesome characters in it, namely backslash, \, and double quote, ".

I thought that you could simply escape these in a manner similar to how C escapes these characters, by putting a backslash in front of them, i.e. \\ results in a \ and \" results in ".  However, when I try to start wpa_supplicant with the characters escaped, it errors with:

```
Line 11: Invalid passphrase length 68 (expected: 8..63)
```
and a host of other errors following that, because it no longer has the PSK.

So, is there some other way I'm supposed to escape these characters?  The key is normally 63 characters long, and I wonder if it's calculating the key length before considering the escape sequences, which would be a bug.  If so, is the only way around this to use wpa_passphrase?


----------



## chip64c (Apr 26, 2012)

You might try converting your passphrase to a group of 64 hexadecimal digits (this is where some of the characters' values come into play); this is one of the two options when using PSK (the other is entering your passphrase either as is or some other way as ASCII characters, I believe).   The backslash character, as the double- and single-quote, is PRINTABLE ASCII, so the program might interpret that as such (this might be the error; whereas C will interpret it, the backslash, as a special indicator, the program that reads the key reads the backslash as character 0x5c, printable, therefore part of your key and not a non-printable).   I hope this helps; sorry if it does not.


----------



## CalvinZA (Jun 13, 2012)

I am not sure, I found this GUI to help with the configuration of wpa_supplicant.conf:
http://opal.com/freebsd/ports/net-mgmt/wifimgr/
Hope that helps.


----------

