1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-04 23:55:58 +01:00
Commit graph

56 commits

Author SHA1 Message Date
Florian Schmaus
944dd71976
Merge pull request #341 from vanitasvitae/prekeyid
OMEMO: Allow prekey ID 0
2019-08-24 13:12:21 +02:00
a160358d5d
OMEMO: Allow prekey ID 0 2019-08-24 12:22:38 +02:00
Florian Schmaus
9923268391 Remove LOCK in OmemoManager and use Manager instance instead 2019-08-06 12:48:31 +02:00
Florian Schmaus
1bce378e6d smack-omemo*: Do not swallow IOException deep within the library
Those exception are caused by I/O operations in the OmemoStore, which
is now declaring that it throws those (since it is not uncommon for
I/O operations to cause IOExceptions). After all, this is nicely
demonstrated as this change is caused by switching with this commit to
the Android API 19 compatible methods in FileBasedOmemoStore, which
throw.

The library can not decide what to do in case of those exceptions,
hence it is sensible to expose them to the user.
2019-08-05 09:31:48 +02:00
Florian Schmaus
8da954f7a4 OpenPGP: Bump Pgpainless to 0.0.1-alpha7
Also unify how new Security Providers are installed.

Thanks to Paul Schaub for helping with this.
2019-07-30 09:37:19 +02:00
Florian Schmaus
4ca2c7cc69 Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks 2019-07-24 09:18:39 +02:00
Florian Schmaus
f7762c5db7 Add "whitespace after comma" checkstyle rule 2019-05-17 21:56:46 +02:00
Florian Schmaus
d2f5efcb20 Use StandardCharsets.(UTF_8|US_ASCII)
This also gets rid of a ton of UnsupportedEncodingException s.
2019-05-08 12:44:48 +02:00
Florian Schmaus
7f0dc72dab Update errorprone(-plugin) and make Unused(Variable|Method) an error 2019-05-07 23:09:00 +02:00
Florian Schmaus
4133eb175c Replace XPP3 by XmlPullParser interface wrapping StAX and XPP3
Introducing Smack's own XmlPullParser interface which tries to stay as
compatible as possible to XPP3. The interface is used to either wrap
StAX's XMLStreamReader if Smack is used on Java SE, and XPP3's
XmlPullParser if Smack is used on on Android.

Fixes SMACK-591.

Also introduce JUnit 5 and non-strict javadoc projects.
2019-05-06 22:10:50 +02:00
Florian Schmaus
d97fb126a1 Add PubSubManager.getInstanceFor() just like all other Managers
and deprecate PubSubManager.getInstance().
2019-04-16 11:21:22 +02:00
Florian Schmaus
c499556d07 Remove dead code from OmemoService 2019-04-02 16:00:18 +02:00
Florian Schmaus
7d7fbe6828 Do not explicity select the (crypto) Provider in smack-omemo
This makes the system select the "best" available provider.

Also the 'BC' provider in newer Android version does not longer
implement certain Ciphers, which causes an NoSuchAlgorithmException if
the Cipher is requested explicitly by the 'BC' provider:

E/XmppService: XmppServiceConnection - Error while sending pending messages
  org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException: java.security.NoSuchAlgorithmException: The BC provider no longer provides an implementation for Cipher.AES/GCM/NoPadding.  Please see https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html for more details.
      at org.jivesoftware.smackx.omemo.OmemoService.encrypt(OmemoService.java:375)
      at org.jivesoftware.smackx.omemo.OmemoService.createOmemoMessage(OmemoService.java:537)
      at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:341)
      at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:314)
      at es.iecisa.xmppservice.XmppServiceConnection.lambda$sendMessage$0(XmppServiceConnection.java:516)
      at es.iecisa.xmppservice.-$$Lambda$XmppServiceConnection$aBU_80chagvypMTSd-aSm7pRQRY.run(Unknown Source:4)
      at java.lang.Thread.run(Thread.java:764)
   Caused by: java.security.NoSuchAlgorithmException: The BC provider no longer provides an implementation for Cipher.AES/GCM/NoPadding.  Please see https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html for more details.
      at sun.security.jca.Providers.checkBouncyCastleDeprecation(Providers.java:563)
      at sun.security.jca.Providers.checkBouncyCastleDeprecation(Providers.java:346)
      at javax.crypto.Cipher.createCipher(Cipher.java:722)
      at javax.crypto.Cipher.getInstance(Cipher.java:717)
      at javax.crypto.Cipher.getInstance(Cipher.java:674)
      at org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder.setMessage(OmemoMessageBuilder.java:169)
      at org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder.<init>(OmemoMessageBuilder.java:116)
      at org.jivesoftware.smackx.omemo.OmemoService.encrypt(OmemoService.java:372)
      at org.jivesoftware.smackx.omemo.OmemoService.createOmemoMessage(OmemoService.java:537)
      at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:341)
      at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:314)
      at es.iecisa.xmppservice.XmppServiceConnection.lambda$sendMessage$0(XmppServiceConnection.java:516)
      at es.iecisa.xmppservice.-$$Lambda$XmppServiceConnection$aBU_80chagvypMTSd-aSm7pRQRY.run(Unknown Source:4)
      at java.lang.Thread.run(Thread.java:764)
