I miss something with Base64 and AES.
Posted: Tue Apr 15, 2025 4:46 pm
I use the following code to encrypt some text:
After that, I copy paste that text in a php file that contains only an echo command to get the encrypted string. I try to decode it as follows:
I feel that it has something to do with formatting (UTF8, ASCII etc) but what?
Code: Select all
str$="some text"
size = StringByteLength(str$)+2
*buf = AllocateMemory(size)
*out = AllocateMemory(size)
size2 = size*1.5
PokeS(*buf,str$,size)
AESEncoder(*buf,*out,size,?key,256,?iv,#PB_Cipher_CBC)
Encoded$ = Base64Encoder(*out, size)
Debug Encoded$
FreeMemory(*buf)
FreeMemory(*out)Code: Select all
*Buffer = ReceiveHTTPMemory("the_link")
If *Buffer
str$ = PeekS(*Buffer, Size, #PB_UTF8|#PB_ByteLength)
Debug str$
size = Len(str$)
*buf = AllocateMemory(size)
*out = AllocateMemory(size)
size = Base64Decoder(str$, *buf, size)
AESDecoder(*buf,*out,size,?key,256,?iv,#PB_Cipher_CBC); key and iv are in DataSection
Debug "Content: " + PeekS(*out)
EndIf