Hi guys!
I’m trying to encode my data before putting it in the database, like this:
local json = require("json") local sqlite3 = require("sqlite3") local openssl = require( "plugin.openssl" ) local cipher = openssl.get\_cipher ( "aes-256-cbc" ) local path = system.pathForFile( "game.db", system.DocumentsDirectory ) local db = sqlite3.open( path ) local myPassword = ""--my password local myTable = { --myData } --table to json local data = json.encode(myTable) --cripto i dati prima di memorizzarli local encryptedData = cipher:encrypt ( data, myPassword ) local query = string.format("INSERT INTO %s VALUES (NULL, %d, '%s');", tableName, num, encryptedData)
The fact is that some tables are saved and others do not.
The query fails.
Apparently the new encrypted string contains “[” or “]” characters that create problems…
Is there a way to prevent encrypted data from having problems with the query? One way to make this smooth…