2019-04-02 15:58:34 +02:00
Florian Schmaus
be10a6e850 Return Set instead of HashSet in UndecidedOmemoIdentityException 2019-02-18 11:39:49 +01:00
Florian Schmaus
8df69bd3ce Use XmlEnvironment in parsing/provider subsystem 2019-02-15 23:21:30 +01:00
Florian Schmaus
083dac8b83 Rework exceptions in the parsing / provider subsystem 2019-02-05 13:18:03 +01:00
Florian Schmaus
fee3ed81ca Introduce XmlEnvironment 2019-02-05 13:18:03 +01:00
a25890cfcc
Set message type to 'chat' for OMEMO messages 2018-11-24 15:49:12 +01:00
Florian Schmaus
0adcf889bf
Merge pull request #278 from vanitasvitae/omemoFileBasedStoreUrlEncode
Use new BareJidEncoder class in FileBasedOmemoStore
2018-11-08 07:38:43 +01:00
9302b08854
Use new BareJidEncoder class in FileBasedOmemoStore 2018-11-07 18:17:25 +01:00
Florian Schmaus
b7ea226c56 Bump "Error Prone" to 2.3.2
and gradle-errorprone-plugin to 0.6.
2018-10-31 16:06:31 +01:00
410c652074
Add integration test and fix checkstyle issues 2018-10-10 14:48:22 +02:00
378aa4b262 Business logic for handling read-only devices 2018-10-10 14:07:23 +02:00
afb432dcee Add store methods for message counters 2018-10-10 14:07:23 +02:00
Florian Schmaus
8702e57f96
Merge pull request #264 from vanitasvitae/emptyBundle
Do not allow OMEMO bundles without prekeys
2018-09-16 21:30:06 +02:00
2cf23892f6
Fail on parsing OMEMO bundle with missing prekeys 2018-09-16 17:40:59 +02:00
d50bb1df1d
OMEMO: properly handle item-not-found in refreshRepublishDeviceList.
Fixes SMACK-830
2018-09-02 16:23:42 +02:00
Florian Schmaus
4d4f92ba86 Rename PEP to Pep 2018-08-15 20:15:57 +02:00
Florian Schmaus
a00aa726fe Introduce CloseableUtil 2018-08-15 17:25:22 +02:00
e79f364e1d
Only ignore our own stale devices 2018-06-22 14:03:09 +02:00
Florian Schmaus
6e9fb17f8f Make CorruptedOmemoKeyException not swallow exceptions 2018-06-20 11:51:46 +02:00
1f731f6318
Rework support for XEP-0384: OMEMO Encryption
Changes:

    Rework integration tests
    New structure of base integration test classes
    bump dependency on signal-protocol-java from 2.4.0 to 2.6.2
    Introduced CachingOmemoStore implementations
    Use CachingOmemoStore classes in integration tests
    Removed OmemoSession classes (replaced with more logical OmemoRatchet classes)
    Consequently also removed load/storeOmemoSession methods from OmemoStore
    Removed some clutter from KeyUtil classes
    Moved trust decision related code from OmemoStore to TrustCallback
    Require authenticated connection for many functions
    Add async initialization function in OmemoStore
    Refactor omemo test package (/java/org/jivesoftware/smack/omemo -> /java/org/jivesoftware/smackx)
    Remove OmemoStore method isFreshInstallation() as well as defaultDeviceId related stuff
    FileBasedOmemoStore: Add cleaner methods to store/load base data types (Using tryWithResource, only for future releases, once Android API gets bumped)
    Attempt to make OmemoManager thread safe
    new logic for getInstanceFor() deviceId determination
    OmemoManagers encrypt methods now don't throw exceptions when encryption for some devices fails. Instead message gets encrypted when possible and more information about failures gets returned alongside the message itself
    Added OmemoMessage class for that purpose
    Reworked entire OmemoService class
    Use safer logic for creating trust-ignoring messages (like ratchet-update messages)
    Restructure elements/provider in order to prepare for OMEMO namespace bumps
    Remove OmemoManager.regenerate() methods in favor of getInstanceFor(connection, randomDeviceId)
    Removed some unnecessary configuration options
    Prepare for support of more AES message key types
    Simplify session creation
    Where possible, avoid side effects in methods
    Add UntrustedOmemoIdentityException
    Add TrustState enum
    More improved tests
