Thanks for clarifying. 🙂
The link manpages gives a good walk through to apt-key utlity.
Add a new key to the list of trusted keys. The key is read from the filename given
with the parameter filename or if the filename is ' - ' from standard input.
So when we use sudo apt-key add – , it uses everything before the | as STDIN .
Not sure why you received the error but both of them should be working fine. Would like to see what the error says .