32 lines
1.2 KiB
Java
32 lines
1.2 KiB
Java
|
package com.google.android.libraries.places.internal;
|
||
|
|
||
|
import android.content.pm.PackageInfo;
|
||
|
import android.content.pm.PackageManager;
|
||
|
import android.content.pm.Signature;
|
||
|
import java.security.MessageDigest;
|
||
|
import java.security.NoSuchAlgorithmException;
|
||
|
import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class zzfu {
|
||
|
public static String zza(PackageManager packageManager, String str) {
|
||
|
try {
|
||
|
PackageInfo packageInfo = packageManager.getPackageInfo(str, 64);
|
||
|
if (packageInfo != null && packageInfo.signatures != null && packageInfo.signatures.length != 0 && packageInfo.signatures[0] != null) {
|
||
|
return zzb(packageInfo.signatures[0]);
|
||
|
}
|
||
|
} catch (PackageManager.NameNotFoundException unused) {
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
private static String zzb(Signature signature) {
|
||
|
try {
|
||
|
byte[] digest = MessageDigest.getInstance(McElieceCCA2KeyGenParameterSpec.SHA1).digest(signature.toByteArray());
|
||
|
return zzmj.zzd().zze(digest, 0, digest.length);
|
||
|
} catch (NoSuchAlgorithmException unused) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
}
|