SQLite Encryption in Universal Windows Platform C# -
i'm using sqlite.net-pcl v 3.1.1 nuget package , vs extension sqlite universal windows platform 3.13.0.0. , code in windows 10 application in c# , xaml:
private void connecttodb() { var sqlpath = system.io.path.combine(windows.storage.applicationdata.current.localfolder.path, "persons.sqlite"); using (sqlite.net.sqliteconnection conn = new sqlite.net.sqliteconnection(new sqlite.net.platform.winrt.sqliteplatformwinrt(), sqlpath)) { var res = conn.execute("pragma key = 'mypass'"); conn.createtable<person>(); conn.insert(person.newpersion()); } } public class person { public static person newpersion() { return new person() { uuid = guid.newguid().tostring(), name = "john", age = 12 }; } [primarykey] public string uuid { get; set; } public string name { get; set; } public int age { get; set; } }
this code works, creates db , inserts person. not working line
var res = conn.execute("pragma key = 'mypass'");
the weird thing 3 months ago got working, , trying open db without pragma key use throw:
'file encrypted or not database'
which perfect because db encrypted. in fact trying open db generated in windows 10 sqliteexplorer throws exact error.
i need able encrypt db before, tried downloading previous libraries of extension , nuget no luck. manages encrypt sqlite db code?
regards.
Comments
Post a Comment