summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2015-07-16 21:51:13 (GMT)
committerNick Hudson <nick.hudson@isode.com>2015-07-28 10:41:23 (GMT)
commit6f84f6a65b8b80e2f599dff76da0cd13fbead611 (patch)
tree9a4b503a82d58cfc4884817945fcd26a0c0f9ba4 /src/com/isode/stroke/sasl
parent9a419f5fff0701e672e241a515ce3e91438b3e1b (diff)
downloadstroke-6f84f6a65b8b80e2f599dff76da0cd13fbead611.zip
stroke-6f84f6a65b8b80e2f599dff76da0cd13fbead611.tar.bz2
Update Serializers and Parsers.
Updates Serializers and Parsers along with one minor change in XMPPlayer. Update Non Payload Serializers to return SafeByteArray. Updates SafeByteArray to return SafeByteArray on append and plus method. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: None. Change-Id: I6fe665a26b10cac37b3e3acd9ec15c211ac9b8ab
Diffstat (limited to 'src/com/isode/stroke/sasl')
-rw-r--r--src/com/isode/stroke/sasl/ClientAuthenticator.java3
-rw-r--r--src/com/isode/stroke/sasl/PLAINClientAuthenticator.java5
-rw-r--r--src/com/isode/stroke/sasl/SCRAMSHA1ClientAuthenticator.java7
3 files changed, 9 insertions, 6 deletions
diff --git a/src/com/isode/stroke/sasl/ClientAuthenticator.java b/src/com/isode/stroke/sasl/ClientAuthenticator.java
index c55bf74..2dc3756 100644
--- a/src/com/isode/stroke/sasl/ClientAuthenticator.java
+++ b/src/com/isode/stroke/sasl/ClientAuthenticator.java
@@ -9,6 +9,7 @@
package com.isode.stroke.sasl;
import com.isode.stroke.base.ByteArray;
+import com.isode.stroke.base.SafeByteArray;
public abstract class ClientAuthenticator {
@@ -30,7 +31,7 @@ public abstract class ClientAuthenticator {
this.authzid = authzid;
}
- public abstract ByteArray getResponse();
+ public abstract SafeByteArray getResponse();
public abstract boolean setChallenge(ByteArray challenge);
diff --git a/src/com/isode/stroke/sasl/PLAINClientAuthenticator.java b/src/com/isode/stroke/sasl/PLAINClientAuthenticator.java
index 70e6b04..634ce11 100644
--- a/src/com/isode/stroke/sasl/PLAINClientAuthenticator.java
+++ b/src/com/isode/stroke/sasl/PLAINClientAuthenticator.java
@@ -9,14 +9,15 @@
package com.isode.stroke.sasl;
import com.isode.stroke.base.ByteArray;
+import com.isode.stroke.base.SafeByteArray;
public class PLAINClientAuthenticator extends ClientAuthenticator {
public PLAINClientAuthenticator() {
super("PLAIN");
}
- public ByteArray getResponse() {
- return new ByteArray().append(getAuthorizationID()).append((byte)0).append(getAuthenticationID()).append((byte)0).append(getPassword());
+ public SafeByteArray getResponse() {
+ return new SafeByteArray().append(getAuthorizationID()).append((byte)0).append(getAuthenticationID()).append((byte)0).append(getPassword());
}
public boolean setChallenge(ByteArray challenge) {
diff --git a/src/com/isode/stroke/sasl/SCRAMSHA1ClientAuthenticator.java b/src/com/isode/stroke/sasl/SCRAMSHA1ClientAuthenticator.java
index ba60fca..29a37aa 100644
--- a/src/com/isode/stroke/sasl/SCRAMSHA1ClientAuthenticator.java
+++ b/src/com/isode/stroke/sasl/SCRAMSHA1ClientAuthenticator.java
@@ -9,6 +9,7 @@
package com.isode.stroke.sasl;
import com.isode.stroke.base.ByteArray;
+import com.isode.stroke.base.SafeByteArray;
import com.isode.stroke.stringcodecs.Base64;
import com.isode.stroke.stringcodecs.HMACSHA1;
import com.isode.stroke.stringcodecs.PBKDF2;
@@ -48,9 +49,9 @@ public class SCRAMSHA1ClientAuthenticator extends ClientAuthenticator {
tlsChannelBindingData = channelBindingData;
}
- public ByteArray getResponse() {
+ public SafeByteArray getResponse() {
if (step.equals(Step.Initial)) {
- return ByteArray.plus(getGS2Header(), getInitialBareClientMessage());
+ return new SafeByteArray(getGS2Header().append(getInitialBareClientMessage()));
} else if (step.equals(Step.Proof)) {
ByteArray clientKey = HMACSHA1.getResult(saltedPassword, new ByteArray("Client Key"));
ByteArray storedKey = SHA1.getHash(clientKey);
@@ -62,7 +63,7 @@ public class SCRAMSHA1ClientAuthenticator extends ClientAuthenticator {
}
clientProof = new ByteArray(clientProofData);
ByteArray result = getFinalMessageWithoutProof().append(",p=").append(Base64.encode(clientProof));
- return result;
+ return new SafeByteArray(result);
} else {
return null;
}