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

4736 commits

Author SHA1 Message Date
Florian Schmaus
14142a0ef2 [omemo] Introduce OmemoAesCipher as central AES API
OmemoAesCipher is the sole point where OMEMO related AES operations
are performed. This allows OmemoAesCipher to check in a static block
if AES is available. If AES is not available it throws a (hopefully)
helpfull exception message.

Typically AES is not available on Android if no security provider
providing AES, like Bouncy Castle, has been explicitly configured.
2021-03-14 12:48:01 +01:00
Florian Schmaus
b7905d585d [omemo] Use RandomUtil.fillWithSecureRandom() to generate IV 2021-03-14 12:48:01 +01:00
Florian Schmaus
17ac41c8cb [core] Add RandomUtil.fillWithSecureRandom(byte[]) 2021-03-14 12:48:01 +01:00
Florian Schmaus
7cf0112487 [omemo] Cleanup CryptoFailedException
Remove the unused list of exceptions and add a (String, Exception)
constructor.
2021-03-14 12:48:00 +01:00
Florian Schmaus
c7b429535b [doc] Fix extensions/index.md table 2021-03-10 10:24:39 +01:00
Florian Schmaus
f9114f780d [tcp] Ignore exceptions in reader thread if writer was terminated
If we do not ignore the exception, then users may receive an exception
via connectionClosedOnError() on connection termination. Those
exceptions are typically unwanted if they are caused e.g. because the
server does not send a closing stream tag.

We previously ignored exceptions in this case already, but that
behavior was changed with [1: 57961a8cc1]. This commit re-adds the
behavior.

1: 57961a8cc1
   Remove SynchronizationPoint
2021-03-09 19:27:53 +01:00
Florian Schmaus
4adbd21a0f [smack-xmlparser] Allow override of used XmlPullParserFactory 2021-03-03 22:25:32 +01:00
Florian Schmaus
3bef905ef5 [xmlparser-stax] Move getNamespace() to its friends within the file 2021-03-03 21:43:43 +01:00
Florian Schmaus
ba6968fc79 [xmlparser-stax] Fix potential IAE in StaxXmlPullParser.getNamespace()
StAX's NamespaceContext.getNamespaceURI(String) is allowed to throw an
IllegalArgumentException in case the argument is null. We simply
re-use getNamespace(String) which will substitute the default
namespace if the argument is null to avoid this.

Connection closed due to an exception
java.lang.IllegalArgumentException: Illegal to pass null as argument
at com.ctc.wstx.sr.NsInputElementStack.getNamespaceURI(NsInputElementStack.java:486)
at org.jivesoftware.smack.xml.stax.StaxXmlPullParser.getNamespace(StaxXmlPullParser.java:113)
at org.jivesoftware.smack.AbstractXMPPConnection.parseFeatures(AbstractXMPPConnection.java:1852)
at org.jivesoftware.smack.AbstractXMPPConnection.parseFeaturesAndNotify(AbstractXMPPConnection.java:1887)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1300(XMPPTCPConnection.java:130)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:983)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:913)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:936)
at java.lang.Thread.run(Thread.java:748)

Fixes SMACK-903
2021-03-03 21:41:07 +01:00
Florian Schmaus
48f5e349b9 Smack 4.4.1
-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAmA/eF1fFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFLlCQf6A9u5hd2v36Cve/Iopx/GAjuHBNu/7DYop7gP7vLtKxUBGCS/DLn8kaov
 ujpTvdcpm6pg7F4uivMnADFqkkL9cUwsBPDyNY8c0ygfGzVPU8P47g00/SBhB7kP
 0/0In4eunXt8+tfs/afHrr1kQG66lq5J/9q8M6bbC9pUYO2g5Flxes0WW9azluVh
 zs39CCtXPeXwr6Lh+HNEyIe/WiHKnOj7zkwpV7htmOnPaedlRJj/e8KbcBDxmZhg
 zbMoI3Puq3grlA6spke6Z7HK6IeFZjbZABI4EeCEUVhUq1VvL0JurV92S672dty+
 SXX64GbA5TLbVq04I+NP28x9kgnRiw==
 =skkJ
 -----END PGP SIGNATURE-----

Merge tag '4.4.1'

Smack 4.4.1
2021-03-03 13:39:57 +01:00
Florian Schmaus
7d6891c077 Smack 4.4.2-SNAPSHOT 2021-03-03 13:38:25 +01:00
Florian Schmaus
ae44af5d63 Smack 4.4.1 2021-03-03 12:51:56 +01:00
Frank Matheron
d4d2a7a6d8 [xdata] Do not require FORM_TYPE field in FilledForm
The FillableForm API is the most convenient way of filling out a
form. Currently only forms with a FORM_TYPE can be filled, due to a
restriction in FillableForm. This makes filling out untyped forms very
cumbersome.

