931 lines
38 KiB
Java
931 lines
38 KiB
Java
package org.bouncycastle.jcajce.provider.asymmetric.rsa;
|
|
|
|
import android.graphics.Color;
|
|
import android.media.AudioTrack;
|
|
import android.os.Process;
|
|
import android.os.SystemClock;
|
|
import android.text.TextUtils;
|
|
import android.util.TypedValue;
|
|
import android.view.KeyEvent;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewConfiguration;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.lang.reflect.Method;
|
|
import java.math.BigInteger;
|
|
import java.security.AlgorithmParameters;
|
|
import java.security.InvalidAlgorithmParameterException;
|
|
import java.security.InvalidKeyException;
|
|
import java.security.InvalidParameterException;
|
|
import java.security.Key;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.security.SecureRandom;
|
|
import java.security.interfaces.RSAPrivateKey;
|
|
import java.security.interfaces.RSAPublicKey;
|
|
import java.security.spec.AlgorithmParameterSpec;
|
|
import java.security.spec.InvalidParameterSpecException;
|
|
import java.security.spec.MGF1ParameterSpec;
|
|
import javax.crypto.BadPaddingException;
|
|
import javax.crypto.IllegalBlockSizeException;
|
|
import javax.crypto.NoSuchPaddingException;
|
|
import javax.crypto.spec.OAEPParameterSpec;
|
|
import javax.crypto.spec.PSource;
|
|
import net.sf.scuba.smartcards.ISOFileInfo;
|
|
import o.C3614bBe;
|
|
import o.xzZ;
|
|
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
|
|
import org.bouncycastle.crypto.AsymmetricBlockCipher;
|
|
import org.bouncycastle.crypto.CipherParameters;
|
|
import org.bouncycastle.crypto.Digest;
|
|
import org.bouncycastle.crypto.InvalidCipherTextException;
|
|
import org.bouncycastle.crypto.encodings.ISO9796d1Encoding;
|
|
import org.bouncycastle.crypto.encodings.OAEPEncoding;
|
|
import org.bouncycastle.crypto.encodings.PKCS1Encoding;
|
|
import org.bouncycastle.crypto.engines.RSABlindedEngine;
|
|
import org.bouncycastle.crypto.params.ParametersWithRandom;
|
|
import org.bouncycastle.jcajce.provider.asymmetric.util.BaseCipherSpi;
|
|
import org.bouncycastle.jcajce.provider.util.DigestFactory;
|
|
import org.bouncycastle.jcajce.util.BCJcaJceHelper;
|
|
import org.bouncycastle.jcajce.util.JcaJceHelper;
|
|
import org.bouncycastle.util.Strings;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class CipherSpi extends BaseCipherSpi {
|
|
private ByteArrayOutputStream bOut;
|
|
private AsymmetricBlockCipher cipher;
|
|
private AlgorithmParameters engineParams;
|
|
private final JcaJceHelper helper;
|
|
private AlgorithmParameterSpec paramSpec;
|
|
private boolean privateKeyOnly;
|
|
private boolean publicKeyOnly;
|
|
private static final byte[] $$a = {74, -120, -98, -119};
|
|
private static final int $$b = 58;
|
|
private static int $10 = 0;
|
|
private static int $11 = 1;
|
|
private static int b = 0;
|
|
private static int g = 1;
|
|
private static char[] e = {16258, 16259};
|
|
private static int a = 1934311025;
|
|
private static boolean c = true;
|
|
private static boolean d = true;
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:10:0x0028 */
|
|
/* JADX WARN: Removed duplicated region for block: B:7:0x0020 */
|
|
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0028 -> B:4:0x002d). Please report as a decompilation issue!!! */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static void h(byte r6, byte r7, byte r8, java.lang.Object[] r9) {
|
|
/*
|
|
byte[] r0 = org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.$$a
|
|
int r7 = r7 * 57
|
|
int r7 = 122 - r7
|
|
int r8 = r8 * 3
|
|
int r8 = 4 - r8
|
|
int r6 = r6 * 3
|
|
int r1 = 1 - r6
|
|
byte[] r1 = new byte[r1]
|
|
r2 = 0
|
|
int r6 = 0 - r6
|
|
if (r0 != 0) goto L18
|
|
r3 = r8
|
|
r4 = r2
|
|
goto L2d
|
|
L18:
|
|
r3 = r2
|
|
L19:
|
|
byte r4 = (byte) r7
|
|
r1[r3] = r4
|
|
int r4 = r3 + 1
|
|
if (r3 != r6) goto L28
|
|
java.lang.String r6 = new java.lang.String
|
|
r6.<init>(r1, r2)
|
|
r9[r2] = r6
|
|
return
|
|
L28:
|
|
r3 = r0[r8]
|
|
r5 = r3
|
|
r3 = r8
|
|
r8 = r5
|
|
L2d:
|
|
int r8 = -r8
|
|
int r7 = r7 + r8
|
|
int r8 = r3 + 1
|
|
r3 = r4
|
|
goto L19
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.h(byte, byte, byte, java.lang.Object[]):void");
|
|
}
|
|
|
|
private static void f(char[] cArr, byte[] bArr, int[] iArr, int i, Object[] objArr) {
|
|
int i2 = 2 % 2;
|
|
C3614bBe c3614bBe = new C3614bBe();
|
|
char[] cArr2 = e;
|
|
int i3 = 0;
|
|
if (cArr2 != null) {
|
|
int length = cArr2.length;
|
|
char[] cArr3 = new char[length];
|
|
int i4 = 0;
|
|
while (i4 < length) {
|
|
try {
|
|
Object[] objArr2 = new Object[1];
|
|
objArr2[i3] = Integer.valueOf(cArr2[i4]);
|
|
Object obj = xzZ.y.get(-950481649);
|
|
if (obj == null) {
|
|
Class cls = (Class) xzZ.c(TextUtils.getOffsetAfter("", i3) + 337, 4 - Process.getGidForName(""), (char) TextUtils.getOffsetAfter("", i3));
|
|
byte b2 = (byte) i3;
|
|
byte b3 = (byte) (b2 + 1);
|
|
Object[] objArr3 = new Object[1];
|
|
h(b2, b3, (byte) (b3 - 1), objArr3);
|
|
obj = cls.getMethod((String) objArr3[0], Integer.TYPE);
|
|
xzZ.y.put(-950481649, obj);
|
|
}
|
|
cArr3[i4] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue();
|
|
i4++;
|
|
i3 = 0;
|
|
} catch (Throwable th) {
|
|
Throwable cause = th.getCause();
|
|
if (cause == null) {
|
|
throw th;
|
|
}
|
|
throw cause;
|
|
}
|
|
}
|
|
cArr2 = cArr3;
|
|
}
|
|
Object[] objArr4 = {Integer.valueOf(a)};
|
|
Object obj2 = xzZ.y.get(-1521625011);
|
|
if (obj2 == null) {
|
|
Class cls2 = (Class) xzZ.c(Color.alpha(0) + 283, (SystemClock.currentThreadTimeMillis() > (-1L) ? 1 : (SystemClock.currentThreadTimeMillis() == (-1L) ? 0 : -1)) + 4, (char) (KeyEvent.getDeadChar(0, 0) + 39813));
|
|
byte b4 = (byte) 0;
|
|
byte b5 = b4;
|
|
Object[] objArr5 = new Object[1];
|
|
h(b4, b5, b5, objArr5);
|
|
obj2 = cls2.getMethod((String) objArr5[0], Integer.TYPE);
|
|
xzZ.y.put(-1521625011, obj2);
|
|
}
|
|
int intValue = ((Integer) ((Method) obj2).invoke(null, objArr4)).intValue();
|
|
if (d) {
|
|
c3614bBe.c = bArr.length;
|
|
char[] cArr4 = new char[c3614bBe.c];
|
|
c3614bBe.a = 0;
|
|
int i5 = $11 + 97;
|
|
$10 = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
while (c3614bBe.a < c3614bBe.c) {
|
|
int i7 = $10 + 81;
|
|
$11 = i7 % 128;
|
|
int i8 = i7 % 2;
|
|
cArr4[c3614bBe.a] = (char) (cArr2[bArr[(c3614bBe.c - 1) - c3614bBe.a] + i] - intValue);
|
|
Object[] objArr6 = {c3614bBe, c3614bBe};
|
|
Object obj3 = xzZ.y.get(1779759091);
|
|
if (obj3 == null) {
|
|
obj3 = ((Class) xzZ.c(Process.getGidForName("") + 41, 5 - (TypedValue.complexToFraction(0, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) > BitmapDescriptorFactory.HUE_RED ? 1 : (TypedValue.complexToFraction(0, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) == BitmapDescriptorFactory.HUE_RED ? 0 : -1)), (char) View.MeasureSpec.getMode(0))).getMethod("D", Object.class, Object.class);
|
|
xzZ.y.put(1779759091, obj3);
|
|
}
|
|
((Method) obj3).invoke(null, objArr6);
|
|
}
|
|
objArr[0] = new String(cArr4);
|
|
return;
|
|
}
|
|
if (c) {
|
|
int i9 = $11 + 105;
|
|
$10 = i9 % 128;
|
|
int i10 = i9 % 2;
|
|
c3614bBe.c = cArr.length;
|
|
char[] cArr5 = new char[c3614bBe.c];
|
|
c3614bBe.a = 0;
|
|
int i11 = $11 + 69;
|
|
$10 = i11 % 128;
|
|
int i12 = 2;
|
|
int i13 = i11 % 2;
|
|
while (c3614bBe.a < c3614bBe.c) {
|
|
int i14 = $10 + 5;
|
|
$11 = i14 % 128;
|
|
int i15 = i14 % i12;
|
|
cArr5[c3614bBe.a] = (char) (cArr2[cArr[(c3614bBe.c - 1) - c3614bBe.a] - i] - intValue);
|
|
Object[] objArr7 = {c3614bBe, c3614bBe};
|
|
Object obj4 = xzZ.y.get(1779759091);
|
|
if (obj4 == null) {
|
|
obj4 = ((Class) xzZ.c(39 - MotionEvent.axisFromString(""), (Process.getElapsedCpuTime() > 0L ? 1 : (Process.getElapsedCpuTime() == 0L ? 0 : -1)) + 4, (char) (ViewConfiguration.getKeyRepeatTimeout() >> 16))).getMethod("D", Object.class, Object.class);
|
|
xzZ.y.put(1779759091, obj4);
|
|
}
|
|
((Method) obj4).invoke(null, objArr7);
|
|
i12 = 2;
|
|
}
|
|
objArr[0] = new String(cArr5);
|
|
return;
|
|
}
|
|
int i16 = 0;
|
|
c3614bBe.c = iArr.length;
|
|
char[] cArr6 = new char[c3614bBe.c];
|
|
while (true) {
|
|
c3614bBe.a = i16;
|
|
if (c3614bBe.a >= c3614bBe.c) {
|
|
objArr[0] = new String(cArr6);
|
|
return;
|
|
}
|
|
int i17 = $10 + 33;
|
|
$11 = i17 % 128;
|
|
int i18 = i17 % 2;
|
|
cArr6[c3614bBe.a] = (char) (cArr2[iArr[(c3614bBe.c - 1) - c3614bBe.a] - i] - intValue);
|
|
i16 = c3614bBe.a + 1;
|
|
}
|
|
}
|
|
|
|
@Override // javax.crypto.CipherSpi
|
|
protected byte[] engineUpdate(byte[] bArr, int i, int i2) {
|
|
int i3 = 2 % 2;
|
|
int i4 = g + 7;
|
|
b = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
this.bOut.write(bArr, i, i2);
|
|
if (this.cipher instanceof RSABlindedEngine) {
|
|
if (this.bOut.size() > this.cipher.getInputBlockSize() + 1) {
|
|
throw new ArrayIndexOutOfBoundsException("too much data for RSA block");
|
|
}
|
|
} else if (this.bOut.size() > this.cipher.getInputBlockSize()) {
|
|
throw new ArrayIndexOutOfBoundsException("too much data for RSA block");
|
|
}
|
|
int i6 = b + 11;
|
|
g = i6 % 128;
|
|
if (i6 % 2 == 0) {
|
|
int i7 = 14 / 0;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // javax.crypto.CipherSpi
|
|
protected int engineUpdate(byte[] bArr, int i, int i2, byte[] bArr2, int i3) {
|
|
int i4 = 2 % 2;
|
|
int i5 = g + 15;
|
|
b = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
this.bOut.write(bArr, i, i2);
|
|
if (!(this.cipher instanceof RSABlindedEngine)) {
|
|
if (this.bOut.size() <= this.cipher.getInputBlockSize()) {
|
|
return 0;
|
|
}
|
|
throw new ArrayIndexOutOfBoundsException("too much data for RSA block");
|
|
}
|
|
int i7 = b + 33;
|
|
g = i7 % 128;
|
|
int i8 = i7 % 2;
|
|
if (this.bOut.size() <= this.cipher.getInputBlockSize() + 1) {
|
|
return 0;
|
|
}
|
|
throw new ArrayIndexOutOfBoundsException("too much data for RSA block");
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:12:0x0048, code lost:
|
|
|
|
if (r1.equals("ISO9796-1PADDING") == false) goto L18;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:13:0x004a, code lost:
|
|
|
|
r6 = new org.bouncycastle.crypto.encodings.ISO9796d1Encoding(new org.bouncycastle.crypto.engines.RSABlindedEngine());
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:15:0x005f, code lost:
|
|
|
|
if (r1.equals("OAEPWITHMD5ANDMGF1PADDING") == false) goto L21;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:16:0x0061, code lost:
|
|
|
|
r6 = new javax.crypto.spec.OAEPParameterSpec("MD5", "MGF1", new java.security.spec.MGF1ParameterSpec("MD5"), javax.crypto.spec.PSource.PSpecified.DEFAULT);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:17:0x019e, code lost:
|
|
|
|
initFromSpec(r6);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:18:0x01a1, code lost:
|
|
|
|
return;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:20:0x0077, code lost:
|
|
|
|
if (r1.equals("OAEPPADDING") == false) goto L24;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:22:0x0081, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA1ANDMGF1PADDING") != false) goto L63;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:24:0x0089, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA-1ANDMGF1PADDING") != false) goto L63;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:26:0x0091, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA224ANDMGF1PADDING") != false) goto L62;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:27:0x0093, code lost:
|
|
|
|
r2 = org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.b + 85;
|
|
org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.g = r2 % 128;
|
|
r2 = r2 % 2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:28:0x00a2, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA-224ANDMGF1PADDING") != false) goto L62;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:30:0x00ac, code lost:
|
|
|
|
if ((!r1.equals("OAEPWITHSHA256ANDMGF1PADDING")) == false) goto L61;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:32:0x00b4, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA-256ANDMGF1PADDING") != false) goto L61;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:34:0x00bc, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA384ANDMGF1PADDING") != false) goto L60;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:36:0x00c4, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA-384ANDMGF1PADDING") != false) goto L60;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:37:0x00c6, code lost:
|
|
|
|
r2 = org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.b + 45;
|
|
org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.g = r2 % 128;
|
|
r2 = r2 % 2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:38:0x00d5, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA512ANDMGF1PADDING") != false) goto L59;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:40:0x00dd, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA-512ANDMGF1PADDING") != false) goto L59;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:41:0x00df, code lost:
|
|
|
|
r2 = org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.g + 79;
|
|
org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.b = r2 % 128;
|
|
r2 = r2 % 2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:42:0x00ee, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA3-224ANDMGF1PADDING") == false) goto L48;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:43:0x00f0, code lost:
|
|
|
|
r6 = new javax.crypto.spec.OAEPParameterSpec("SHA3-224", "MGF1", new java.security.spec.MGF1ParameterSpec("SHA3-224"), javax.crypto.spec.PSource.PSpecified.DEFAULT);
|
|
r1 = org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.b + 15;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:44:0x0102, code lost:
|
|
|
|
org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.g = r1 % 128;
|
|
r1 = r1 % 2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:46:0x010f, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA3-256ANDMGF1PADDING") == false) goto L51;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:47:0x0111, code lost:
|
|
|
|
r6 = new javax.crypto.spec.OAEPParameterSpec(org.bouncycastle.pqc.jcajce.spec.SPHINCS256KeyGenParameterSpec.SHA3_256, "MGF1", new java.security.spec.MGF1ParameterSpec(org.bouncycastle.pqc.jcajce.spec.SPHINCS256KeyGenParameterSpec.SHA3_256), javax.crypto.spec.PSource.PSpecified.DEFAULT);
|
|
r1 = org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.b + 65;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:49:0x012a, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA3-384ANDMGF1PADDING") == false) goto L54;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:4:0x001c, code lost:
|
|
|
|
if (r1.equals("NOPADDING") != false) goto L9;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:50:0x012c, code lost:
|
|
|
|
r6 = new javax.crypto.spec.OAEPParameterSpec("SHA3-384", "MGF1", new java.security.spec.MGF1ParameterSpec("SHA3-384"), javax.crypto.spec.PSource.PSpecified.DEFAULT);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:52:0x0141, code lost:
|
|
|
|
if (r1.equals("OAEPWITHSHA3-512ANDMGF1PADDING") == false) goto L57;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:53:0x0143, code lost:
|
|
|
|
r6 = new javax.crypto.spec.OAEPParameterSpec("SHA3-512", "MGF1", new java.security.spec.MGF1ParameterSpec("SHA3-512"), javax.crypto.spec.PSource.PSpecified.DEFAULT);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:54:0x0152, code lost:
|
|
|
|
r1 = new java.lang.StringBuilder();
|
|
r1.append(r6);
|
|
r1.append(" unavailable with RSA.");
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:55:0x0168, code lost:
|
|
|
|
throw new javax.crypto.NoSuchPaddingException(r1.toString());
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:56:0x0169, code lost:
|
|
|
|
r6 = new javax.crypto.spec.OAEPParameterSpec(org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec.SHA512, "MGF1", java.security.spec.MGF1ParameterSpec.SHA512, javax.crypto.spec.PSource.PSpecified.DEFAULT);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:57:0x0175, code lost:
|
|
|
|
r6 = new javax.crypto.spec.OAEPParameterSpec(org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec.SHA384, "MGF1", java.security.spec.MGF1ParameterSpec.SHA384, javax.crypto.spec.PSource.PSpecified.DEFAULT);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:58:0x0181, code lost:
|
|
|
|
r6 = new javax.crypto.spec.OAEPParameterSpec(org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec.SHA256, "MGF1", java.security.spec.MGF1ParameterSpec.SHA256, javax.crypto.spec.PSource.PSpecified.DEFAULT);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:59:0x018d, code lost:
|
|
|
|
r6 = new javax.crypto.spec.OAEPParameterSpec(org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec.SHA224, "MGF1", new java.security.spec.MGF1ParameterSpec(org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec.SHA224), javax.crypto.spec.PSource.PSpecified.DEFAULT);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:60:0x019c, code lost:
|
|
|
|
r6 = javax.crypto.spec.OAEPParameterSpec.DEFAULT;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:61:0x0029, code lost:
|
|
|
|
r6 = new org.bouncycastle.crypto.engines.RSABlindedEngine();
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:63:0x0027, code lost:
|
|
|
|
if (r1.equals("NOPADDING") != false) goto L9;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:6:0x0035, code lost:
|
|
|
|
if (r1.equals("PKCS1PADDING") == false) goto L13;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:7:0x0037, code lost:
|
|
|
|
r6 = new org.bouncycastle.crypto.encodings.PKCS1Encoding(new org.bouncycastle.crypto.engines.RSABlindedEngine());
|
|
*/
|
|
@Override // org.bouncycastle.jcajce.provider.asymmetric.util.BaseCipherSpi, javax.crypto.CipherSpi
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public void engineSetPadding(java.lang.String r6) throws javax.crypto.NoSuchPaddingException {
|
|
/*
|
|
Method dump skipped, instructions count: 418
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.engineSetPadding(java.lang.String):void");
|
|
}
|
|
|
|
@Override // org.bouncycastle.jcajce.provider.asymmetric.util.BaseCipherSpi, javax.crypto.CipherSpi
|
|
public void engineSetMode(String str) throws NoSuchAlgorithmException {
|
|
int i = 2 % 2;
|
|
int i2 = g + 7;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
String upperCase = Strings.toUpperCase(str);
|
|
if (upperCase.equals("NONE")) {
|
|
return;
|
|
}
|
|
int i4 = g + 87;
|
|
b = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
int i5 = 21 / 0;
|
|
if (upperCase.equals("ECB")) {
|
|
return;
|
|
}
|
|
} else if (upperCase.equals("ECB")) {
|
|
return;
|
|
}
|
|
Object[] objArr = new Object[1];
|
|
f(null, new byte[]{ISOFileInfo.DATA_BYTES2}, null, (AudioTrack.getMinVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMinVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)) + 127, objArr);
|
|
if (upperCase.equals(((String) objArr[0]).intern())) {
|
|
this.privateKeyOnly = true;
|
|
this.publicKeyOnly = false;
|
|
return;
|
|
}
|
|
Object[] objArr2 = new Object[1];
|
|
f(null, new byte[]{-126}, null, (SystemClock.uptimeMillis() > 0L ? 1 : (SystemClock.uptimeMillis() == 0L ? 0 : -1)) + 126, objArr2);
|
|
if (!upperCase.equals(((String) objArr2[0]).intern())) {
|
|
throw new NoSuchAlgorithmException("can't support mode ".concat(String.valueOf(str)));
|
|
}
|
|
int i6 = b + 103;
|
|
g = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
this.privateKeyOnly = false;
|
|
this.publicKeyOnly = true;
|
|
}
|
|
|
|
@Override // javax.crypto.CipherSpi
|
|
protected void engineInit(int i, Key key, AlgorithmParameterSpec algorithmParameterSpec, SecureRandom secureRandom) throws InvalidKeyException, InvalidAlgorithmParameterException {
|
|
CipherParameters generatePrivateKeyParameter;
|
|
int i2 = 2 % 2;
|
|
if (algorithmParameterSpec != null && !(algorithmParameterSpec instanceof OAEPParameterSpec)) {
|
|
StringBuilder sb = new StringBuilder("unknown parameter type: ");
|
|
sb.append(algorithmParameterSpec.getClass().getName());
|
|
throw new InvalidAlgorithmParameterException(sb.toString());
|
|
}
|
|
if (key instanceof RSAPublicKey) {
|
|
if (this.privateKeyOnly) {
|
|
int i3 = g + 9;
|
|
b = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
if (i == 1) {
|
|
throw new InvalidKeyException("mode 1 requires RSAPrivateKey");
|
|
}
|
|
}
|
|
generatePrivateKeyParameter = RSAUtil.generatePublicKeyParameter((RSAPublicKey) key);
|
|
} else {
|
|
if (!(key instanceof RSAPrivateKey)) {
|
|
throw new InvalidKeyException("unknown key type passed to RSA");
|
|
}
|
|
if (this.publicKeyOnly && i == 1) {
|
|
throw new InvalidKeyException("mode 2 requires RSAPublicKey");
|
|
}
|
|
generatePrivateKeyParameter = RSAUtil.generatePrivateKeyParameter((RSAPrivateKey) key);
|
|
}
|
|
if (algorithmParameterSpec != null) {
|
|
OAEPParameterSpec oAEPParameterSpec = (OAEPParameterSpec) algorithmParameterSpec;
|
|
this.paramSpec = algorithmParameterSpec;
|
|
Object obj = null;
|
|
if (!oAEPParameterSpec.getMGFAlgorithm().equalsIgnoreCase("MGF1")) {
|
|
int i5 = g + 49;
|
|
b = i5 % 128;
|
|
if (i5 % 2 != 0) {
|
|
oAEPParameterSpec.getMGFAlgorithm().equals(PKCSObjectIdentifiers.id_mgf1.getId());
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
if (!oAEPParameterSpec.getMGFAlgorithm().equals(PKCSObjectIdentifiers.id_mgf1.getId())) {
|
|
throw new InvalidAlgorithmParameterException("unknown mask generation function specified");
|
|
}
|
|
}
|
|
if (!(oAEPParameterSpec.getMGFParameters() instanceof MGF1ParameterSpec)) {
|
|
throw new InvalidAlgorithmParameterException("unkown MGF parameters");
|
|
}
|
|
int i6 = b + 53;
|
|
g = i6 % 128;
|
|
if (i6 % 2 == 0) {
|
|
DigestFactory.getDigest(oAEPParameterSpec.getDigestAlgorithm());
|
|
throw null;
|
|
}
|
|
Digest digest = DigestFactory.getDigest(oAEPParameterSpec.getDigestAlgorithm());
|
|
if (digest == null) {
|
|
StringBuilder sb2 = new StringBuilder("no match on digest algorithm: ");
|
|
sb2.append(oAEPParameterSpec.getDigestAlgorithm());
|
|
throw new InvalidAlgorithmParameterException(sb2.toString());
|
|
}
|
|
MGF1ParameterSpec mGF1ParameterSpec = (MGF1ParameterSpec) oAEPParameterSpec.getMGFParameters();
|
|
Digest digest2 = DigestFactory.getDigest(mGF1ParameterSpec.getDigestAlgorithm());
|
|
if (digest2 == null) {
|
|
StringBuilder sb3 = new StringBuilder("no match on MGF digest algorithm: ");
|
|
sb3.append(mGF1ParameterSpec.getDigestAlgorithm());
|
|
throw new InvalidAlgorithmParameterException(sb3.toString());
|
|
}
|
|
this.cipher = new OAEPEncoding(new RSABlindedEngine(), digest, digest2, ((PSource.PSpecified) oAEPParameterSpec.getPSource()).getValue());
|
|
}
|
|
if (!(this.cipher instanceof RSABlindedEngine)) {
|
|
int i7 = b + 117;
|
|
g = i7 % 128;
|
|
int i8 = i7 % 2;
|
|
generatePrivateKeyParameter = secureRandom != null ? new ParametersWithRandom(generatePrivateKeyParameter, secureRandom) : new ParametersWithRandom(generatePrivateKeyParameter, new SecureRandom());
|
|
}
|
|
this.bOut.reset();
|
|
if (i != 1) {
|
|
if (i != 2) {
|
|
if (i != 3) {
|
|
int i9 = b + 37;
|
|
g = i9 % 128;
|
|
int i10 = i9 % 2;
|
|
if (i != 4) {
|
|
StringBuilder sb4 = new StringBuilder("unknown opmode ");
|
|
sb4.append(i);
|
|
sb4.append(" passed to RSA");
|
|
throw new InvalidParameterException(sb4.toString());
|
|
}
|
|
}
|
|
}
|
|
this.cipher.init(false, generatePrivateKeyParameter);
|
|
return;
|
|
}
|
|
this.cipher.init(true, generatePrivateKeyParameter);
|
|
}
|
|
|
|
@Override // javax.crypto.CipherSpi
|
|
protected void engineInit(int i, Key key, SecureRandom secureRandom) throws InvalidKeyException {
|
|
int i2 = 2 % 2;
|
|
int i3 = g + 1;
|
|
b = i3 % 128;
|
|
Object obj = null;
|
|
try {
|
|
if (i3 % 2 != 0) {
|
|
engineInit(i, key, (AlgorithmParameterSpec) null, secureRandom);
|
|
int i4 = 57 / 0;
|
|
} else {
|
|
engineInit(i, key, (AlgorithmParameterSpec) null, secureRandom);
|
|
}
|
|
int i5 = b + 95;
|
|
g = i5 % 128;
|
|
if (i5 % 2 != 0) {
|
|
return;
|
|
}
|
|
obj.hashCode();
|
|
throw null;
|
|
} catch (InvalidAlgorithmParameterException e2) {
|
|
StringBuilder sb = new StringBuilder("Eeeek! ");
|
|
sb.append(e2.toString());
|
|
throw new InvalidKeyException(sb.toString(), e2);
|
|
}
|
|
}
|
|
|
|
@Override // javax.crypto.CipherSpi
|
|
protected void engineInit(int i, Key key, AlgorithmParameters algorithmParameters, SecureRandom secureRandom) throws InvalidKeyException, InvalidAlgorithmParameterException {
|
|
AlgorithmParameterSpec algorithmParameterSpec;
|
|
int i2 = 2 % 2;
|
|
int i3 = g + 71;
|
|
int i4 = i3 % 128;
|
|
b = i4;
|
|
int i5 = i3 % 2;
|
|
if (algorithmParameters != null) {
|
|
int i6 = i4 + 67;
|
|
g = i6 % 128;
|
|
try {
|
|
if (i6 % 2 == 0) {
|
|
algorithmParameterSpec = algorithmParameters.getParameterSpec(OAEPParameterSpec.class);
|
|
int i7 = 29 / 0;
|
|
} else {
|
|
algorithmParameterSpec = algorithmParameters.getParameterSpec(OAEPParameterSpec.class);
|
|
}
|
|
} catch (InvalidParameterSpecException e2) {
|
|
StringBuilder sb = new StringBuilder("cannot recognise parameters: ");
|
|
sb.append(e2.toString());
|
|
throw new InvalidAlgorithmParameterException(sb.toString(), e2);
|
|
}
|
|
} else {
|
|
algorithmParameterSpec = null;
|
|
}
|
|
this.engineParams = algorithmParameters;
|
|
engineInit(i, key, algorithmParameterSpec, secureRandom);
|
|
}
|
|
|
|
@Override // org.bouncycastle.jcajce.provider.asymmetric.util.BaseCipherSpi, javax.crypto.CipherSpi
|
|
public AlgorithmParameters engineGetParameters() {
|
|
int i = 2 % 2;
|
|
if (this.engineParams == null) {
|
|
int i2 = b + 91;
|
|
g = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
if (this.paramSpec != null) {
|
|
try {
|
|
AlgorithmParameters createAlgorithmParameters = this.helper.createAlgorithmParameters("OAEP");
|
|
this.engineParams = createAlgorithmParameters;
|
|
createAlgorithmParameters.init(this.paramSpec);
|
|
} catch (Exception e2) {
|
|
throw new RuntimeException(e2.toString());
|
|
}
|
|
}
|
|
}
|
|
AlgorithmParameters algorithmParameters = this.engineParams;
|
|
int i4 = b + 91;
|
|
g = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
return algorithmParameters;
|
|
}
|
|
throw null;
|
|
}
|
|
|
|
@Override // org.bouncycastle.jcajce.provider.asymmetric.util.BaseCipherSpi, javax.crypto.CipherSpi
|
|
public int engineGetOutputSize(int i) {
|
|
int outputBlockSize;
|
|
int i2 = 2 % 2;
|
|
int i3 = b + 23;
|
|
g = i3 % 128;
|
|
try {
|
|
if (i3 % 2 == 0) {
|
|
outputBlockSize = this.cipher.getOutputBlockSize();
|
|
int i4 = 77 / 0;
|
|
} else {
|
|
outputBlockSize = this.cipher.getOutputBlockSize();
|
|
}
|
|
return outputBlockSize;
|
|
} catch (NullPointerException unused) {
|
|
throw new IllegalStateException("RSA Cipher not initialised");
|
|
}
|
|
}
|
|
|
|
@Override // org.bouncycastle.jcajce.provider.asymmetric.util.BaseCipherSpi, javax.crypto.CipherSpi
|
|
public int engineGetKeySize(Key key) {
|
|
BigInteger modulus;
|
|
int i = 2 % 2;
|
|
int i2 = b;
|
|
int i3 = i2 + 77;
|
|
g = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
if (key instanceof RSAPrivateKey) {
|
|
modulus = ((RSAPrivateKey) key).getModulus();
|
|
} else {
|
|
if (!(key instanceof RSAPublicKey)) {
|
|
throw new IllegalArgumentException("not an RSA key!");
|
|
}
|
|
int i5 = i2 + 51;
|
|
g = i5 % 128;
|
|
RSAPublicKey rSAPublicKey = (RSAPublicKey) key;
|
|
if (i5 % 2 == 0) {
|
|
rSAPublicKey.getModulus();
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
modulus = rSAPublicKey.getModulus();
|
|
int i6 = g + 93;
|
|
b = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
}
|
|
return modulus.bitLength();
|
|
}
|
|
|
|
@Override // org.bouncycastle.jcajce.provider.asymmetric.util.BaseCipherSpi, javax.crypto.CipherSpi
|
|
public int engineGetBlockSize() {
|
|
int inputBlockSize;
|
|
int i = 2 % 2;
|
|
int i2 = g + 67;
|
|
b = i2 % 128;
|
|
try {
|
|
if (i2 % 2 != 0) {
|
|
inputBlockSize = this.cipher.getInputBlockSize();
|
|
int i3 = 60 / 0;
|
|
} else {
|
|
inputBlockSize = this.cipher.getInputBlockSize();
|
|
}
|
|
int i4 = b + 95;
|
|
g = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return inputBlockSize;
|
|
} catch (NullPointerException unused) {
|
|
throw new IllegalStateException("RSA Cipher not initialised");
|
|
}
|
|
}
|
|
|
|
@Override // javax.crypto.CipherSpi
|
|
protected byte[] engineDoFinal(byte[] bArr, int i, int i2) throws IllegalBlockSizeException, BadPaddingException {
|
|
int i3 = 2 % 2;
|
|
if (bArr != null) {
|
|
this.bOut.write(bArr, i, i2);
|
|
}
|
|
if (!(!(this.cipher instanceof RSABlindedEngine))) {
|
|
int i4 = b + 21;
|
|
g = i4 % 128;
|
|
if (i4 % 2 != 0 ? this.bOut.size() > this.cipher.getInputBlockSize() + 1 : this.bOut.size() > this.cipher.getInputBlockSize() % 0) {
|
|
throw new ArrayIndexOutOfBoundsException("too much data for RSA block");
|
|
}
|
|
} else if (this.bOut.size() > this.cipher.getInputBlockSize()) {
|
|
throw new ArrayIndexOutOfBoundsException("too much data for RSA block");
|
|
}
|
|
try {
|
|
byte[] byteArray = this.bOut.toByteArray();
|
|
this.bOut.reset();
|
|
byte[] processBlock = this.cipher.processBlock(byteArray, 0, byteArray.length);
|
|
int i5 = b + 59;
|
|
g = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return processBlock;
|
|
} catch (InvalidCipherTextException e2) {
|
|
throw new BadPaddingException(e2.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // javax.crypto.CipherSpi
|
|
protected int engineDoFinal(byte[] bArr, int i, int i2, byte[] bArr2, int i3) throws IllegalBlockSizeException, BadPaddingException {
|
|
int i4 = 2 % 2;
|
|
if (bArr != null) {
|
|
int i5 = b + 27;
|
|
g = i5 % 128;
|
|
if (i5 % 2 == 0) {
|
|
this.bOut.write(bArr, i, i2);
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
this.bOut.write(bArr, i, i2);
|
|
}
|
|
if (this.cipher instanceof RSABlindedEngine) {
|
|
int i6 = g + 51;
|
|
b = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
if (this.bOut.size() > this.cipher.getInputBlockSize() + 1) {
|
|
throw new ArrayIndexOutOfBoundsException("too much data for RSA block");
|
|
}
|
|
} else if (this.bOut.size() > this.cipher.getInputBlockSize()) {
|
|
throw new ArrayIndexOutOfBoundsException("too much data for RSA block");
|
|
}
|
|
try {
|
|
try {
|
|
byte[] byteArray = this.bOut.toByteArray();
|
|
int i8 = 0;
|
|
byte[] processBlock = this.cipher.processBlock(byteArray, 0, byteArray.length);
|
|
while (i8 != processBlock.length) {
|
|
int i9 = b;
|
|
int i10 = i9 + 67;
|
|
g = i10 % 128;
|
|
int i11 = i10 % 2;
|
|
bArr2[i3 + i8] = processBlock[i8];
|
|
i8++;
|
|
int i12 = i9 + 19;
|
|
g = i12 % 128;
|
|
int i13 = i12 % 2;
|
|
}
|
|
int length = processBlock.length;
|
|
int i14 = b + 21;
|
|
g = i14 % 128;
|
|
int i15 = i14 % 2;
|
|
return length;
|
|
} catch (InvalidCipherTextException e2) {
|
|
throw new BadPaddingException(e2.getMessage());
|
|
}
|
|
} finally {
|
|
this.bOut.reset();
|
|
}
|
|
}
|
|
|
|
private void initFromSpec(OAEPParameterSpec oAEPParameterSpec) throws NoSuchPaddingException {
|
|
int i = 2 % 2;
|
|
int i2 = b + 47;
|
|
g = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
MGF1ParameterSpec mGF1ParameterSpec = (MGF1ParameterSpec) oAEPParameterSpec.getMGFParameters();
|
|
Digest digest = DigestFactory.getDigest(mGF1ParameterSpec.getDigestAlgorithm());
|
|
if (digest == null) {
|
|
StringBuilder sb = new StringBuilder("no match on OAEP constructor for digest algorithm: ");
|
|
sb.append(mGF1ParameterSpec.getDigestAlgorithm());
|
|
throw new NoSuchPaddingException(sb.toString());
|
|
}
|
|
this.cipher = new OAEPEncoding(new RSABlindedEngine(), digest, ((PSource.PSpecified) oAEPParameterSpec.getPSource()).getValue());
|
|
this.paramSpec = oAEPParameterSpec;
|
|
int i4 = g + 41;
|
|
b = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
}
|
|
|
|
public CipherSpi(boolean z, boolean z2, AsymmetricBlockCipher asymmetricBlockCipher) {
|
|
this.helper = new BCJcaJceHelper();
|
|
this.publicKeyOnly = false;
|
|
this.privateKeyOnly = false;
|
|
this.bOut = new ByteArrayOutputStream();
|
|
this.publicKeyOnly = z;
|
|
this.privateKeyOnly = z2;
|
|
this.cipher = asymmetricBlockCipher;
|
|
}
|
|
|
|
/* loaded from: classes6.dex */
|
|
public static class ISO9796d1Padding extends CipherSpi {
|
|
public ISO9796d1Padding() {
|
|
super(new ISO9796d1Encoding(new RSABlindedEngine()));
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes6.dex */
|
|
public static class NoPadding extends CipherSpi {
|
|
public NoPadding() {
|
|
super(new RSABlindedEngine());
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes6.dex */
|
|
public static class OAEPPadding extends CipherSpi {
|
|
public OAEPPadding() {
|
|
super(OAEPParameterSpec.DEFAULT);
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes6.dex */
|
|
public static class PKCS1v1_5Padding extends CipherSpi {
|
|
public PKCS1v1_5Padding() {
|
|
super(new PKCS1Encoding(new RSABlindedEngine()));
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes6.dex */
|
|
public static class PKCS1v1_5Padding_PrivateOnly extends CipherSpi {
|
|
public PKCS1v1_5Padding_PrivateOnly() {
|
|
super(false, true, new PKCS1Encoding(new RSABlindedEngine()));
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes6.dex */
|
|
public static class PKCS1v1_5Padding_PublicOnly extends CipherSpi {
|
|
public PKCS1v1_5Padding_PublicOnly() {
|
|
super(true, false, new PKCS1Encoding(new RSABlindedEngine()));
|
|
}
|
|
}
|
|
|
|
public CipherSpi(AsymmetricBlockCipher asymmetricBlockCipher) {
|
|
this.helper = new BCJcaJceHelper();
|
|
this.publicKeyOnly = false;
|
|
this.privateKeyOnly = false;
|
|
this.bOut = new ByteArrayOutputStream();
|
|
this.cipher = asymmetricBlockCipher;
|
|
}
|
|
|
|
public CipherSpi(OAEPParameterSpec oAEPParameterSpec) {
|
|
this.helper = new BCJcaJceHelper();
|
|
this.publicKeyOnly = false;
|
|
this.privateKeyOnly = false;
|
|
this.bOut = new ByteArrayOutputStream();
|
|
try {
|
|
initFromSpec(oAEPParameterSpec);
|
|
} catch (NoSuchPaddingException e2) {
|
|
throw new IllegalArgumentException(e2.getMessage());
|
|
}
|
|
}
|
|
}
|