diff options
author | Andreas Straub <andy@strb.org> | 2015-07-31 18:05:32 +0200 |
---|---|---|
committer | Andreas Straub <andy@strb.org> | 2015-07-31 21:31:45 +0200 |
commit | 50b14434eeda183d1d197a378239654a8db8b3a8 (patch) | |
tree | 1ee67695af76f45cbc544a8a9fe13e394b9c3a0a /src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java | |
parent | 5c421da1e1bd4c6008c36b17569c3dbc5d5e918b (diff) |
Reformat code
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java index 4725ce8aa..4e954a72f 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java @@ -56,11 +56,11 @@ public class XmppAxolotlMessage { } public XmppAxolotlKeyElement(Element keyElement) { - if(TAGNAME.equals(keyElement.getName())) { + if (TAGNAME.equals(keyElement.getName())) { this.recipientDeviceId = Integer.parseInt(keyElement.getAttribute(REMOTEID)); - this.content = Base64.decode(keyElement.getContent(),Base64.DEFAULT); + this.content = Base64.decode(keyElement.getContent(), Base64.DEFAULT); } else { - throw new IllegalArgumentException("Argument not a <"+TAGNAME+"> Element!"); + throw new IllegalArgumentException("Argument not a <" + TAGNAME + "> Element!"); } } @@ -109,24 +109,24 @@ public class XmppAxolotlMessage { Element header = axolotlMessage.findChild(HEADER); this.sourceDeviceId = Integer.parseInt(header.getAttribute(SOURCEID)); this.keyElements = new HashSet<>(); - for(Element keyElement:header.getChildren()) { - switch(keyElement.getName()) { + for (Element keyElement : header.getChildren()) { + switch (keyElement.getName()) { case XmppAxolotlKeyElement.TAGNAME: keyElements.add(new XmppAxolotlKeyElement(keyElement)); break; case IVTAG: - if ( this.iv != null) { + if (this.iv != null) { throw new IllegalArgumentException("Duplicate iv entry"); } - iv = Base64.decode(keyElement.getContent(),Base64.DEFAULT); + iv = Base64.decode(keyElement.getContent(), Base64.DEFAULT); break; default: - Log.w(Config.LOGTAG, "Unexpected element in header: "+ keyElement.toString()); + Log.w(Config.LOGTAG, "Unexpected element in header: " + keyElement.toString()); break; } } Element payloadElement = axolotlMessage.findChild(PAYLOAD); - if ( payloadElement != null ) { + if (payloadElement != null) { ciphertext = Base64.decode(payloadElement.getContent(), Base64.DEFAULT); } } @@ -139,7 +139,7 @@ public class XmppAxolotlMessage { this.innerKey = generateKey(); } - public XmppAxolotlMessage(Jid from, int sourceDeviceId, String plaintext) throws CryptoFailedException{ + public XmppAxolotlMessage(Jid from, int sourceDeviceId, String plaintext) throws CryptoFailedException { this(from, sourceDeviceId); this.encrypt(plaintext); } @@ -199,7 +199,7 @@ public class XmppAxolotlMessage { } } - public byte[] getInnerKey(){ + public byte[] getInnerKey() { return innerKey; } @@ -208,14 +208,14 @@ public class XmppAxolotlMessage { } public Element toXml() { - Element encryptionElement= new Element(TAGNAME, AxolotlService.PEP_PREFIX); + Element encryptionElement = new Element(TAGNAME, AxolotlService.PEP_PREFIX); Element headerElement = encryptionElement.addChild(HEADER); headerElement.setAttribute(SOURCEID, sourceDeviceId); - for(XmppAxolotlKeyElement header: keyElements) { + for (XmppAxolotlKeyElement header : keyElements) { headerElement.addChild(header.toXml()); } headerElement.addChild(IVTAG).setContent(Base64.encodeToString(iv, Base64.DEFAULT)); - if ( ciphertext != null ) { + if (ciphertext != null) { Element payload = encryptionElement.addChild(PAYLOAD); payload.setContent(Base64.encodeToString(ciphertext, Base64.DEFAULT)); } |