Commit Graph

47 Commits

Author SHA1 Message Date
Paul Schaub 9f86eda532
OMEMO: converse.js compatibility 2019-08-04 15:00:25 +02:00
Florian Schmaus 4ca2c7cc69 Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks 2019-07-24 09:18:39 +02:00
Florian Schmaus 619b8e6f4a Add secure(OnlineAttackSafe|Unique|OfflineAttackSafe)RandomString()
and replace usages of java.util.UUID in Smack with
secureUniqueRandomString() because it uses a thread-local secure random
number generator.
2019-06-02 20:08:03 +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 89c0fa4b99 Let StringUtils.(insecure)randomString() return empty string
in case length is zero. Also do throw a NegativeArraySizeException if
length is negative instead of returning null.

This fixes the following sporadic test issue:

org.jivesoftware.smackx.ox.PainlessOpenPgpProviderTest > encryptDecryptTest FAILED
java.lang.AssertionError
at org.jivesoftware.smack.util.XmlStringBuilder.escape(XmlStringBuilder.java:425)
at org.jivesoftware.smackx.ox.element.EncryptedOpenPgpContentElement.addCommonXml(EncryptedOpenPgpContentElement.java:65)
at org.jivesoftware.smackx.ox.element.CryptElement.toXML(CryptElement.java:51)
at org.jivesoftware.smackx.ox.element.CryptElement.toXML(CryptElement.java:31)
at org.jivesoftware.smack.packet.Element.toXML(Element.java:41)
at org.jivesoftware.smackx.ox.element.OpenPgpContentElement.toInputStream(OpenPgpContentElement.java:186)
at org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider.encrypt(PainlessOpenPgpProvider.java:136)
at org.jivesoftware.smackx.ox.PainlessOpenPgpProviderTest.encryptDecryptTest(PainlessOpenPgpProviderTest.java:155)

because EncryptedOpenPgpContentElement rpad field was sometimes
'null' in case the random function returned '0' as length.
2019-03-25 18:58:58 +01:00
Florian Schmaus 14f288a763 Introduce RandomUtil
and use it in EncryptedOpenPgpContentElement
2019-03-25 18:58:58 +01:00
Florian Schmaus e98d42790a SmackReactor/NIO, Java8/Android19, Pretty print XML, FSM connections
This commit adds
- SmackReactor / NIO
- a framework for finite state machine connections
- support for Java 8
- pretty printed XML debug output

It also
- reworks the integration test framework
- raises the minimum Android API level to 19
- introduces XmppNioTcpConnection

Furthermore fixes SMACK-801 (at least partly). Java 8 language
features are available, but not all runtime library methods. For that
we would need to raise the Android API level to 24 or higher.
2019-02-05 13:18:03 +01:00
Paul Schaub 74bebc13e6
requireNotNullOrEmpty -> requireNotNullNorEmpty 2018-07-17 15:10:39 +02:00
Florian Schmaus c792be9267 Add StringUtils.requireNullOrNotEmpty() 2018-06-07 17:55:00 +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 a9ca1a0989 Enable ModifierOrder checkstyle check
Fixes SMACK-812
2018-03-29 12:35:11 +02:00
Florian Schmaus 431e5b3c67 Merge branch '4.2' into master-paul-merged 2017-12-17 11:16:02 +01:00
Paul Schaub cb18056613 Fix minor codestyle issues 2017-12-17 11:03:46 +01:00
Florian Schmaus 81002c4fbd Merge branch '4.2' 2017-11-22 08:37:47 +01:00
Florian Schmaus 2341bb4e23 Remove duplicate code in StringUtils 2017-11-16 18:02:02 +01:00
Florian Schmaus 73dd46af21 Remove duplicate numbers from StringUtils.numbersAndLetters
Fixes SMACK-784.
2017-11-16 17:48:29 +01:00
Florian Schmaus 2a97d7c5ea Don't reinvent methods in HashManager
use the existing API from StringUtils instead.

Also rename StringUtils.toBytes() to 'toUtf8Bytes()'.
2017-08-16 14:55:25 +02:00
Florian Schmaus ba323b51f9 Remove API parts scheduled to be removed in Smack 4.3 2017-08-16 14:31:46 +02:00
Florian Schmaus ce1cddc722 More checkstyle whitespace related checks 2017-05-24 14:42:38 +02:00
Florian Schmaus 45edc969c9 Fix NoWhitespaceAfter checkstyle violation
in StringUtils.
2017-05-16 15:52:24 +02:00
Florian Schmaus 1cc9cec677 Use thread local variables for (Secure)Randoms 2017-03-10 17:55:07 +01:00
Florian Schmaus b558a128c3 Merge remote-tracking branch 'my/master' 2016-12-07 21:20:02 +01:00
Florian Schmaus 274e5630c4 Add support for XEP-0133: Service Administration
also extend Smack's integration test framework to use XEP-0133 as a
means for of throw away account creation.

