sms-backup-plus icon indicating copy to clipboard operation
sms-backup-plus copied to clipboard

Encrypt backed up messages

Open ashh87 opened this issue 7 years ago • 14 comments

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.

ashh87 avatar Aug 16 '17 20:08 ashh87

I'm not receiving my messages

yasmime avatar Aug 27 '17 08:08 yasmime

Vào 17-08-2017 03:07, "ashh87" [email protected] đã viết:

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.

You can view, comment on, or merge this pull request online at:

https://github.com/jberkel/sms-backup-plus/pull/780 Commit Summary

  • use jcenter openpgp-api
  • Allow encrypting SMS messages

File Changes

Patch Links:

  • https://github.com/jberkel/sms-backup-plus/pull/780.patch
  • https://github.com/jberkel/sms-backup-plus/pull/780.diff

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jberkel/sms-backup-plus/pull/780, or mute the thread https://github.com/notifications/unsubscribe-auth/Ac2zsB-JOyRrmlT3Wid_ZcqKbynUEbaiks5sY0v7gaJpZM4O5aar .

hieu76 avatar Aug 27 '17 10:08 hieu76

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

ashh87 avatar Aug 30 '17 08:08 ashh87

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.

ashh87 avatar Sep 12 '17 08:09 ashh87

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.

jberkel avatar Sep 12 '17 15:09 jberkel

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?

ashh87 avatar Sep 16 '17 00:09 ashh87

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

jberkel avatar Sep 16 '17 11:09 jberkel

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

ashh87 avatar Sep 16 '17 22:09 ashh87

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

jberkel avatar Sep 17 '17 09:09 jberkel

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

ashh87 avatar Oct 16 '17 21:10 ashh87

FIY: maven is gone from the master branch now

jberkel avatar Oct 22 '17 20:10 jberkel

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?

jluttine avatar Sep 13 '18 08:09 jluttine

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

jberkel avatar Sep 13 '18 19:09 jberkel

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.

ashh87 avatar Sep 14 '18 06:09 ashh87