CrackMe.apk
Download file
package com.google.android.gms.internal.p002firebaseauthapi;
import android.util.Log;
import java.security.GeneralSecurityException;
import java.security.InvalidKeyException;
import java.security.KeyStore;
import java.security.ProviderException;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
/* renamed from: com.google.android.gms.internal.firebase-auth-api.zzfo reason: invalid package */
/* compiled from: com.google.firebase:firebase-auth@@21.1.0 */
public final class zzfo implements zzap {
private static final String zza = "zzfo";
private final SecretKey zzb;
zzfo(String str, KeyStore keyStore) throws GeneralSecurityException {
SecretKey secretKey = (SecretKey) keyStore.getKey(str, (char[]) null);
this.zzb = secretKey;
if (secretKey == null) {
throw new InvalidKeyException("Keystore cannot load the key with ID: ".concat(String.valueOf(str)));
}
}
private static void zzc() {
try {
Thread.sleep((long) ((int) (Math.random() * 100.0d)));
} catch (InterruptedException unused) {
}
}
private final byte[] zzd(byte[] bArr, byte[] bArr2) throws GeneralSecurityException {
int length = bArr.length;
if (length >= 28) {
GCMParameterSpec gCMParameterSpec = new GCMParameterSpec(128, bArr, 0, 12);
Cipher instance = Cipher.getInstance("AES/GCM/NoPadding");
instance.init(2, this.zzb, gCMParameterSpec);
instance.updateAAD(bArr2);
return instance.doFinal(bArr, 12, length - 12);
}
throw new GeneralSecurityException("ciphertext too short");
}
private final byte[] zze(byte[] bArr, byte[] bArr2) throws GeneralSecurityException {
int length = bArr.length;
if (length <= 2147483619) {
byte[] bArr3 = new byte[(length + 28)];
Cipher instance = Cipher.getInstance("AES/GCM/NoPadding");
instance.init(1, this.zzb);
instance.updateAAD(bArr2);
instance.doFinal(bArr, 0, length, bArr3, 12);
System.arraycopy(instance.getIV(), 0, bArr3, 0, 12);
return bArr3;
}
throw new GeneralSecurityException("plaintext too long");
}
public final byte[] zza(byte[] bArr, byte[] bArr2) throws GeneralSecurityException {
try {
return zzd(bArr, bArr2);
} catch (GeneralSecurityException | ProviderException e) {
Log.w(zza, "encountered a potentially transient KeyStore error, will wait and retry", e);
zzc();
return zzd(bArr, bArr2);
}
}
public final byte[] zzb(byte[] bArr, byte[] bArr2) throws GeneralSecurityException {
try {
return zze(bArr, bArr2);
} catch (GeneralSecurityException | ProviderException e) {
Log.w(zza, "encountered a potentially transient KeyStore error, will wait and retry", e);
zzc();
return zze(bArr, bArr2);
}
}
}
Download file