I copy text from Taxtarea and then encrypt it using rc4v6, I then copy it to the clipboard and shut down the program and then start it again I then paste the text back to a variable and decrypt it and this works fine.
But.
If I paste to an email and send it to myself then copy to clipboard and then paste to variable it turns out as garbage after decrypting.
Please except my apologies as seems I made a mistake and copying to and from the clipboard does not work.
the text to encrypt is:
“The cow jumped over the moon” Password is “fredfred”
the encrypted text that will decrypt if help in variable is =
“v1SJ2sR”
The text after sending to the clipboard and pasting back and decrypting is =
“z(ࠖ a9$
[ WVu”
Any further info just ask.
Double checked code but cannot see a problem.
It looks like you are working with binary data as if it is text, and that won’t work. Use @Jürg Otter 's suggestion and encode the data first, then decode before processing.
Thanks for the example - I didn’t feel comfortable writing one on the Phone while travelling by train when I posted the suggestions
@Ian Cartwright: The ‘Hex String’ suggestion would be the same approach. Instead of EncodeBase64 and DecodeBase64, you would use: EncodeHex and DecodeHex.
Same goal: Convert the “encrypted binary data” (a “bag of bytes”) in some form of “plain text” that can be processed further without much hassle (Encodings, Encodings-Conversions, Auto-Text-Formatting, or whatever else might be going on in an Email client and when sending the message through various mail servers).
The differences: Base64 will result in a smaller string that can be broken up by lines without additional processing, but is case-sensitive. Hex is longer, you would have to manually break it up into lines if desired, but is case-insensitive.