2018-06-13 12:29:16 +02:00
Florian Schmaus
9161ba9e7d Improve MamManager API 2018-06-12 08:53:18 +02:00
Florian Schmaus
e8923b9d16 Enable trailing whitespace checkstyle check
for all source code regions, including javadoc.
2018-05-09 23:26:39 +02:00
Florian Schmaus
5ab2903c32 Change Element.toXml() to toXml(String enclosingNamespace) 2018-04-27 10:05:25 +02:00
Florian Schmaus
31244ae982 Make PubSub elements namespace aware
Also fixes SMACK-814.
2018-04-23 20:36:41 +02:00
Florian Schmaus
74f14484e6 Smack 4.2.4
-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAlrTPy5fFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFI5aAf/Rb6Y+hqxiHRbsmww74rt7HfgQnOjOjz3bPhgbVH2emzBHzxsU2pBBY87
 iTfCXjXA3qQ9FzluBchLrd9EciDEXq1A/ZblYnR+kch1DK7wvVipTPWIzOHt6ahD
 q7vfS9EmmFBCRjNM4tW8zwaajWWeJAWimXoZFxuy/n+2FORnx0x5NrnIHwYvyUtf
 nY432BOiCg7l6J9sgfcoYDgP0Ot4SkdfUIgGOYonv0lzKW8HkU/OZZwEMbFhlCHU
 s0inbU5ldDDP7xXIinDqHVSKpRlSIkaOJ0zbAQLjFz8h2fCnqDGhpnNbun8Xb7l2
 agsATloOl91tlUV5D+qRWjzkx7pDxA==
 =YqLS
 -----END PGP SIGNATURE-----

Merge tag '4.2.4'

Smack 4.2.4
2018-04-15 14:48:22 +02:00
e200f2ddf8
Add OMEMO to EME 2018-04-15 13:39:27 +02:00
Florian Schmaus
2efec89050 Rename XMPPError to StanzaError
Fixes SMACK-769.
2018-04-07 22:59:25 +02:00
Florian Schmaus
6a42d5baff Rework FileUtils 2018-04-06 10:25:06 +02:00
Florian Schmaus
a9ca1a0989 Enable ModifierOrder checkstyle check
Fixes SMACK-812
2018-03-29 12:35:11 +02:00
Florian Schmaus
b5209f4701 Enable RedundantModifier checkstyle check 2018-03-28 14:02:21 +02:00
Florian Schmaus
9e11b68144 Add comment style checkstyle rule requiring a space 2017-11-20 08:53:19 +01:00
Florian Schmaus
c70a1921db Use Async.go() in OMEMO PEPListener
to avoid a deadlock, since the PEP listener is synchronous.
2017-09-29 16:32:32 +02:00
Florian Schmaus
58181bab08 OMEMO: Unspaghetti PEP listener code
While I like Spaghetti, I don't like them in my code.

4 insertions, 24 deletions, *kaboom*. :)
2017-09-29 16:32:32 +02:00
Florian Schmaus
772e45da92 Introduce NotAPubSubNodeException
Fixes SMACK-759.
2017-08-14 20:23:35 +02:00
Florian Schmaus
2050b2f8b9 Remove OmemoManager.resourceSupportsOmemo()
since there is currently no way to determine if a full JID supports
OMEMO.
2017-07-23 10:58:55 +02:00
Florian Schmaus
7b5eecb821 Use AbstractConnectionListener in OmemoManager
and manually inline the setConnectionListener() method.
2017-07-23 10:58:55 +02:00
Florian Schmaus
2e61e0a4d3 Use Async.go() in OmemoManager's connection listener
to prevent a timeout exception since those are executed synchronously.
2017-07-23 10:58:55 +02:00
Florian Schmaus
57e19d1a4f Use Async.go() in OmemoCarbonCopyListener
to prevent a timeout exception since carbon copy listeners are
executed synchronously.
2017-07-23 10:58:55 +02:00