I tried retrieving the password for a wireless network I'd joined sometime in the past. To do this, I went into Keychain Access, selected the System keychain, and asked it to Show Password for the networking in question.
As it turns out, the system keychain is protected with a shared secret which I believe is maintained in /var/db/SystemKey. This is a binary file, so it's not very easy to pull out the password in a form that can be entered in the dialog box Keychain Access presents.
As a work around, I found a nice hint [1] that uses Keychain Scripting to copy the password to the clipboard. Here's the Apple Script I'm using. Please not that the first character of a WEP key appears to be $, which should be discarded.
display dialog "What key?" default answer ""
set theKeyName to the text returned of the result
tell application "Keychain Scripting"
tell keychain "System.keychain"
set theKeyList to every key
repeat with k in theKeyList
if the name of k is theKeyName then
set TheKeyValue to the password of k
end if
end repeat
end tell
end tell
set the clipboard to TheKeyValue
display dialog "Copied " & length of TheKeyValue & " chars to clipboard." with icon note buttons {"OK"} default button "OK"
[1]
10.4: AirPort and System.keychain password solution