천객만래 [千客萬來] (It has an interminable succession of visitors)

'License'에 해당되는 글 2건

  1. 2019.01.10 Rad Studio 라이센스 종류
  2. 2010.09.16 [C#] 라이선스용 컴퓨터 유일키 생성

RAD Studio에는 여러 라이센스 옵션이 있습니다.

  • 지명 사용자 라이센스 : 특정 개인에게 사용 권한을 부여 라이센스. 소프트웨어는 여러 대의 컴퓨터에 설치하여 사용할 수 있지만 동시에 사용할 수는 1 만입니다. 지명 사용자 라이센스를 여러 사용자가 공유하거나 양도 할 수 없습니다. 지명 사용자 라이센스를 사용하려면, EDN 계정 (E 메일 주소가 필요)를 작성해야합니다.
  • 네트워크 지명 (Network Named) 또는 네트워크 동시 (Network Concurrent) 라이센스 : 라이센스 서버 (Embarcadero License Server)에 의해 관리되는 라이센스. 네트워크 지명 사용자 라이센스는 조직의 사용자에게 할당하여 사용할 수 있습니다. 네트워크 동시 라이센스는 구입 한 라이센스 수 분의 조직의 불특정 다수가 동시에 사용할 수있는 라이센스입니다. 어떤 라이센스도 조직 내에 구축 된 라이센스 서버에 연결하는 네트워크 환경이 필요합니다.
  • Flexera FlexNet에 의해 관리되는 네트워크 라이센스 (일반 판매는하고 있지 않으므로 자세한 내용은 문의 바랍니다)
  • 아카데믹 라이센스 - 학생 개인의 학습을위한, 아카데믹 볼륨 라이선스 - 학교 교실 수업 교육을위한




RAD Studio 10.2 Tokyo는 다음 이전 버전의 라이센스를 사용할 수 있습니다.

  • Delphi 10.1 Berlin, Delphi 10 Seattle, Delphi XE8, Delphi XE7, Delphi XE6, Delphi XE5, Delphi XE4, Delphi XE3, Delphi XE2, Delphi XE, Delphi 2010 Delphi 2009, Delphi 2007, Delphi 7
  • C ++ Builder 10.1 Berlin, C ++ Builder 10 Seattle, C ++ Builder XE8, C ++ Builder XE7, C ++ Builder XE6, C ++ Builder XE5, C ++ Builder XE4, C ++ Builder XE3, C ++ Builder XE2, C ++ Builder XE, C ++ Builder 2010, C ++ Builder 2009, C ++ Builder 2007, C ++ Builder 6
  • HTML5 Builder XE3, RadPHP XE2, RadPHP XE

Posted by SB패밀리

[C#] 라이선스용 컴퓨터 유일키 생성

Introduction

For licensing purpose according to me the best way and secure way is to generate an unique key for client's machine and providing a corresponding license key for that key. For this purpose you can take help of the unique id of client's computer's motherboard, BIOS and processor's. When you get these IDs you can generate any key of your preferable format.

Year ago I found a very handy and useful code in C# by searching net to get these IDs. And its serving me perfectly so far. Thanks to the original author of the code.

I added some additional code to generate a 128 bit key of a machine. The output is a nice looking key in hexadecimal format (eg. 4876-8DB5-EE85-69D3-FE52-8CF7-395D-2EA9)

Suggestions

I have few suggestions on this regard.

*) Generate key from only Motherboard, Processor and BIOS. Since user normally doesn't chagne these parts.

*) Don't use MAC ID, Graphics Card ID AND Disk ID. Since its very common to change these devices.

*) It takes significant time to get IDs of devices. So make the finger print generating fucntion static and save it in a static variable so that it generates the key only for one time in the whole application.

The Code

Here is the class. The code in the region "Original Device ID Getting Code" is from the original author.

 ==============================================================================

