能力值:
( LV7,RANK:100 )
|
-
-
2 楼
package com.macrovision.flexlm.lictext;
import com.certicom.ecc.jcae.Certicom; import com.certicom.ecc.scheme.ECDSA; import com.certicom.ecc.system.SystemConfig; import com.certicom.ecc.util.Conversion; import com.macrovision.flexlm.FlexlmConstants; import com.macrovision.flexlm.FlexlmException; import com.macrovision.flexlm.VendorInfo; import java.security.InvalidKeyException; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.Provider; import java.security.PublicKey; import java.security.Security; import java.security.Signature; import java.security.SignatureException; import java.security.spec.InvalidKeySpecException; import java.security.spec.KeySpec; import java.security.spec.X509EncodedKeySpec; import javax.security.spec.ECParameterSpec; import javax.security.spec.ECRawPublicKeySpec; import javax.security.spec.F2mParameterSpec;
public class PriKey implements FlexlmConstants { static final String CVSId = "$Id"; protected static String certicomName; protected static final String signatureAlgorithmName = "ECDSA"; public static boolean pubkeyVerify(byte[] paramArrayOfbyte1, byte[] paramArrayOfbyte2, VendorInfo paramVendorInfo, int paramInt) throws FlexlmException { System.setProperty("JDK_1_3_Compatibility", "YES"); String str = initCerticom(); if (str == null) throw new FlexlmException(-514, 4026); SystemConfig systemConfig = SystemConfig.getConfig(); systemConfig.setConformance(16); systemConfig.setPtCompression(2); systemConfig.setFormat(10); switch (paramInt) { case 2: break; case 3: systemConfig.setCurve("sect163k1"); break; case 4: systemConfig.setCurve("sect239k1"); break; default: throw new FlexlmException(-515, 4027); } PublicKey publicKey1 = paramVendorInfo.getPublicKey(paramInt); if (publicKey1 == null) throw new FlexlmException(-515, 4028); byte[] arrayOfByte = publicKey1.getEncoded(); PublicKey publicKey2 = null; ECRawPublicKeySpec eCRawPublicKeySpec = null; X509EncodedKeySpec x509EncodedKeySpec = null; try { KeyFactory keyFactory = KeyFactory.getInstance("ECDSA"); if (paramInt == 2) { ECDSA.setThreadOldHashTruncate(true); int[] arrayOfInt = { 9 }; String str1 = "1.3.132.0.4"; F2mParameterSpec f2mParameterSpec = new F2mParameterSpec(Conversion.HexString2OS("3088250ca6e7c7fe649ce85820f7"), Conversion.HexString2OS("e8bee4d3e2260744188be0e9c723"), Conversion.HexString2OS("10e723ab14d696e6768756151756febf8fcb49a9"), Conversion.HexString2OS("9d73616f35f4ab1407d73562c10f"), Conversion.HexString2OS("a52830277958ee84d1315ed31886"), Conversion.HexString2OS("100000000000000d9ccec8a39e56f"), 2, 113, arrayOfInt, str1); eCRawPublicKeySpec = new ECRawPublicKeySpec(arrayOfByte, (ECParameterSpec)f2mParameterSpec); publicKey2 = keyFactory.generatePublic((KeySpec)eCRawPublicKeySpec); } else { x509EncodedKeySpec = new X509EncodedKeySpec(arrayOfByte); publicKey2 = keyFactory.generatePublic(x509EncodedKeySpec); } Signature signature = Signature.getInstance("ECDSA", str); signature.initVerify(publicKey2); signature.update(paramArrayOfbyte1); boolean bool = signature.verify(paramArrayOfbyte2); } catch (NoSuchAlgorithmException noSuchAlgorithmException) { throw new FlexlmException(-515, 4029); } catch (InvalidKeySpecException invalidKeySpecException) { throw new FlexlmException(-515, 4030); } catch (InvalidKeyException invalidKeyException) { throw new FlexlmException(-515, 4031); } catch (NoSuchProviderException noSuchProviderException) { throw new FlexlmException(-515, 4032); } catch (SignatureException signatureException) { throw new FlexlmException(-515, 4033); } return true;//这里patch了,原本为return bool; } protected static String initCerticom() { if (certicomName != null) return certicomName; Certicom certicom = new Certicom(); if (Security.addProvider((Provider)certicom) < 0); certicomName = certicom.getName(); return certicomName; } public static void printBytes(byte[] paramArrayOfbyte) { for (byte b = 0; b < paramArrayOfbyte.length; b = (byte)(b + 1)) { System.out.print(Integer.toString(paramArrayOfbyte[b] & 0xFF, 16)); System.out.print(" "); } } public static void printBytes(String paramString, byte[] paramArrayOfbyte) { System.out.print(paramString + " = { "); printBytes(paramArrayOfbyte); System.out.println(" }"); } }
|
能力值:
( LV7,RANK:100 )
|
-
-
3 楼
package com.cadence.softshare.model;
import com.macrovision.flexlm.FlexlmConstants; import com.macrovision.flexlm.VendorInfo; import com.macrovision.flexlm.misc.FlexlmPublicKey; import java.security.PublicKey;
public class *马赛克*Info extends VendorInfo implements FlexlmConstants { public String getVendorName() { return " *马赛克* "; } public PublicKey getPublicKey(int paramInt) { switch (paramInt) { case 2: return (PublicKey)new FlexlmPublicKey(getVendorName(), "669CC99E68E31141EBCC08CAF4D8F4AB"); case 3: return (PublicKey)new FlexlmPublicKey(getVendorName(), "65A10912B05C91EAE100A6E4E09F2CD89D4143C283F9"); case 4: return (PublicKey)new FlexlmPublicKey(getVendorName(), "66E4247FAF3E3927281AC0E0998F0D61B2C4EFED6E66A0A4882744FDCDF4DA"); } return null; } public int[] getEncryptionSeeds() { return new int[] { -130035400, 1754763913 }; } public int[] getVendorKeys() { return new int[] { 1305523855, -1242601545, 1912273004, 1389260354 }; } public int[] getCroKeys() { return new int[] { 0, 0 }; } public int getDefaultStrength() { return 4; } }
|
能力值:
( LV7,RANK:100 )
|
-
-
4 楼
解决了,patch掉com.macrovision.flexlm.License.java 中的checkout()使之返回true (不需要patch pubkeyVerify)(相当于C语言版本的lc_checkout)(版本>=11.11)
|