[Botan-devel] RSA removes spaces from my text

Z. S. O. tiredashell at gmail.com
Fri Jan 23 18:53:03 EST 2009


Yeah my "Hello World!" example was mistaken -- I never actually tested it
out, I just used it to illustrate what (I thought) was happening. Thanks for
the explanation.

I have another slightly related question. When I encrypt something in RSA or
AES, there is always one or two equal signs trailing at the end. These don't
appear to serve any purpose, as the string decrypts fine even when I remove
them. Why are they there, and how can I stop them from appearing?

Thank you again.

On Fri, Jan 23, 2009 at 2:21 PM, Jack Lloyd <lloyd at randombit.net> wrote:

> 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
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20090123/fcfe1e1a/attachment.html>


More information about the botan-devel mailing list