1 package net
.client
.by
.lock
.a
;
3 import android
.annotation
.TargetApi
;
4 import android
.os
.AsyncTask
;
5 import android
.os
.Build
;
6 import java
.io
.IOException
;
7 import java
.io
.StreamCorruptedException
;
8 import java
.net
.DatagramPacket
;
9 import java
.net
.DatagramSocket
;
10 import java
.net
.SocketException
;
11 import java
.security
.InvalidAlgorithmParameterException
;
12 import java
.security
.InvalidKeyException
;
13 import java
.security
.MessageDigest
;
14 import java
.security
.NoSuchAlgorithmException
;
15 import javax
.crypto
.BadPaddingException
;
16 import javax
.crypto
.Cipher
;
17 import javax
.crypto
.IllegalBlockSizeException
;
18 import javax
.crypto
.NoSuchPaddingException
;
19 import javax
.crypto
.spec
.IvParameterSpec
;
20 import javax
.crypto
.spec
.SecretKeySpec
;
21 import net
.client
.by
.lock
.b
;
22 import net
.client
.by
.lock
.codec
.Speex
;
23 import net
.client
.by
.lock
.f
.j
;
25 /* compiled from: MyApp */
26 public class k
extends AsyncTask
{
39 MessageDigest m
= null;
42 public k(DatagramSocket datagramSocket
, s sVar
, SecretKeySpec secretKeySpec
, IvParameterSpec ivParameterSpec
, byte[] bArr
) {
43 this.a
= datagramSocket
;
45 this.c
= secretKeySpec
;
46 this.d
= ivParameterSpec
;
54 this.m
= MessageDigest
.getInstance("MD5");
55 this.n
= Cipher
.getInstance("AES/CBC/PKCS5Padding");
56 this.n
.init(2, secretKeySpec
, ivParameterSpec
);
57 } catch (NoSuchAlgorithmException e2
) {
58 j
.a("Error in reciever of sender thread.", e2
);
59 } catch (NoSuchPaddingException e3
) {
60 j
.a("Error in reciever of sender thread.", e3
);
61 } catch (InvalidKeyException e4
) {
62 j
.a("Error in reciever of sender thread.", e4
);
63 } catch (InvalidAlgorithmParameterException e5
) {
64 j
.a("Error in reciever of sender thread.", e5
);
70 b
.e("RecieverThread", "start");
71 if (Build
.VERSION
.SDK_INT
>= 11) {
79 super.execute(new Void
[0]);
84 executeOnExecutor(AsyncTask
.THREAD_POOL_EXECUTOR
, new Void
[0]);
87 /* access modifiers changed from: protected */
89 public Void
doInBackground(Void
... voidArr
) {
90 this.k
= System
.currentTimeMillis();
91 while (!net
.client
.by
.lock
.c
.b
.a
.get()) {
92 DatagramPacket datagramPacket
= new DatagramPacket(new byte[this.h
], this.h
);
94 this.a
.receive(datagramPacket
);
96 this.m
.update(this.e
);
97 this.m
.update(datagramPacket
.getData(), datagramPacket
.getOffset(), 8);
98 if (j
.a(this.m
.digest(), 0, datagramPacket
.getData(), (datagramPacket
.getOffset() + datagramPacket
.getLength()) - 8, 8)) {
100 this.j
+= datagramPacket
.getLength();
102 byte[] doFinal
= this.n
.doFinal(datagramPacket
.getData(), datagramPacket
.getOffset(), datagramPacket
.getLength() - 8);
103 short[] sArr
= new short[1600];
104 this.l
.a(new a(sArr
, this.g
.decode(doFinal
, 0, doFinal
.length
, sArr
, 0)));
105 } catch (IllegalBlockSizeException e2
) {
106 b
.e("ReceiverThread", "IllegalBlockSizeException");
107 j
.a("ReceiverThread Error in decrypting audio.", e2
);
108 } catch (BadPaddingException e3
) {
109 b
.e("ReceiverThread", "BadPaddingException");
110 j
.a("ReceiverThread Error in decrypting audio.", e3
);
113 j
.a("Possibly spoofed packet.", new StreamCorruptedException());
115 } catch (IOException e4
) {
116 b
.e("ReceiverThread", "Possible isPaused: " + net
.client
.by
.lock
.c
.b
.a
.get());
117 if (net
.client
.by
.lock
.c
.b
.a
.get()) {
120 j
.a("ReceiverThread", e4
);
121 if (e4
instanceof SocketException
) {
126 double currentTimeMillis
= ((double) (System
.currentTimeMillis() - this.k
)) / 1000.0d
;
127 System
.out
.println("RAverage packet size: " + (((double) this.j
) / ((double) this.i
)));
128 System
.out
.println("RAverage bwd: " + (((double) this.j
) / currentTimeMillis
));
129 System
.out
.println("RAverage packet count: " + (((double) this.i
) / currentTimeMillis
));
134 } catch (InterruptedException e5
) {
135 e5
.printStackTrace();