zoukankan      html  css  js  c++  java
  • 关于C#应用的授权认证

    1、加壳,不然很容易反编译绕过认证

    2、获取机器码,通常是获取CPU,MAC,网卡和UUID等信息加密而成,但是针对虚拟机来说并不好判断,尤其是虚拟机迁移等操作。有针对虚拟机授权的朋友可以指点

    3、针对上面的特征码做不可逆的加密计算(网上很多),加密结果放多应用程序目录

    4、应用程序每次启动根据本机的机器码做第3步的加密再和本地存储的特征码比对

    扩展:也有根据程序模块来授权的,这就需要把模块的特征码也保存起来,或者像微软一样,针对不同的版本(企业版,专业版.....)来提供序列号

      但是这些一般都需要机器码来作为唯一标识,以下附上获取特征码获取代码

            private List<XElement> identifier(string wmiClass, string wmiProperty, string name)
            {
                List<XElement> XL = new List<XElement>();
                System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
                System.Management.ManagementObjectCollection moc = mc.GetInstances();
                foreach (System.Management.ManagementObject mo in moc)
                {
                    if (mo != null && mo[wmiProperty] != null)
                    {
                        XL.Add(new XElement(name, new XElement(wmiProperty, mo[wmiProperty])));
    
                    }
                }
                return XL;
            }
    
      //cpu Identifier
            public List<XElement> GetCPUInfo()
            {
    
                return identifier("Win32_Processor", "ProcessorId", "CPU");  //ProcessorID
    
            }
    
            //BIOS Identifier
            public List<XElement> GetBIOSInfo()
            {
                return identifier("Win32_BIOS", "SerialNumber", "BIOS");
            }
            //Main physical hard drive ID
            public List<XElement> GetDiskInfo()
            {
                return identifier("Win32_DiskDrive", "Signature", "DISK");
            }
            //Motherboard ID
            public List<XElement> GetMotherboardInfo()
            {
                return identifier("Win32_BaseBoard", "SerialNumber", "Motherboard");
            }
            //Primary video controller ID
            //public static string GetVideoInfo()
            //{
            //    return "DriverVersion:" + identifier("Win32_VideoController", "DriverVersion") + ",    " +
            //    "Name:" + identifier("Win32_VideoController", "Name");
            //}
            //First enabled network card ID
            public List<XElement> GetMACId()
            {
                return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "MAC");
            }
    
            public List<XElement> GetUUID()
            {
                return identifier("Win32_ComputerSystemProduct", "UUID", "UniqueID");
    
            }
    

      

  • 相关阅读:
    24)django-信号
    23)django-缓存
    22)django-中间件
    21)django-csrf(跨站请求伪造)
    20)django-session使用
    19)django-cookie使用
    18)django-模板的过滤器和tag,自定义simple_tag和filter
    17)django-模板的继承与导入
    document.documentElement.clientHeight 和 document.body.clientHeight
    Markdown 入门基础
  • 原文地址:https://www.cnblogs.com/guangmangchen/p/6699690.html
Copyright © 2011-2022 走看看