Gabriele266 / MyOlder

An application to safe store files
3 stars 0 forks source link

Automatically generate password for user data #9

Open Gabriele266 opened 3 years ago

Gabriele266 commented 3 years ago

Implement generation for the password used to encrypt the safefiles list. Maybe use a global key or session keys.

Gabriele266 commented 3 years ago

New method: create a file to store last session informations. Hold there the last actions, the access time and the usage times. After every access, re-encrypt the user files and data with the new password and save them into the file.

Gabriele266 commented 3 years ago

Password generation

To generate the password, follow these steps:

  1. Salt the last session ID
  2. Concatenate the last access time formatted into his long form (using toString simply)
  3. Concatenate the Operating System Name (Android or Ios)
  4. Concatenate the last access duration
  5. Calculate the sha256 digest
  6. Use it as the password for the user file.

Session id calculation

To calculate the session ID, use the following steps.

  1. Get the operating system user name
  2. Get the os type
  3. Get the os version
  4. Get the current time
  5. Get the number of added files
  6. Generate a random number from 20 to 530000.
  7. Generate anothere random number in floating point from 11.34 and 900000.55555

After that all these informations are taken, concatenate them into a string and hash it using sha256.