- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
102 lines
3.4 KiB
Java
102 lines
3.4 KiB
Java
package androidx.credentials.provider.utils;
|
|
|
|
import android.hardware.biometrics.BiometricPrompt;
|
|
import android.os.Build;
|
|
import android.security.identity.IdentityCredential;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.biometric.BiometricPrompt;
|
|
import java.security.Signature;
|
|
import javax.crypto.Cipher;
|
|
import javax.crypto.Mac;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class CryptoObjectUtils {
|
|
public static final CryptoObjectUtils INSTANCE = new CryptoObjectUtils();
|
|
|
|
private CryptoObjectUtils() {
|
|
}
|
|
|
|
@RequiresApi(28)
|
|
public final BiometricPrompt.CryptoObject wrapForBiometricPrompt(BiometricPrompt.CryptoObject cryptoObject) {
|
|
IdentityCredential identityCredential;
|
|
if (cryptoObject == null) {
|
|
return null;
|
|
}
|
|
Cipher cipher = cryptoObject.getCipher();
|
|
if (cipher != null) {
|
|
return Api28Impl.INSTANCE.create(cipher);
|
|
}
|
|
Signature signature = cryptoObject.getSignature();
|
|
if (signature != null) {
|
|
return Api28Impl.INSTANCE.create(signature);
|
|
}
|
|
Mac mac = cryptoObject.getMac();
|
|
if (mac != null) {
|
|
return Api28Impl.INSTANCE.create(mac);
|
|
}
|
|
if (Build.VERSION.SDK_INT < 30 || (identityCredential = cryptoObject.getIdentityCredential()) == null) {
|
|
return null;
|
|
}
|
|
return Api30Impl.INSTANCE.create(identityCredential);
|
|
}
|
|
|
|
@RequiresApi(35)
|
|
public final long getOperationHandle(BiometricPrompt.CryptoObject cryptoObject) {
|
|
BiometricPrompt.CryptoObject wrapForBiometricPrompt = wrapForBiometricPrompt(cryptoObject);
|
|
if (wrapForBiometricPrompt != null) {
|
|
return Api35Impl.INSTANCE.getOperationHandle(wrapForBiometricPrompt);
|
|
}
|
|
return 0L;
|
|
}
|
|
|
|
@RequiresApi(35)
|
|
public static final class Api35Impl {
|
|
public static final Api35Impl INSTANCE = new Api35Impl();
|
|
|
|
private Api35Impl() {
|
|
}
|
|
|
|
public final long getOperationHandle(BiometricPrompt.CryptoObject crypto) {
|
|
Intrinsics.checkNotNullParameter(crypto, "crypto");
|
|
return crypto.getOperationHandle();
|
|
}
|
|
}
|
|
|
|
@RequiresApi(30)
|
|
public static final class Api30Impl {
|
|
public static final Api30Impl INSTANCE = new Api30Impl();
|
|
|
|
private Api30Impl() {
|
|
}
|
|
|
|
public final BiometricPrompt.CryptoObject create(IdentityCredential identityCredential) {
|
|
Intrinsics.checkNotNullParameter(identityCredential, "identityCredential");
|
|
return new BiometricPrompt.CryptoObject(identityCredential);
|
|
}
|
|
}
|
|
|
|
@RequiresApi(28)
|
|
public static final class Api28Impl {
|
|
public static final Api28Impl INSTANCE = new Api28Impl();
|
|
|
|
private Api28Impl() {
|
|
}
|
|
|
|
public final BiometricPrompt.CryptoObject create(Cipher cipher) {
|
|
Intrinsics.checkNotNullParameter(cipher, "cipher");
|
|
return new BiometricPrompt.CryptoObject(cipher);
|
|
}
|
|
|
|
public final BiometricPrompt.CryptoObject create(Signature signature) {
|
|
Intrinsics.checkNotNullParameter(signature, "signature");
|
|
return new BiometricPrompt.CryptoObject(signature);
|
|
}
|
|
|
|
public final BiometricPrompt.CryptoObject create(Mac mac) {
|
|
Intrinsics.checkNotNullParameter(mac, "mac");
|
|
return new BiometricPrompt.CryptoObject(mac);
|
|
}
|
|
}
|
|
}
|