aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-08-31 16:28:21 +0200
committeriNPUTmice <daniel@gultsch.de>2014-08-31 16:28:21 +0200
commit1ac5be485502e7d6d4c117335e083c684739e6af (patch)
tree279c22e269158dde838f31ebcf3daf4272573583 /src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
parent8d456085e57334dc34707a49666006619e2c77c6 (diff)
some code cleanup
Diffstat (limited to 'src/eu/siacs/conversations/xmpp/jingle/JingleFile.java')
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleFile.java35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java b/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
index 3672351b..9253814b 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
@@ -5,60 +5,63 @@ import java.security.Key;
import javax.crypto.spec.SecretKeySpec;
+import eu.siacs.conversations.Config;
import eu.siacs.conversations.utils.CryptoHelper;
import android.util.Log;
public class JingleFile extends File {
-
+
private static final long serialVersionUID = 2247012619505115863L;
-
+
private long expectedSize = 0;
private String sha1sum;
private Key aeskey;
-
+
public JingleFile(String path) {
super(path);
}
-
+
public long getSize() {
return super.length();
}
-
+
public long getExpectedSize() {
- if (this.aeskey!=null) {
- return (this.expectedSize/16 + 1) * 16;
+ if (this.aeskey != null) {
+ return (this.expectedSize / 16 + 1) * 16;
} else {
return this.expectedSize;
}
}
-
+
public void setExpectedSize(long size) {
this.expectedSize = size;
}
-
+
public String getSha1Sum() {
return this.sha1sum;
}
-
+
public void setSha1Sum(String sum) {
this.sha1sum = sum;
}
-
+
public void setKey(byte[] key) {
- if (key.length>=32) {
+ if (key.length >= 32) {
byte[] secretKey = new byte[32];
System.arraycopy(key, 0, secretKey, 0, 32);
this.aeskey = new SecretKeySpec(secretKey, "AES");
- } else if (key.length>=16) {
+ } else if (key.length >= 16) {
byte[] secretKey = new byte[16];
System.arraycopy(key, 0, secretKey, 0, 16);
this.aeskey = new SecretKeySpec(secretKey, "AES");
} else {
- Log.d("xmppService","weird key");
+ Log.d(Config.LOGTAG, "weird key");
}
- Log.d("xmppService","using aes key "+CryptoHelper.bytesToHex(this.aeskey.getEncoded()));
+ Log.d(Config.LOGTAG,
+ "using aes key "
+ + CryptoHelper.bytesToHex(this.aeskey.getEncoded()));
}
-
+
public Key getKey() {
return this.aeskey;
}