[Botan-devel] RSA removes spaces from my text

Jack Lloyd lloyd at randombit.net
Fri Jan 23 14:21:29 EST 2009


On Thu, Jan 22, 2009 at 10:08:24AM -0500, Z. S. O. wrote:
> I have a fairly simple function below that uses RSA to encrypted a given
> string. Strangely, if I encrypt a string with spaces and decrypt it, the
> result is the same string with all spaces removed. For example, "Hello
> World!" will result in "HelloWorld!". Any particular reason for this?

I see in the source you sent that you are using a base64 coding. The
base64 decoder will by default strip/ignore whitespace, so this may be
the cause though this is just a guess. In your particular example of
"Hello World!" that doesn't seem right, though, because ! is not a
valid base64 char so if that were fed into the base64 decoder it would
throw an exception about bad inputs.

Can you send a the full source to a program demonstrating what you are
seeing? Certainly RSA itself does not interpret spaces specially.

-Jack



More information about the botan-devel mailing list