请问这是不是检查签名有变动的JAVA语句?
正在学习逆向,想知道这个是不是检查签名有变动?谢谢
package com.android.support;
import android.content.Context;
import android.content.pm.Signature;
import android.os.Process;
import android.util.Base64;
import android.widget.Toast;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
public class GetConfig {
public static String text(String str) {
String str2 = "";
try {
String str3 = r10;
String str4 = new String(Base64.decode(str, 0), "UTF-8");
str2 = str3;
} catch (Exception e) {
Exception exception = e;
}
return str2;
}
public static void checker(Context context, String str) {
StringBuffer stringBuffer;
Context context2 = context;
String str2 = str;
try {
Signature[] signatureArr = context2.getPackageManager().getPackageInfo(context2.getPackageName(), 64).signatures;
CertificateFactory instance = CertificateFactory.getInstance(text("WDUwOQ=="));
InputStream inputStream = r16;
InputStream byteArrayInputStream = new ByteArrayInputStream(signatureArr[0].toByteArray());
byte[] digest = MessageDigest.getInstance(text("U0hBMQ==")).digest(((X509Certificate) instance.generateCertificate(inputStream)).getEncoded());
StringBuilder stringBuilder = r16;
StringBuilder stringBuilder2 = new StringBuilder(digest.length * 2);
StringBuilder stringBuilder3 = stringBuilder;
for (int i = 0; i < digest.length; i++) {
String toHexString = Integer.toHexString(digest[i]);
int length = toHexString.length();
if (length == 1) {
StringBuffer stringBuffer2 = r16;
stringBuffer = new StringBuffer();
toHexString = stringBuffer2.append("0").append(toHexString).toString();
}
if (length > 2) {
toHexString = toHexString.substring(length - 2, length);
}
stringBuilder = stringBuilder3.append(toHexString.toUpperCase());
if (i < digest.length - 1) {
stringBuilder = stringBuilder3.append(':');
}
}
String stringBuilder4 = stringBuilder3.toString();
if (!stringBuilder4.equals(text(str2))) {
System.exit(0);
}
if (!stringBuilder4.equals(text(str2))) {
Process.killProcess(Process.myPid());
}
} catch (Exception e) {
Exception exception = e;
Context context3 = context2;
stringBuffer = r16;
StringBuffer stringBuffer3 = new StringBuffer();
Toast.makeText(context3, stringBuffer.append(text("RXJyb3I6IA==")).append(exception).toString(), 1).show();
System.exit(0);
}
}
public GetConfig() {
GetConfig getConfig = this;
}
}
问题描述
问题出现的环境背景及自己尝试过哪些方法
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
你期待的结果是什么?实际看到的错误信息又是什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论