Fixes SMACK-742
2016-12-04 21:42:50 +01:00
Florian Schmaus 9165e818d9 Add ParenPad and NoWhitespaceAfter checkstyle rules 2016-11-29 12:01:41 +01:00
Florian Schmaus 6cf3ad32f9 Remove unnecessary semicolon in StringUtils 2016-11-06 11:14:19 +01:00
Florian Schmaus e6a9027cc6 Improve StringUtils.escapeForXml() 2016-01-18 22:04:20 +01:00
Florian Schmaus ac0c05be04 StringUtils: Make randGen and numbersAndLetters final 2016-01-10 18:34:54 +01:00
Florian Schmaus 658a671cbe Make StringUtils.randomString(int) use SecureRandom 2016-01-10 18:21:46 +01:00
Florian Schmaus e0e4fd9b12 Add checkstyle rule for StringBuilder.append(char)
And replace all instances where String.Builder.append() is called with a
String of length one with append(char).

Also adds StringUtils.toStringBuilder(Collection, String).
2015-07-27 19:02:11 +02:00
Florian Schmaus 46f9b9ab39 Improve StringUtils.escapeForXML()
use CharSequence as input.
2015-07-15 19:56:46 +02:00
Florian Schmaus 734695c80e Improve StringUtils.collectionToString()
Use generics, and iterator and append(char) instead of append(String).
2015-07-14 13:40:23 +02:00
Florian Schmaus 64d134052d Enable javadoc checkstyle
and fix violations.
2015-03-29 12:29:32 +02:00
Florian Schmaus 0fde39fa45 's;^\s+$;;' on all source files
And add checkstyle test for lines containing only whitespace characters.
2015-03-17 11:33:02 +01:00
Florian Schmaus 37081b2810 Send more information with the stream open tag 2015-01-28 09:31:28 +01:00
Florian Schmaus 86ea027301 Add StringUtils.requireNotNullOrEmpty and Objects.requireNonNull
and use this in a few places.
2015-01-26 20:47:09 +01:00
Florian Schmaus 403ecff2b2 Add SCRAM-SHA1 support
Thanks to Stefan Karlsson for helping with the implementation.

Also add SASLMechanism.checkIfSuccessfulOrThrow(), to increase the
security by verifying the mechanisms state at the end of SASL
authentication.

SASLMechanism now has a SASLPrep StringTransformer.

Refactor SHA1 functions out of StringUtils into SHA1 utility class.

Add MAC utility class.

Make DummyConnection getSentpacket() methods use generics to make unit
testing SCRAM-SHA1 easier.

Fixes SMACK-398
2014-10-21 15:03:48 +02:00
Florian Schmaus 34bc13bec7 Merge branch '4.0'
Conflicts:
	build.gradle
	smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
	smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
	smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
	smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java
2014-09-05 22:11:35 +02:00
Florian Schmaus 5d4aa76d19 Create smack.util.stringencoder for Base64, Base32,…
Use Android's Base64 implementation when on Android, otherwise, when on
Java7, use the existing one.
2014-09-04 11:07:55 +02:00
Florian Schmaus 5342aaf137 Make XMPPError.Condition.equals null-safe
also make Condition implement CharSequence.

SMACK-603
2014-09-01 10:13:23 +02:00
Florian Schmaus 92a6d01507 Merge branch '4.0'
Also slightly improve OfflineMessageManager.getMessages()

Conflicts:
	build.gradle
	smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java
2014-08-07 16:51:03 +02:00
Florian Schmaus a574e1d56d Verify ConnectionConfiguration parameters
also fix javadoc error for StringUtils.isNullOrEmpty()

Fixes SMACK-539
2014-08-01 23:23:11 +02:00
Florian Schmaus 89dc3a0e85 Add smack-android and redesign SASL authentication
This commit marks an important milestone with the addition of the
smack-android subproject. Smack is now able to run native on Android
without requiring any modifications, which makes the aSmack build
environment obsolete.

It was necessary to redesign the code for SASL authentication to achieve
this. Smack now comes with smack-sasl-provided for SASL implementations
that do not rely on additional APIs like javax for platforms where those
APIs are not available like Android.
2014-08-01 10:34:47 +02:00
Florian Schmaus ed7dc1800d Throw IllegalStateException in StringUtils.hash()
instead of Log.

Also create UTF8 and SHA1 constant.
2014-07-07 00:11:00 +02:00
Florian Schmaus e469601468 Do not hardcode the char[] length in StringUtils 2014-07-07 00:03:11 +02:00
Florian Schmaus f67d655fe7 Use jxmpp-core (0.1.0-alpha1-SNAPSHOT)
fixes also SMACK-570, since jxmpp-core's XmppStringUtil contains the fix
for SMACK-570.
2014-06-01 12:24:30 +02:00
Florian Schmaus 8977f5b3f0 Improve TLS/SSL support
Add TLSUtils. Make it possible to set the enabled SSL/TLS protocols and
ciphers and provide sane error reporting.
2014-05-30 12:28:19 +02:00
Florian Schmaus 91fd15ad86 Prefix subprojects with 'smack-'
instead of using the old baseName=smack appendix=project.name approach,
we are now going convention over configuration and renaming the
subprojects directories to the proper name.

Having a prefix is actually very helpful, because the resulting
libraries will be named like the subproject. And a core-4.0.0-rc1.jar is
not as explicit about what it actually *is* as a
smack-core-4.0.0-rc1.jar.

SMACK-265
2014-04-28 19:44:14 +02:00
Renamed from core/src/main/java/org/jivesoftware/smack/util/StringUtils.java (Browse further)