Converting openssh public key to ssh2 (RFC 4716) format
The Base64 data in the two formats is identical -- you don't need to do anything fancy. All you need to do to convert between these formats is add/remove line breaks (at 70 characters) and change the header/trailer.
Note that both formats have a comment -- kaushik@kaushik-HP
in the OpenSSH key, and the line starting with Comment:
in the PEM key. Both are completely optional, and don't need to be converted.