74 lines
3.1 KiB
Java
74 lines
3.1 KiB
Java
|
package org.bouncycastle.crypto.params;
|
||
|
|
||
|
import com.google.common.base.Ascii;
|
||
|
import net.sf.scuba.smartcards.ISO7816;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class DESParameters extends KeyParameter {
|
||
|
public static final int DES_KEY_LENGTH = 8;
|
||
|
private static byte[] DES_weak_keys = {1, 1, 1, 1, 1, 1, 1, 1, Ascii.US, Ascii.US, Ascii.US, Ascii.US, 14, 14, 14, 14, ISO7816.INS_CREATE_FILE, ISO7816.INS_CREATE_FILE, ISO7816.INS_CREATE_FILE, ISO7816.INS_CREATE_FILE, -15, -15, -15, -15, -2, -2, -2, -2, -2, -2, -2, -2, 1, -2, 1, -2, 1, -2, 1, -2, Ascii.US, ISO7816.INS_CREATE_FILE, Ascii.US, ISO7816.INS_CREATE_FILE, 14, -15, 14, -15, 1, ISO7816.INS_CREATE_FILE, 1, ISO7816.INS_CREATE_FILE, 1, -15, 1, -15, Ascii.US, -2, Ascii.US, -2, 14, -2, 14, -2, 1, Ascii.US, 1, Ascii.US, 1, 14, 1, 14, ISO7816.INS_CREATE_FILE, -2, ISO7816.INS_CREATE_FILE, -2, -15, -2, -15, -2, -2, 1, -2, 1, -2, 1, -2, 1, ISO7816.INS_CREATE_FILE, Ascii.US, ISO7816.INS_CREATE_FILE, Ascii.US, -15, 14, -15, 14, ISO7816.INS_CREATE_FILE, 1, ISO7816.INS_CREATE_FILE, 1, -15, 1, -15, 1, -2, Ascii.US, -2, Ascii.US, -2, 14, -2, 14, Ascii.US, 1, Ascii.US, 1, 14, 1, 14, 1, -2, ISO7816.INS_CREATE_FILE, -2, ISO7816.INS_CREATE_FILE, -2, -15, -2, -15};
|
||
|
private static final int N_DES_WEAK_KEYS = 16;
|
||
|
|
||
|
public static void setOddParity(byte[] bArr) {
|
||
|
for (int i = 0; i < bArr.length; i++) {
|
||
|
byte b = bArr[i];
|
||
|
bArr[i] = (byte) ((b & 254) | ((((b >> 7) ^ ((((((b >> 1) ^ (b >> 2)) ^ (b >> 3)) ^ (b >> 4)) ^ (b >> 5)) ^ (b >> 6))) ^ 1) & 1));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:12:0x001c, code lost:
|
||
|
|
||
|
r2 = r2 + 1;
|
||
|
*/
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public static boolean isWeakKey(byte[] r7, int r8) {
|
||
|
/*
|
||
|
int r0 = r7.length
|
||
|
int r0 = r0 - r8
|
||
|
r1 = 8
|
||
|
if (r0 < r1) goto L25
|
||
|
r0 = 0
|
||
|
r2 = r0
|
||
|
L8:
|
||
|
r3 = 16
|
||
|
if (r2 >= r3) goto L24
|
||
|
r3 = r0
|
||
|
Ld:
|
||
|
if (r3 >= r1) goto L22
|
||
|
int r4 = r3 + r8
|
||
|
r4 = r7[r4]
|
||
|
byte[] r5 = org.bouncycastle.crypto.params.DESParameters.DES_weak_keys
|
||
|
int r6 = r2 << 3
|
||
|
int r6 = r6 + r3
|
||
|
r5 = r5[r6]
|
||
|
if (r4 == r5) goto L1f
|
||
|
int r2 = r2 + 1
|
||
|
goto L8
|
||
|
L1f:
|
||
|
int r3 = r3 + 1
|
||
|
goto Ld
|
||
|
L22:
|
||
|
r7 = 1
|
||
|
return r7
|
||
|
L24:
|
||
|
return r0
|
||
|
L25:
|
||
|
java.lang.IllegalArgumentException r7 = new java.lang.IllegalArgumentException
|
||
|
java.lang.String r8 = "key material too short."
|
||
|
r7.<init>(r8)
|
||
|
throw r7
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: org.bouncycastle.crypto.params.DESParameters.isWeakKey(byte[], int):boolean");
|
||
|
}
|
||
|
|
||
|
public DESParameters(byte[] bArr) {
|
||
|
super(bArr);
|
||
|
if (isWeakKey(bArr, 0)) {
|
||
|
throw new IllegalArgumentException("attempt to create weak DES key");
|
||
|
}
|
||
|
}
|
||
|
}
|