Can I remove new lines from the RSA public key file to get a one line string? So the question is if the key looks like this
AAA BBB CCC
is this the same as
I'm assuming you mean a base 64 encoded key file, since removing the newlines from a binary file would obviously break things.
The RSA standards (e.g. RFC 2459) only define a binary representation for keys. In practice, like OpenPGP keys (RFC 4880), they are often encoded in base 64 using the otherwise obsolete PEM standards (RFC 1421).
The PEM printable encoding section says:
To represent the encapsulated text of a PEM message, the encoding function's output is delimited into text lines (using local conventions), with each line except the last containing exactly 64 printable characters and the final line containing 64 or fewer printable characters.
The OpenPGP radix 64 section says:
The encoded output stream must be represented in lines of no more than 76 characters each.
For SSH, on the other hand, RFC 4716 Section 3:
A key file is a text file, containing a sequence of lines. Each line in the file MUST NOT be longer than 72 8-bit bytes excluding line termination characters.
Do implementations in practice accept longer lines? I would expect many to do so. However, while no information is lost, it's technically nonconforming to use such encodings.