|  |  |  | 
|---|
|  |  |  | package com.ruoyi.authorize.common; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.sun.org.apache.xerces.internal.impl.dv.util.HexBin; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.commons.codec.binary.Hex; | 
|---|
|  |  |  | import org.apache.commons.compress.utils.IOUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.*; | 
|---|
|  |  |  | import java.net.InetAddress; | 
|---|
|  |  |  | import java.net.NetworkInterface; | 
|---|
|  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.GregorianCalendar; | 
|---|
|  |  |  | import java.util.Scanner; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.crypto.Cipher; | 
|---|
|  |  |  | import javax.crypto.KeyGenerator; | 
|---|
|  |  |  | import javax.crypto.SecretKey; | 
|---|
|  |  |  | 
|---|
|  |  |  | import javax.crypto.spec.SecretKeySpec; | 
|---|
|  |  |  | import javax.xml.bind.DatatypeConverter; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Slf4j(topic="Authorize") | 
|---|
|  |  |  | @Slf4j(topic="authorize") | 
|---|
|  |  |  | public class AuthorizeUtil { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static String MachineCode=""; | 
|---|
|  |  |  | 
|---|
|  |  |  | public static void main(String[] args) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | AuthorizeUtil ss = new AuthorizeUtil(); | 
|---|
|  |  |  | System.out.println("sysStr " + ss.parsLicense()); | 
|---|
|  |  |  | System.out.println("MachineCode " + ss.getMachineCode()); | 
|---|
|  |  |  | System.out.println("CPUCode     " + ss.getCPUCode()); | 
|---|
|  |  |  | log.debug("sysStr " + ss.parsLicense()); | 
|---|
|  |  |  | log.debug("MachineCode " + ss.getMachineCode()); | 
|---|
|  |  |  | log.debug("CPUCode     " + ss.getCPUCode()); | 
|---|
|  |  |  | //String codeString=ss.parsLicense("b1db709f19d9769e536e2e29888e38b2"); | 
|---|
|  |  |  | //System.out.println(codeString); | 
|---|
|  |  |  | //ss.makeTempLicense(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取机器码异常:"+e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return Md5Utils.hash(sb.toString().toUpperCase()); | 
|---|
|  |  |  | String code = Md5Utils.hash(sb.toString().toUpperCase()); | 
|---|
|  |  |  | log.debug("机器码:"+code); | 
|---|
|  |  |  | return code; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static String getCPUCode() { | 
|---|