不好意思,诡异的事情发生了,我把你分享的bak里的MECPListContentProvider.class和patch里的MECPListContentProvider.class解压在同一目录内(名字分别:
MECPListContentProvider.class和
MECPListContentProvider (2).class),反编译结果一样。听了你的话,我又单独反编译了一边bak里的MECPListContentProvider.class一遍,结果。。。。抱歉,是我的失误造的。。。
package com.genuitec.eclipse.core.ui.preference;
import java.io.IOException;
import java.io.PrintStream;
import java.security.PublicKey;
import java.security.cert.*;
import java.util.Timer;
import org.apache.commons.codec.binary.Hex;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.signedcontent.*;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.osgi.framework.*;
import sun.security.rsa.RSAPublicKeyImpl;
public class MECPListContentProvider
{
public MECPListContentProvider()
{
}
protected Status verifyJarSignatures(String thePluginId, String thePublicKeyHex)
{
boolean isOurKey;
Bundle core;
BundleContext bundleContext;
ServiceReference certRef;
boolean isSigned = false;
boolean isTrusted = false;
isOurKey = false;
core = Platform.getBundle(thePluginId);
bundleContext = null;
certRef = null;
Status status;
PublicKey publicKey = new RSAPublicKeyImpl(Hex.decodeHex(thePublicKeyHex.toCharArray()));
bundleContext = core.getBundleContext();
certRef = bundleContext.getServiceReference(org/eclipse/osgi/signedcontent/SignedContentFactory.getName());
SignedContentFactory certFactory = (SignedContentFactory)bundleContext.getService(certRef);
SignedContent verifier = certFactory.getSignedContent(core);
SignerInfo certChains[] = verifier.getSignerInfos();
SignerInfo chain = certChains[0];
Certificate certs[] = chain.getCertificateChain();
checkContent(verifier);
boolean isSigned = verifier.isSigned();
boolean isTrusted = chain.isTrusted();
for(int i = 0; i < certs.length && !isOurKey; i++)
isOurKey = certs[i].getPublicKey().equals(publicKey);
status = !isSigned || !isTrusted || !isOurKey ? new Status(4, thePluginId, "Signature chain is not valid or is not from Genuitec. MyEclipse features will not start with an unsigned installation.", new SecurityException("No trusted certificate chain used for signing.")) : new Status(0, thePluginId, "Signature chain is valid and from Genuitec.");
if(bundleContext != null && certRef != null)
bundleContext.ungetService(certRef);
return status;
Throwable e;
e;
Throwable ex = e;
if(!(e instanceof SecurityException))
ex = new SecurityException("No trusted certificate chain used for signing.");
status = new Status(4, thePluginId, (new StringBuilder("The signature chain used to sign MyEclipse is either not valid or does not belong to Genuitec. MyEclipse features will not start with an unsigned installation. Reason: ")).append(ex.getLocalizedMessage()).toString(), ex);
if(bundleContext != null && certRef != null)
bundleContext.ungetService(certRef);
return status;
Exception exception;
exception;
if(bundleContext != null && certRef != null)
bundleContext.ungetService(certRef);
throw exception;
}
public void checkContent(SignedContent signedContent)
throws CertificateExpiredException, CertificateNotYetValidException
{
SignedContentEntry entries[] = signedContent.getSignedEntries();
for(int i = 0; i < entries.length; i++)
try
{
entries[i].verify();
}
catch(InvalidContentException e)
{
throw (SecurityException)(new SecurityException(e.getMessage())).initCause(e);
}
catch(IOException e)
{
throw (SecurityException)(new SecurityException(e.getMessage())).initCause(e);
}
SignerInfo infos[] = signedContent.getSignerInfos();
for(int i = 0; i < infos.length; i++)
signedContent.checkValidity(infos[i]);
}
public Status verifyJarSignatures(String thePluginIdArray[])
{
Status summaryStatus = null;
for(int pluginIdNdx = 0; pluginIdNdx < thePluginIdArray.length; pluginIdNdx++)
{
String curPluginId = thePluginIdArray[pluginIdNdx];
Status myEclipseStatus = verifyJarSignatures(curPluginId, "30819f300d06092a864886f70d010101050003818d0030818902818100b68f5c4842bc07f6903c583e6f899c3c35e48c688f5a989f7564e43cebf7195439a126cd0a638147f1f98d6817d5f2c89f5b66850080d654a5dafe9bbbf99eaff0322164d2f80b15a9521dde609301e166a6c2250e9289f8c908eb22bfd3e563cee57ad45250e18872670e415364a8f441eb88e9ab3d402b8a02d1d31dbce4690203010001");
Status genuitecStatus = verifyJarSignatures(curPluginId, "30820122300d06092a864886f70d01010105000382010f003082010a0282010100b731ce4f1b036e120cd44d61178e7ffb47e6875a0ab007000f8d7502aa0c52982bdb0b588caf434dff38a7d85d4f51bb73d8bd9fbcde11908fb1095d860afa3a681fd0dd6eb39e858dd43c3d2bad5641464fb1fa595b7682ac490b0d88d8ebc11f7569cafef2d817a9fe0cc43b556571adfb6106fd827d2a56179daa223ed7b5f53ebb34111bd52a15d5adafa6ed547d65685a7ed26495a89d8afe4a5c3cfa8961f58aa0994e64048c02ab22ac6a5e53e5895eccc5a9a5c969bce15cee275fcaab1e62be6ba9770c0cf2cfb723e7ff6da3b428e7210cfca19eeba19d4254bf30f13653d328816788ada1c555be469f9c70211943375a576b0841bccb066904790203010001");
if(genuitecStatus.isOK())
{
summaryStatus = genuitecStatus;
continue;
}
if(myEclipseStatus.isOK())
{
summaryStatus = myEclipseStatus;
continue;
}
summaryStatus = genuitecStatus;
break;
}
return summaryStatus;
}
public void verifyJarSignatures()
{
Status coreSigned = verifyJarSignatures(signedPluginIDs);
if(!coreSigned.isOK())
{
String securityMsg = (new StringBuilder("SECURITY ALERT: INTEGRITY CHECK ERROR\n\nThis product did not pass the MyEclipse integrity check. This security check is a prerequisite for launch of MyEclipse. Please reinstall MyEclipse and try again.\n\nSpecific Error: ")).append(coreSigned.getMessage()).append("\n\n").append("For additional assistance contact support@genuitec.com").toString();
System.out.println(securityMsg);
(new Timer(true)).schedule(new Object() /* anonymous class not found */
class _anm1 {}
, 40000L);
Display display;
try
{
display = PlatformUI.createDisplay();
}
catch(Throwable _ex)
{
display = Display.getDefault();
}
Display errDisplay = display;
errDisplay.asyncExec(new Object(errDisplay, securityMsg) /* anonymous class not found */
class _anm2 {}
);
}
}
public static final String signedPluginIDs[] = {
"com.genuitec.eclipse.core"
};
private static final String myEclipsePublicKeyHex = "30819f300d06092a864886f70d010101050003818d0030818902818100b68f5c4842bc07f6903c583e6f899c3c35e48c688f5a989f7564e43cebf7195439a126cd0a638147f1f98d6817d5f2c89f5b66850080d654a5dafe9bbbf99eaff0322164d2f80b15a9521dde609301e166a6c2250e9289f8c908eb22bfd3e563cee57ad45250e18872670e415364a8f441eb88e9ab3d402b8a02d1d31dbce4690203010001";
private static final String genuitecPublicKeyHex = "30820122300d06092a864886f70d01010105000382010f003082010a0282010100b731ce4f1b036e120cd44d61178e7ffb47e6875a0ab007000f8d7502aa0c52982bdb0b588caf434dff38a7d85d4f51bb73d8bd9fbcde11908fb1095d860afa3a681fd0dd6eb39e858dd43c3d2bad5641464fb1fa595b7682ac490b0d88d8ebc11f7569cafef2d817a9fe0cc43b556571adfb6106fd827d2a56179daa223ed7b5f53ebb34111bd52a15d5adafa6ed547d65685a7ed26495a89d8afe4a5c3cfa8961f58aa0994e64048c02ab22ac6a5e53e5895eccc5a9a5c969bce15cee275fcaab1e62be6ba9770c0cf2cfb723e7ff6da3b428e7210cfca19eeba19d4254bf30f13653d328816788ada1c555be469f9c70211943375a576b0841bccb066904790203010001";
}