Sorry for that stupid title, maybe I’ll have a better one sometime later. My problem is this:
Using the Crypto methods RSAEncrypt and RSADecrypt works fine - until the string you encrypt contains international characters like and stuff. They will come back as ?? instead of or or . Well … similar with encodeBase64.
So I “wrapped” the string up before encoding it - put a “encodeHEX” around it. Works fine. I even found a way to lift the “length” barrier by dividing strings that are longer than 32 chars into several chunks that will be de & encrypted separately. I can now encrypt long sentences WITH special characters (like or or or WHATEVER) and decrypt them - works fine. In memory.
THEN I wanted to write that encrypted string into my cubeSQL tables. Looks like it works, too (at least I get a very similar pattern of funny characters in my table’s field) - but when I read from the database, the decryption fails because the string is not long enough or too long. I tried with “text” fields in the database as well as with a “blob”.
I am assuming at the moment that this might have something to do with the encodings. After the encryption the string has a “nil” encoding. When writing to a cubeSQL (and also realSQL I assume) - and reading it back from the table - the string is a UTF8. No way to get it back into a “nil” encoding - at least I don’t know a way.
That’s where I’m lost. I have been even trying to encodeHEX the string again after encoding (which makes it perfect to write into a database) - but … I’ll never get a clean string again to decrypt afterwards - again, encodeHEX also only works with UTF8 encoding - thus produces a string with UTF8 and I cannot NIL the encoding again, can I?
Arrgh. It’s been 10 hours now. Sorry for babbling so much - got to put some air in my brain and try again tomorrow. Or … do you have an idea?