This commit removes the required FORM_TYPE when using FilledForm (and
therefor FillableForm). Some subclasses of FilledForm already check
that the correct FORM_TYPE is set using FilledForm#ensureFormType().
2021-03-03 12:42:17 +01:00
Florian Schmaus
bca3821343
Merge pull request #465 from Flowdalic/xdata-order-fields
[xdata] Order fields
2021-03-03 10:11:40 +01:00
Florian Schmaus
33f59fd7ed [xdata] Ensure that hidden FROM_TYPE field is first 2021-03-02 21:40:52 +01:00
Florian Schmaus
687c4f35aa
Merge pull request #464 from Flowdalic/relax-forms-v2
Relax forms (v2)
2021-03-02 15:50:09 +01:00
Florian Schmaus
1c262471e5 [xdata] Use extra registry for fields in clark notation
If a field name is in clark notation, then lookup the field's type via
an extra registry.
2021-03-02 11:43:23 +01:00
Florian Schmaus
3c4610d500 Merge branch 'master' of github.com:igniterealtime/Smack 2021-02-28 11:59:36 +01:00
Florian Schmaus
19521174f4
Merge pull request #463 from vanitasvitae/intellij_import
Add Smack import schema file for Intellij
2021-02-27 16:06:34 +01:00
af77543544
Add Smack import schema file for Intellij 2021-02-27 15:11:11 +01:00
Florian Schmaus
1a1a67a2c5 [core] Add assert message in AbstractXMPPConnection.onStreamOpen() 2021-02-25 22:09:59 +01:00
Florian Schmaus
d881395d05
Merge pull request #460 from Flowdalic/ci-java-15
Run CI also with Java 15
2021-02-15 13:43:48 +01:00
Florian Schmaus
4e90db3191 [gitlab-ci] Also check with Java 15 2021-02-15 13:12:24 +01:00
Florian Schmaus
8b0248c346 Bump Mockito to 3.7.7 2021-02-15 13:12:24 +01:00
Florian Schmaus
4aacdc5154 Add smack-websocket-java11
This also lifts a bunch of logic from smack-websocket-okhttp into
smack-websocket. Furthermore, the following subprojects require now
Java 11:
- smack-integration-test
- smack-omemo-signal-integration-test
- smack-repl
- smack-websocket-java11

Related tracking issue: SMACK-835
2021-02-14 20:34:40 +01:00
Florian Schmaus
cd40455b62 [smack-integration-test] Bump reflections to 0.9.12
This also means that smack-integration-test needs to declare a
dependency on Guava, which was previously available as transitive
dependency of 'reflections' 0.9.11.
2021-02-14 18:37:44 +01:00
Florian Schmaus
fe3214291d Bump Bouncy Castle to 1.68 2021-02-14 18:35:50 +01:00
Florian Schmaus
9261d6485e [openpgp] Do not put the BouncyCastleProvider at first position
This causes

java.security.InvalidKeyException: cannot identify XDH private key

on Java 11 or higher.

See also
- https://github.com/bcgit/bc-java/issues/620
- https://github.com/bcgit/bc-java/issues/589
- https://github.com/corretto/corretto-11/issues/168
- https://bugs.openjdk.java.net/browse/JDK-8171279
2021-02-14 18:35:49 +01:00
Florian Schmaus
ce4f85acf8
Merge pull request #459 from Flowdalic/reported-data
[DataFormProvider] Retrieve field types from <reported/> if possible
2021-02-01 16:04:48 +01:00
Florian Schmaus
bda3901910 Deprecate DataForm.Builder.setType() 2021-01-29 20:40:05 +01:00
Florian Schmaus
070aa8e28e [DataFormProvider] Retrieve field types from <reported/> if possible
Fixes SMACK-902.
2021-01-29 20:40:05 +01:00
Florian Schmaus
86b48fbf00
Merge pull request #458 from Flowdalic/errorprone
Bump ErrorProne to 2.5.1 and refactor Providers a bit
2021-01-29 09:45:24 +01:00
Florian Schmaus
a7b3303f3e Bump ErrorProne to 2.5.1 and refactor Providers a bit
This also resulted in a refactoring of the Providers and parsing
Exceptions. NumberFormatException and ParseException can now be thrown
directly, the wrapping in a SmackParsingException is down at a higher
layer, i.e. in AbstractProvider.
2021-01-29 09:26:15 +01:00
Aditya Borikar
1df0763f92 Remove AbstractWebsocketNonza since it is no longer needed 2021-01-25 20:31:51 +01:00
Florian Schmaus
c5a546554b Rework WebSocket code
Related to SMACK-835.
2021-01-25 19:56:54 +01:00
Florian Schmaus
0c013e4f29 Merge branch '4.4' 2021-01-25 19:48:16 +01:00
Florian Schmaus
9ab50c374d [extensions] Use StanzaView as parameter type in BoBDataExtension.from()
BoBDataExtensions can also appear in IQs (Registration IQ), and
potentially also Presence stanzas.

