Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypted(?) Storage #14

Closed
kelna opened this issue Jun 6, 2018 · 12 comments
Closed

Encrypted(?) Storage #14

kelna opened this issue Jun 6, 2018 · 12 comments

Comments

@kelna
Copy link

kelna commented Jun 6, 2018

I have some questions: How does the app store keys? And how does it export them to external storage (e.g. GDrive)? Do you employ encryption? Thank you!

@Lekensteyn
Copy link

The tokens are not encrypted and I think that it is possible to have them backup up (either through adb backup or through GDrive).

allowBackup is true, which means that external backups and Google backups are allowed:

<application
android:allowBackup="true"

The normal SharedPreferences storage is used with MODE_PRIVATE. This just means that other apps cannot access it, but it is not encrypted in any way:

public TokenPersistence(Context ctx) {
prefs = ctx.getApplicationContext().getSharedPreferences(NAME, Context.MODE_PRIVATE);
gson = new Gson();
}

To actually employ encryption, the KeyStore API should be used:
https://developer.android.com/reference/java/security/KeyStore

@kelna
Copy link
Author

kelna commented Jun 18, 2018

To actually employ encryption, the KeyStore API should be used:

Seems to be a good idea. Does this mean that the original FreeOTP stores the keys unencrypted as well?

@Lekensteyn
Copy link

Does this mean that the original FreeOTP stores the keys unencrypted as well?

That is correct, the original FreeOTP implementation also lacks encryption. Their developers are open to implementing it though, indeed using the KeyStore API: freeotp/freeotp-android#6 (comment)

There is one PR to implement this, I have not reviewed though and mention it since it was referenced from the previous issue: freeotp/freeotp-android#150

@itsKV
Copy link

itsKV commented Oct 3, 2018

Facing same issue. Everytime I take backup, the .json file remains on phone storage in plaintext. It's obvious to keep it on same location and forget about it. Also, keeping a backup in plaintext is not recommended.

@helloworld1 Kindly implement.

@helloworld1
Copy link
Owner

Yes, encryption support is still on my todo list. I don't think FreeOTP+ can actually use KeyStoreAPI because the data needs to be stored elsewhere and restored on a different device.
I am thinking about using simpler (weaker) symmetric crypto to just encrypt secret part of the data.
Also I would like to have PIN / fingerprint support which requires quite some more work. If you are aware of any libraries to help the UI of PIN / fingerprint, it would be a great help here.

@itsKV
Copy link

itsKV commented Oct 5, 2018

I don't do ('dont know', precisely) any coding part. But, while lurking on internet, I came to know about some of the open source encryption libraries which can be implemented in android applications very efficiently.

https://facebook.github.io/conceal/
https://github.com/google/tink
https://github.com/google/capillary
https://github.com/simbiose/Encryption

Hope, this helps.

@bluikko
Copy link

bluikko commented Nov 8, 2018

I don't do ('dont know', precisely) any coding part. But, while lurking on internet, I came to know about some of the open source encryption libraries which can be implemented in android applications very efficiently.

I understood the comment was asking about libraries for the user interface part for PIN or libraries for fingerprint, not for encryption.

@itsKV
Copy link

itsKV commented Nov 9, 2018

encrypting tokens using any of the suggested library with user PIN/fingerprint hash will be sufficient.

@unicorntaco
Copy link

encryption support is still on my todo list.

How about lifting from another project?

https://github.com/andOTP/andOTP

@helloworld1
Copy link
Owner

@unicorntaco I found the implementation of andOTP pretty good and convincing. I wonder what is the advantage of FreeOTP / FreeOTP+. Also FreeOTP+ provides the capability to migrate to andOTP.

@lemmy04
Copy link

lemmy04 commented Mar 12, 2021

One big advantage of the original FreeOTP is that it uses a decent layout on tablets... see #121

@helloworld1
Copy link
Owner

Let's consolidate the discussion in #128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants