Search found 25 matches

by MarkOtt
Wed Jan 06, 2021 2:27 pm
Forum: Tricks 'n' Tips
Topic: Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll
Replies: 18
Views: 13922

Re: Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll


Hi Markus
Did you know how to decipher a sqlite database when you know the password
THanks

@loulou2522

You can open and read the database as shown in the program in the first post, then store it unciphered again.

Alternatively you can use the mentioned "DB Browser for SQLite", it is free to ...
by MarkOtt
Wed Jan 06, 2021 12:45 pm
Forum: Tricks 'n' Tips
Topic: Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll
Replies: 18
Views: 13922

Re: Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll

Hello!

I'm not sure what's wrong but when I'm trying to use this solution I'm getting an error on OpenDatabase() command (PB v5.72):

[16:55:33] [ERROR] UseODBCDatabase(), UseSQLiteDatase() or UsePostgreSQLDatabase() need to be called before using database commands.

Did anybody try it on later PB ...
by MarkOtt
Thu Jun 20, 2019 8:59 am
Forum: Tricks 'n' Tips
Topic: Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll
Replies: 18
Views: 13922

Re: Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll

Thank you very much for your hint, infratec.

Then I have 3 options:
- Including the password in the executable: everyone having the program can access the db.
- Deriving the password from a personal license code: only this user can access the db.
- Always asking for a password for db creation and ...
by MarkOtt
Tue Jun 18, 2019 6:50 pm
Forum: Tricks 'n' Tips
Topic: Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll
Replies: 18
Views: 13922

Re: Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll

What is the best way to pass a password-phrase to the SQL PRAGMA statement, that the password is hidden in the program as good as possible?

CheckDatabaseUpdate(0, "PRAGMA key = 'This is my pass phrase'")

Any good ideas?
by MarkOtt
Tue Jun 18, 2019 3:06 pm
Forum: Tricks 'n' Tips
Topic: Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll
Replies: 18
Views: 13922

Fully encrypted SQLite DB with PB 5.71 and SQLCipher.dll

With PureBasic 5.71 (Windows) it is now possible to have a fully encrypted SQLite database , if using the new PB feature to specify an external SQLite-DLL in UseSQLiteDatabase().

SQLCipher from Zetetic is an open-source extension integrated in SQLite.dll with fully transparent 256-bit AES ...
by MarkOtt
Fri Jun 07, 2019 10:48 am
Forum: Applications - Feedback and Discussion
Topic: PB.Ex MTP (Windows)
Replies: 10
Views: 4196

Re: PB.Ex MTP (Windows)

Interesting detail:
After removing the physical connection (USB cable) from the PC/Windows, and after physically connecting the Android device again, then the correct file date (time written) appears in a subsequent MTPDirectoryEntryDate(). Disconnecting with CloseMTP() and CloseLibrary() and ...
by MarkOtt
Thu Jun 06, 2019 1:53 pm
Forum: Applications - Feedback and Discussion
Topic: PB.Ex MTP (Windows)
Replies: 10
Views: 4196

Re: PB.Ex MTP (Windows)

Just great!!

DeleteMTPFile() and DeleteMTPDirectory() are working perfect in Galaxy S3 to S7. 8)
Deleting a directory removes also the included subdirectories and files in one command. Very "powerful", but also very useful if handled carefully.


Regarding SendMTPFile() and the resulting file date ...
by MarkOtt
Thu Jun 06, 2019 10:04 am
Forum: Applications - Feedback and Discussion
Topic: PB.Ex MTP (Windows)
Replies: 10
Views: 4196

Re: PB.Ex MTP (Windows)

CreateMTPDirectory also works great on S3, S6 and S7. Thank you very much! :D
This will probably work fine on all Android with MTP enabled.
Multiple subdirectories can be created at once in one command, eg. \Card\Images\X\Y\Z\

Regarding SendMTPFile:
Shouldn't the file date be set automatically ...
by MarkOtt
Wed Jun 05, 2019 3:37 pm
Forum: Applications - Feedback and Discussion
Topic: PB.Ex MTP (Windows)
Replies: 10
Views: 4196

Re: PB.Ex MTP (Windows)

SendMTPFile works very well on Samsung Galaxy S3, S6 and S7.

As there is no command to create a subdirectory, the directory must exist already (including a new subdir in the target path does not help). The file date on the target device is always 1970.01.01. An existing file cannot be overwritten ...
by MarkOtt
Wed Jun 05, 2019 12:27 pm
Forum: Applications - Feedback and Discussion
Topic: PB.Ex MTP (Windows)
Replies: 10
Views: 4196

Re: PB.Ex MTP (Windows)

Hello RSBasic

Thank you very much for your really useful solution.
Works great with Galaxy S3, S6 and iPhone.

Is there also a way to load a file from the PC to the mobile?

Best regards. Markus
by MarkOtt
Tue Jan 30, 2018 11:10 am
Forum: Tricks 'n' Tips
Topic: Correct use of AES in CBC mode with a textual password
Replies: 8
Views: 4110

Re: Correct use of AES in CBC mode with a textual password

Here is my example code for encrypting/decrypting files (instead of strings), using StartAESCipher() and AddCipherBuffer().

The textual password (unicode) will be converted to binary hash with 32 Bytes for full complexity 256^32.
The InitializationVector with 16 Bytes will be changed for every new ...
by MarkOtt
Thu Jan 04, 2018 1:38 pm
Forum: Tricks 'n' Tips
Topic: Correct use of AES in CBC mode with a textual password
Replies: 8
Views: 4110

Re: Correct use of AES in CBC mode with a textual password

@walbus

Changed CRC32 to SHA3 in the last demo code.
(I will try to include your other suggestions as soon as possible.)

As mentioned above, this topic covers the use of AES encoding closely as provided in PureBasic 5.61.
(This makes sense as I am not able to verify the correctness of other ...
by MarkOtt
Wed Jan 03, 2018 10:03 am
Forum: Tricks 'n' Tips
Topic: Correct use of AES in CBC mode with a textual password
Replies: 8
Views: 4110

Re: Correct use of AES in CBC mode with a textual password

@walbus
Thank you very much for commenting critically on the code.
These are good points for improvement.

CRC32 is not a good idea, it doesn't belong in a code like this
I have choosen CRC32 deliberately because of its speed and because it is only used to detect randomly corrupted data, not for ...
by MarkOtt
Tue Jan 02, 2018 4:04 pm
Forum: Tricks 'n' Tips
Topic: Correct use of AES in CBC mode with a textual password
Replies: 8
Views: 4110

Re: Correct use of AES in CBC mode with a textual password

Example code for encrypting/decrypting strings (for files see below), using AESEncoder() and AESDecoder().

@walbus
Thanks for the additional information.

(16 Bytes padding for AES CBC encoding was already there.)

In the following code I have added:
- A hash/checksum to check the integrity of ...
by MarkOtt
Sat Dec 30, 2017 1:18 pm
Forum: Tricks 'n' Tips
Topic: [Module] FileExModule.pbi
Replies: 12
Views: 8502

Re: [Module] FileExModule.pbi

@walbus
@Thorsten1867
Thanks a lot! Now this is a very fine piece of code.
Best regards. Markus

PS. Meanwhile I tried to clarify the use of AES in CBC mode, please see at
http://www.purebasic.fr/english/viewtop ... 12&t=69853