In applying encryption for the first time, I’m not having much luck in getting a usable value.
For a secure website, I want to encrypt a number for inclusion in a URL.
encrypt(“60214”,”testSecretKey")
It generates something like: Yün»ßèy◊è+£8…j_J.»a™»»¥’»í∆Ú«f6K«$«jÂÛ¡V„Pˆ¶Ω9Y˜ÖHÿú8 ‰| >À¨U—0lùHïÁÔa
And each time it’s different. Is that because I’m viewing binary as text? BinaryToText( doesn’t seem to be the solution.
I am able to determine that it’s apparently processing correctly:
Let lvTest = decrypt(encrypt(“60214”,“testSecretKey”),“testSecretKey”)
Message lvTest
So the question is, how do I capture the result of the encryption in a form that can be passed on as text for use in a URL.
Jim, I am stumbling over the words a little. If you are “converting” the encrypted content to usable text, how do you get it back from “usable text”, to encrypted content, that then can be decrypted with the testsecretkey?
Maybe you use the encodebase64( to get “usable text” for use somewhere, while still saving the encrypted content somewhere else so it can decrypted when appropriate?
It looks like you are going from A to B to C and I’m asking how you get from C back to B so it can return to A.
Where A is the original text, B is the encrypted content of A, and C is the encodebase64( content of B.
Encodebase64( isn’t encryption. It’s a standard way of encoding binary data as text. The process is very straightforward and easily reversible. To get from C back to B you just use
No. It’s because each time text is encrypted, a random initiation vector is generated. This makes it more difficult for a hacker to break the encryption. (Please don’t ask for any more detailed questions - I am not an encryption specialist and in fact I had never heard of an initiation vector before today.
The BinaryToText( function only works with binary data that contains Unicode formatted text.
I submitted an addition for the encrypt( documentation
Thanks!
Inspired by your short note, I actually added a more complete explanation to this help page.
Jim Cook sent me a private email asking about decrypting data that has been encrypted by Panorama in another program. I think the answer might someday be useful to someone else, so I’m including it here.
It’s general wisdom that unless they are a professional cryptologist, a programmer should never roll their own cryptography. So rather than rolling a bespoke cryptography system, Panorama uses a very popular open source library called RNCryptor. This is very widely used by mac/ios developers. The actual encryption/decryption is performed by code that Apple supplies as part of macOS, but RNCryptor makes this much easier to use and less error prone.
If you need to encrypt and/or decrypt in some other program in a way that is compatible with Panorama, you’ll need to use the RNCryptor format, which is described here:
Fortunately, RNCryptor is so popular that open source versions of it have been written in several other languages.
JavaScript - (useful for Node.js)
Python -
C - (Compatible with macOS, Windows, and Linux)
There may be other implementations out there as well - this is just what I found with a few Google searches.