neuhalje / bouncy-gpg

Make using Bouncy Castle with OpenPGP fun again!
https://neuhalje.github.io/bouncy-gpg/
Other
208 stars 54 forks source link

Lower required Android API to 9 and use Animal Sniffer #18

Closed vanitasvitae closed 6 years ago

vanitasvitae commented 6 years ago

Hi! This PR removes the usage of some newer Java features like stream semantics in order to allow the library to be used in Android applications targeting API level 9 and above. I hope I didn't break anything, but the test cases (which I had to alter as well) are all passing.

I created this PR as I'm participating in this years Google Summer of Code. As part of my project I want to utilize this library to implement XEP-0373 and XEP-0374 (OpenPGP for XMPP) for the XMPP client library Smack.

I appreciate any feedback :)

neuhalje commented 6 years ago

Hi Paul,

thanks for the contribution! Although possible, I am a bit reluctant to force the library to Java 7 features. But this is not necessarily a blocker (for now).

Are you restricted to Android API 9? Java 8 is supported with SDK 24. SDK 24 is used on ~35% of all devices.

From what I have heard Bouncy Castle does not run well on android, but that could be old news.

Have you already tried to run Bouncy Castle on API v9 devices? (see the linked Spongy Castle issue)

vanitasvitae commented 6 years ago

I am a bit reluctant to force the library to Java 7 features.

I'm also fine with maintaining my own fork for now :) I just hope that my contributions might benefit others, so I try to upstream as much as possible :D

neuhalje commented 6 years ago

I am all for "upstream" commits :-). The codebases does not use many Java 8 features, so this is no real loss (yet). If my lib helps your project I am willing to merge.

I'll do a more thorough review tomorrow (or the day after)!

Out of curiosity: Both XEPs state

WARNING: This document has been automatically Deferred after 12 months of inactivity in its previous Experimental state. Implementation of the protocol described herein is not recommended for production systems. However, exploratory implementations are encouraged to resume the standards process.

vanitasvitae commented 6 years ago

WARNING: This document has been automatically Deferred after 12 months of inactivity in its previous Experimental state. Implementation of the protocol described herein is not recommended for production systems. However, exploratory implementations are encouraged to resume the standards process.

That only means that there was no input on the XEP after one year. There are no implementations afaik, so I'm kinda sailing into unknown waters :)

vanitasvitae commented 6 years ago

The best way would be to loosen your "support (very) old devices" requirement.

Unfortunately that is not an option for me. Smack is apparently used primarily in developing countries, so having support for old devices is a requirement.

I think for now I will go with creating a fork of your project that fits my needs :)

neuhalje commented 6 years ago

No worries! If I can help you, just give me a note (create an issue :-) ), and if it is good for bouncy_gpg I'll add it, so you can merge into your fork.