encrypt/decrypt & choosing a cipher

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
aetaylorBUSBnWt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 57
Joined: Thu Sep 20, 2012 5:11 pm

encrypt/decrypt & choosing a cipher

Post by aetaylorBUSBnWt » Sun Sep 27, 2020 9:31 pm

Hello,

I was happy to see the functions, not so happy with the documentation.
After doing a bunch of internet searching eventually I got the idea that picking a cipher was pretty much a personal preference because discovering the differences between ciphers requires more knowlege and research than I am willing to invest.

However it seemed that aes-128-gcm was considered very secure and not too time consuming.
Apparently aes-128-cbc has some issues with file size blocks or something that breaks it or some problem.
So I tried aes-128-gcm.
encrypt works fine. decrypt crashes. Livecode just says that there is an error, no details.
So I back off and use the cipher aes-128-cbc that is in the LiveCode dictionary.
That works.

So anybody know what the deal is with ciphers or is aes-128-cbc the only one we are allowed to use?

(all testing done on a Mac using LiveCode Indy 9.6.1 build 15522

Some additional info since original post.
aes-256-cbc works as a cipher too.
So maybe it is that aes-128-gcm is not implemented?

Love to hear about what ciphers others are using for encrypt/decrypt and why they picked the cipher they use.

Code: Select all

on mouseUp
    local theData
    local encData
    local decData
    local errMsg
    put "abcdefghipklmnopqrstuvwxyz" into theData
    encrypt theData using "aes-128-cbc" with password "test123"
    put it into encData
    put the result into errMsg
    decrypt encData using "aes-128-cbc" with password "test123"
    put it into decData
    put the result into errMsg

--above code works just fine

    encrypt theData using "aes-128-gcm" with password "test123"
    put it into encData
    put the result into errMsg
    //all good so far, next line has some problem.
    decrypt encData using "aes-128-gcm" with password "test123"
    //above line fails with "execution error at line nn (32766), char 1
    
    put it into decData
    put the result into errMsg

end mouseUp

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”