How does the ssh-keygen .pub format work with .pem files?

Solution 1:

OpenSSH key pairs are not PEM or any other x500 standard. New versions of OpenSSH can use X.509 PEM keys, but that's another ball of wax separate from ssh-keygen, and has to be configured explicitly. As best I know, no major implementation of SSH uses the exact same key formats as any other.

As Zoredache notes, if you're using something other than OpenSSH (deus iuvo vos), then it could be darn near anything.