How to save encrypted password in TinyDB?


It is possible to open a TinyDB (maybie using notecard/wordpad) and read a TinyDB contents?

I’m concerned about saving a user password into the TinyDB!
There is any way to encrypt and decrypt a password?

Thank you.


There are a bunch of ways to secure TinyDB.


TinyDB is a flat file format stores in the application specific storage directory on the device.

To use TinyDB you read and write content to it. As it is a flat file system you have to have a proceedure to encrypt the entire thing, or encrypt the contents.

So you have three options.

  1. Encrypt and decrypt the Database as a whole everytime the app opens and closes. The problem there is an ungraceful shutdown, and now the database is exposed.

  2. Ensuring your write in encrypted, and read in encrypted. So there you need to set either a password, or a key and salt.

  3. You remote store your data.

A combination of option 2 and 3 would be very secure. Don’t over think it. It is their device, and TinyDB should be used to store their information, so you can rely on a level of certainty and assumption.

Choose why you want security, and then you can choose the way to apply it.



Thank you for the information!

I’m storing data in a Firebase database!
However, there are some info that I’de like to store in the local TinyDB such as “Name”, “EMail” and “Password”!
I think there are no danger with it, only the Password worries me! There is any way to encrypt/decrypt the password in the TinyDB?

Simplest way:

Use the Cryptography component in utilities. Remember it is full duplex, meaning if you ecrypt and store, you need to decrypt to use.

When you store keys, or salts make sure they are obfuscated.

@cian, thank you!

You mean… this way?

If yes, how can I Obfuscate a text from a textbox?
It seems that the 2 pieces do not fit!

You need a key as well. Enter your text in the Obfuscate area.

1 Like

@cian, thank you!

Is this correct to encrypt/decrypt the “txSenhaReg.text”?

Looks good. You gotta try it.

One issue. Your key for 256 is not long enough. Do some research on the encryption types.

You might need a key like this.

iv =7E892875A52C59A3B588306B13C31FBD

1 Like

Thank you @cian, I’ll search for it!