我已经重新签名了一个jar文件并运行它。但是,它在打开后立即关闭。是否可以从java代码调用* .rsa或* .sf或manifest.mf的信息来检查它是否有变化,谢谢。
答案 0 :(得分:0)
实际上我在jar文件的类中找到了一个方法及其返回的证书,这意味着在jar文件中有一个证书控制桥,代码是:
private Certificate[] XQ(et etProp) throws Exception{
System.out.println("Rg test 78");
String value = null;
Iterator iterator = etProp.af().iterator();
while (iterator.hasNext()) {
un.JI innerUn = (un.JI) iterator.next();
String certificateToUpperCase = innerUn.XQ().toUpperCase();
if (certificateToUpperCase != null && certificateToUpperCase.startsWith("META-INF/")
&& (certificateToUpperCase.endsWith(".RSA") || certificateToUpperCase.endsWith(".DSA"))) {
value = innerUn.XQ();
break;
}
}
if (value == null) {
System.out.println("Rg test 81");
qm.XQ((String) "Could not find certificates file");
return null;
} else {
System.out.println("Rg test 82");
byte[] arrayAf = etProp.af(value);
if (arrayAf == null) {
System.out.println("Rg test 83");
Object[] objectsArray = new Object[] { value };
return null;
} else {
System.out.println("Rg test 84");
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(arrayAf);
Collection collection;
try {
System.out.println("Rg test 85");
CertificateFactory certificateFactory = CertificateFactory
.getInstance("X.509");
collection = certificateFactory.generateCertificates(byteArrayInputStream);
} catch (CertificateException ex) {
qm.XQ((String) String.format(
"Could not parse certificate data: %s",
new Object[] { ex.toString() }));
return null;
}
Certificate[] certificates = new Certificate[collection.size()];
int i = 0;
Certificate certificate;
for (Iterator iterator1 = collection.iterator(); iterator1.hasNext(); certificates[i++] = certificate) {
System.out.println("Rg test 87");
certificate = (Certificate) iterator1.next();
}
return certificates;
}
}
}
保护jar文件免受破解是非常好的举措。