Fixes SMACK-901.
2021-01-25 14:29:21 +01:00
Florian Schmaus
84d73e9623 [core] Fix XmlEnvironment namespace: Use default namespace (not element's)
Assume the element
<foo:bar xmlns='namespace' xmlns:foo='foo-namespace'/>

then the <bar/> element's namespace is 'foo-namespace', but the
default namespace is 'namespace'. And this is the namespace that
scopes into inner elements.
2021-01-25 14:24:55 +01:00
Florian Schmaus
ec80ab4a20
Merge pull request #456 from Flowdalic/coveralls
[gradle] Bump coveralls-gradle-plugin to 2.10.2
2021-01-12 16:04:22 +01:00
Florian Schmaus
9fb4a2bf4f [gradle] Bump coveralls-gradle-plugin to 2.10.2
This should make it work with Github Actions.
2021-01-12 13:13:16 +01:00
Florian Schmaus
ec2ef1facc
Merge pull request #455 from Flowdalic/fix-data-form-npe
[xdata] Fix NPE in DataForm.Builder.addItem()
2021-01-12 12:31:17 +01:00
Florian Schmaus
d64a9d9029 [xdata] Fix NPE in DataForm.Builder.addItem()
Fixes SMACK-900.
2021-01-12 09:41:46 +01:00
Florian Schmaus
1bfb9f34f1 Merge branch '4.4' 2021-01-12 09:22:42 +01:00
Florian Schmaus
9d734c4a3e
Merge pull request #454 from Flowdalic/readme-build-status-github-actions
[README] Switch "build status" badge from Travis to Github Actions
2021-01-12 09:21:54 +01:00
Florian Schmaus
3a661d71b9
Merge pull request #453 from Flowdalic/fix-caps-npe
[caps] Check for null in EntityCapsManager.addCapsExtension()
2021-01-12 09:12:16 +01:00
Florian Schmaus
8cc4ba0a42 [README] Switch "build status" badge from Travis to Github Actions
This also renames the CI workflow from "Smack CI" to just "CI".
2021-01-12 09:08:34 +01:00
Florian Schmaus
df3ca4100b [caps] Check for null in EntityCapsManager.addCapsExtension()
To avoid a NPE, we check for null in addCapsExtension.

Fixes SMACK-899.
2021-01-12 09:01:19 +01:00
Florian Schmaus
c431d84154 Merge branch '4.4' 2021-01-10 20:45:32 +01:00
Florian Schmaus
938a4271f3
Merge pull request #452 from Flowdalic/abstract-provider-element-type
[core] AbstractProvider should also consider TypeVariable
2021-01-10 20:45:12 +01:00
Florian Schmaus
6eda93228f [core] AbstractProvider should also consider TypeVariable
aTalk shows the following exception:

2020-12-14 12:11:13.704 7370-30976/org.atalk.android E/AndroidRuntime: FATAL EXCEPTION: AccountManager.loadStoredAccounts
    Process: org.atalk.android, PID: 7370
    java.lang.AssertionError: Element type 'EE' is neither of type Class or ParameterizedType
        at org.jivesoftware.smack.provider.AbstractProvider.<init>(AbstractProvider.java:46)
        at org.jivesoftware.smack.provider.Provider.<init>(Provider.java:40)
        at org.jivesoftware.smack.provider.ExtensionElementProvider.<init>(ExtensionElementProvider.java:29)
        at org.xmpp.extensions.DefaultExtensionElementProvider.<init>(DefaultExtensionElementProvider.java:43)
        at org.xmpp.extensions.coin.CoinIQProvider.<init>(CoinIQProvider.java:46)
        at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.initialize(ProtocolProviderServiceJabberImpl.java:2091)
        at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderFactoryJabberImpl.createService(ProtocolProviderFactoryJabberImpl.java:121)
        at net.java.sip.communicator.service.protocol.ProtocolProviderFactory.loadAccount(ProtocolProviderFactory.java:934)
        at net.java.sip.communicator.service.protocol.AccountManager.doLoadStoredAccounts(AccountManager.java:139)
        at net.java.sip.communicator.service.protocol.AccountManager.loadStoredAccounts(AccountManager.java:294)
        at net.java.sip.communicator.service.protocol.AccountManager.runInLoadStoredAccountsThread(AccountManager.java:394)
        at net.java.sip.communicator.service.protocol.AccountManager.access$000(AccountManager.java:36)
        at
		net.java.sip.communicator.service.protocol.AccountManager$1.run(AccountManager.java:329)

where CoinIQProvider line 46-47 [1] reads

    private final DefaultExtensionElementProvider<URIsExtension> urisProvider
            = new
			DefaultExtensionElementProvider<>(URIsExtension.class);

This fixes SMACK-898.

1: f61f264312/aTalk/src/main/java/org/xmpp/extensions/coin/CoinIQProvider.java (L47)
2021-01-10 20:37:01 +01:00