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

Encrypt backed up messages #780

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Encrypt backed up messages #780

wants to merge 9 commits into from

Conversation

ashh87
Copy link

@ashh87 ashh87 commented Aug 16, 2017

These patches allow using the openpgp android API to encrypt backed up messages (SMS only, no decryption on restore).

I've been using these patches for years. I've taken the experimental decryption stuff out from my old git repo, as I haven't had a chance to finish it, and have never really needed it. Maybe I'll get round to it some day, as well as encrypting MMS messages! Most important to me is SMS encryption though, because it prevents a compromised email address being used to get round two-factor authentication or account recovery using SMS for any other service which knows the user's phone number.

@yasmime
Copy link

yasmime commented Aug 27, 2017

I'm not receiving my messages

@hieu76
Copy link

hieu76 commented Aug 27, 2017 via email

@ashh87
Copy link
Author

ashh87 commented Aug 30, 2017

@yasmime Which messages - SMS or encrypted messages in email?

@ashh87
Copy link
Author

ashh87 commented Sep 12, 2017

Looks like it fails because Roboelectric can't inflate the extended preferences provided by the openpgp api. It needs to be told about them somehow.

@jberkel
Copy link
Owner

jberkel commented Sep 12, 2017

hmm I have no idea, maybe not supported by Robolectric?

android.view.InflateException: XML file ./src/main/res/xml/preferences.xml line #-1 (sorry, not yet implemented): Error inflating class java.lang.reflect.Constructor
	at android.preference.GenericInflater.createItem(GenericInflater.java:397)
	at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:430)
	at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
	at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
	at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
	at android.preference.GenericInflater.inflate(GenericInflater.java:326)
	at android.preference.GenericInflater.inflate(GenericInflater.java:263)
	at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:269)
	at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:1418)
	at com.zegoggles.smssync.activity.MainActivity.onCreate(MainActivity.java:140)

Looks like a bug: it tries to inflate java.lang.reflect.Constructor.

@ashh87
Copy link
Author

ashh87 commented Sep 16, 2017

Running the gradle build straight after the maven build results in more errors, because the roboelectric.properties points to the previously unpacked external libs, which it doesn't like. I think cleaning between builds might help this.

When I run the gradle build on its own, I continue to get a Resources$NotFoundException. According to http://robolectric.org/using-libraries/, gradle should pick up external libs automatically. I tried pointing it to the AndroidManifest.xml, via @config, but this didn't help. I'm not sure what to do to get gradle bult tests to work here - updated gradle/gradlewrapper?

@jberkel
Copy link
Owner

jberkel commented Sep 16, 2017

I think maven and gradle use different directories (build and target), so this shouldn't matter. Why would updating gradle help?

@ashh87
Copy link
Author

ashh87 commented Sep 16, 2017

Cleaning between builds brings the gradle build back to failing for the resource not found exception because I changed roboelectric.properties to point to the unpacked lib from the maven build (edit: which now passes). The clean gets rid of it, so on the gradle build, it goes back to failing for being unable to inflate the openpgp-api preferences, rather than because the unpacked lib it finds is somehow wrong for it.

The link above suggests gradle should organise everything so roboelectric doesn't need any special config. The maven build now passes, but the gradle build doesn't seem to put things together enough for roboelectric to pick up on the lib. I wondered if a different version of gradle might help, or maybe changing something in the gradle config? I don't know anything about configuring gradle really :S

@jberkel
Copy link
Owner

jberkel commented Sep 17, 2017

I'll have a look. the maven build will be removed soon, no point maintaining two different systems.

@ashh87
Copy link
Author

ashh87 commented Oct 16, 2017

Currently looking at custom runners (extended RobolectricTestRunner), with no success so far. Wonder if some shadow class would help to dodge round the problem.

@jberkel
Copy link
Owner

jberkel commented Oct 22, 2017

FIY: maven is gone from the master branch now

@jluttine
Copy link

Have I understood correctly that there's no encryption support in SMS Backup+ at the moment? Any ideas if that could happen any time in the near future?

@jberkel
Copy link
Owner

jberkel commented Sep 13, 2018

@jluttine there's no encryption support, and I'm not sure what's missing on this branch

@ashh87
Copy link
Author

ashh87 commented Sep 14, 2018

This branch won't compile because the preferences UI part of the encryption API isn't compatible with the version of support libs used here. All that needs to be done is create some new custom preferences and make sure everything still works as expected. These could even be contributed back to openkeychain.

This shouldn't take too long to do, but it has been on my task list for a long time.

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

Successfully merging this pull request may close these issues.

None yet

5 participants