47 lines
1.8 KiB
Java
47 lines
1.8 KiB
Java
package com.google.android.gms.internal.p002firebaseauthapi;
|
|
|
|
import java.security.GeneralSecurityException;
|
|
import java.security.spec.AlgorithmParameterSpec;
|
|
import javax.crypto.Cipher;
|
|
import javax.crypto.SecretKey;
|
|
import javax.crypto.spec.GCMParameterSpec;
|
|
import javax.crypto.spec.IvParameterSpec;
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class zzdu implements zzap {
|
|
private static final ThreadLocal zza = new zzdt();
|
|
private final SecretKey zzb;
|
|
|
|
public zzdu(byte[] bArr) throws GeneralSecurityException {
|
|
zzqs.zzb(bArr.length);
|
|
this.zzb = new SecretKeySpec(bArr, "AES");
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.p002firebaseauthapi.zzap
|
|
public final byte[] zza(byte[] bArr, byte[] bArr2) throws GeneralSecurityException {
|
|
AlgorithmParameterSpec ivParameterSpec;
|
|
if (bArr.length >= 28) {
|
|
try {
|
|
Class.forName("javax.crypto.spec.GCMParameterSpec");
|
|
ivParameterSpec = new GCMParameterSpec(128, bArr, 0, 12);
|
|
} catch (ClassNotFoundException unused) {
|
|
if (zzqr.zza()) {
|
|
ivParameterSpec = new IvParameterSpec(bArr, 0, 12);
|
|
} else {
|
|
throw new GeneralSecurityException("cannot use AES-GCM: javax.crypto.spec.GCMParameterSpec not found");
|
|
}
|
|
}
|
|
ThreadLocal threadLocal = zza;
|
|
((Cipher) threadLocal.get()).init(2, this.zzb, ivParameterSpec);
|
|
return ((Cipher) threadLocal.get()).doFinal(bArr, 12, bArr.length - 12);
|
|
}
|
|
throw new GeneralSecurityException("ciphertext too short");
|
|
}
|
|
|
|
@Override // com.google.android.gms.internal.p002firebaseauthapi.zzap
|
|
public final byte[] zzb(byte[] bArr, byte[] bArr2) throws GeneralSecurityException {
|
|
throw null;
|
|
}
|
|
}
|