using System;
using System.Management;
using System.Security.Cryptography;
using System.Security;
using System.Collections;
using System.Text;
namespace Security
{
    /// <summary>
    /// Generates a 16 byte Unique Identification code of a computer
    /// Example: 4876-8DB5-EE85-69D3-FE52-8CF7-395D-2EA9
    /// </summary>
    public class FingerPrint 
    {
        private static string fingerPrint = string.Empty;
        public static string Value()
        {
            if (string.IsNullOrEmpty(fingerPrint))
            {
                fingerPrint = GetHash("CPU >> " + cpuId() + "\nBIOS >> " + biosId() + "\nBASE >> " + baseId()
                            //+"\nDISK >> "+ diskId() + "\nVIDEO >> " + videoId() +"\nMAC >> "+ macId()
                                     );
            }
            return fingerPrint;
        }
        private static string GetHash(string s)
        {
            MD5 sec = new MD5CryptoServiceProvider();
            ASCIIEncoding enc = new ASCIIEncoding();
            byte[] bt = enc.GetBytes(s);
            return GetHexString(sec.ComputeHash(bt));
        }
        private static string GetHexString(byte[] bt)
        {
            string s = string.Empty;
            for (int i = 0; i < bt.Length; i++)
            {
                byte b = bt[i];
                int n, n1, n2;
                n = (int)b;
                n1 = n & 15;
                n2 = (n >> 4) & 15;
                if (n2 > 9)
                    s += ((char)(n2 - 10 + (int)'A')).ToString();
                else
                    s += n2.ToString();
                if (n1 > 9)
                    s += ((char)(n1 - 10 + (int)'A')).ToString();
                else
                    s += n1.ToString();
                if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-";
            }
            return s;
        }
        #region Original Device ID Getting Code
        //Return a hardware identifier
        private static string identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue)
        {
            string result = "";
            System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
            System.Management.ManagementObjectCollection moc = mc.GetInstances();
            foreach (System.Management.ManagementObject mo in moc)
            {
                if (mo[wmiMustBeTrue].ToString() == "True")
                {
                    //Only get the first one
                    if (result == "")
                    {
                        try
                        {
                            result = mo[wmiProperty].ToString();
                            break;
                        }
                        catch
                        {
                        }
                    }
                }
            }
            return result;
        }
        //Return a hardware identifier
        private static string identifier(string wmiClass, string wmiProperty)
        {
            string result = "";
            System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
            System.Management.ManagementObjectCollection moc = mc.GetInstances();
            foreach (System.Management.ManagementObject mo in moc)
            {
                //Only get the first one
                if (result == "")
                {
                    try
                    {
                        result = mo[wmiProperty].ToString();
                        break;
                    }
                    catch
                    {
                    }
                }
            }
            return result;
        }
        private static string cpuId()
        {
            //Uses first CPU identifier available in order of preference
            //Don't get all identifiers, as very time consuming
            string retVal = identifier("Win32_Processor", "UniqueId");
            if (retVal == "") //If no UniqueID, use ProcessorID
            {
                retVal = identifier("Win32_Processor", "ProcessorId");
                if (retVal == "") //If no ProcessorId, use Name
                {
                    retVal = identifier("Win32_Processor", "Name");
                    if (retVal == "") //If no Name, use Manufacturer
                    {
                        retVal = identifier("Win32_Processor", "Manufacturer");
                    }
                    //Add clock speed for extra security
                    retVal += identifier("Win32_Processor", "MaxClockSpeed");
                }
            }
            return retVal;
        }
        //BIOS Identifier
        private static string biosId()
        {
            return identifier("Win32_BIOS", "Manufacturer")
            + identifier("Win32_BIOS", "SMBIOSBIOSVersion")
            + identifier("Win32_BIOS", "IdentificationCode")
            + identifier("Win32_BIOS", "SerialNumber")
            + identifier("Win32_BIOS", "ReleaseDate")
            + identifier("Win32_BIOS", "Version");
        }
        //Main physical hard drive ID
        private static string diskId()
        {
            return identifier("Win32_DiskDrive", "Model")
            + identifier("Win32_DiskDrive", "Manufacturer")
            + identifier("Win32_DiskDrive", "Signature")
            + identifier("Win32_DiskDrive", "TotalHeads");
        }
        //Motherboard ID
        private static string baseId()
        {
            return identifier("Win32_BaseBoard", "Model")
            + identifier("Win32_BaseBoard", "Manufacturer")
            + identifier("Win32_BaseBoard", "Name")
            + identifier("Win32_BaseBoard", "SerialNumber");
        }
        //Primary video controller ID
        private static string videoId()
        {
            return identifier("Win32_VideoController", "DriverVersion")
            + identifier("Win32_VideoController", "Name");
        }
        //First enabled network card ID
        private static string macId()
        {
            return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled");
        }
        #endregion
    }
}

Posted by SB패밀리