Design and Implementation of license verification mechanism in ERP framework development (including source code download)

Source: Internet
Author: User
Tags modulus intel pentium

The licensing mechanism is an essential part of the ERP framework. It can effectively protect framework resources from being applied within the scope of authorization and increase the return on investment. After studying several types of license mechanisms (serial number registration code, online web service verification, and license file authorization), we finally selectAlgorithmAs the main technical implementation of the license mechanism.

The main objectives are as follows:

1. You can implement version control. The Enterprise Edition can use all features. The Professional edition can only use some features. The Personal Edition is free of charge, but has fewer feature sets.

Public Enum version {enterprise, professional, personal}

2. Function Control: online user quantity control, account set quantity control, hardware verification control, trial expiration control, and virtual machine control.

    • The number of online users can be controlled at the same time. If the number of online users exceeds the permitted quantity, they cannot log on.
    • For example, you can create only 10 sets of accounts. If the limit is exceeded, you cannot log on.
    • When the hardware verification control generates a license file, it binds hardware information (hard disk, CPU, memory, and motherboard). The license file generated based on this hardware information cannot be run on another computer, to control the number of users.
    • If the expiration time of the trial is exceeded, the system is stopped. This effectively prevents unauthorized users from continuing to use the trial and revoking investment.
    • Virtual Machine control because it is very easy to install and restore the operating system in the virtual machine, we often use this to try the software. When the software trial expires, we want to continue using it, you only need to restore the system in the virtual machine, you can continue to experience. The control software cannot run on a virtual machine. Common virtual machines are vmware workstation and Virtual PC.

In this theory, design the license. Lic file in the following format as the license file to be issued.

 

InProgramDuring the compilation process, refer toArticle

Using XML digital signatures for application licensing-codeproject
Http://www.codeproject.com/Articles/4940/Using-XML-Digital-Signatures-for-Application-Licen

This article is almost customized to achieve the above goals. The following are some actual problems for your reference.

1. The order of elements in the XML sequence. I learned from Google that please read the following paragraphs carefully.

Xmlserializer takes all fields in the order that they are declared.
The Order Problem on the Compact framework. Unfortunately, this is by design.

The order of elements serialized by the netcf XML serializer is not
Guaranteed to match that of the desktop. There is nothing in the generated
Schema class included in the attached project that specifies the order
The elements.

In order to accomplish this You shoshould Add the/order option to xsd.exe and
Then regenerate the schema class
(Xsd.exe/order/C Foo. XSD)

By doing this all the particle members will have their explicit order
Identifiers and then the serializer will honor the order of the schema.
New schema generated by with the/order switch will have the orders
Property specified on the xmlelementattribute
E.g. [system. xml. serialization. xmlelementattribute (Order = 2)]

XML serialization is in the order of element declarations, but the compack framework is different. You need to manually specify the order of them.

 

2. Integration and binding of hardware information

This should be a name-value pair, such

CPU: Intel Pentium t440

Hard DRIVER: WD Elements

Therefore, you need to design a list

Public StructHardwareinfo {Public StringHardwareid {Get; set ;}Public StringDescription {Get; Set ;}}

This list <t> must be serializable. It must be bound to the license. Lic file.

 

In type 3, some objects do not need to be serialized. tags must be added to prevent serialization.

 
[Nonserialized]Private String_ Hashvalue;

4. Generate a public key pair with the private key and place it inCode. The generated content is as follows:

   Public   Static   String Privatekey {get { Return  "<Bitstrength> 1024 </bitstrength> <rsakeyvalue> <modulus> Limit + 0qfyntzxpqq29mqv + 8 muiugn/quota = </modulus> <exponent> aqab </exponent> <p frequency ++ 65jtxyp0lvigh + forward/+ j6amw ==</P> <q> forward ==</q> <DP> tiykhgvjthsqnc1/forward + ztzypgb6rw ==</dp> <DQ> RR/bykl75y/u9tqa4mkwbvlnnpzd7/records ==</DQ> <inverseq> zzu/logs/records ==</inverseq> <D> records + vugqj/logs/vcdvqe1qh/records + ceirgewspnk = </D> </rsakeyvalue>";}} Public   Static   String Publickey {get { Return   "<Bitstrength> 1024 </bitstrength> <rsakeyvalue> <modulus> Limit + 8 muiugn/Limit = </modulus> <exponent> aqab </exponent> </rsakeyvalue>" ;}}

The public key can only be used to verify the license file. The private key can be used for verification, but is mainly used to generate the XML file signature.

 

5. Note that the last section of the license file contains the bound hardware information, which is encrypted. For decryption purposes, the RSA algorithm is used here. This process is as follows: the user tries the software, applies for the license file, and gives the user an EXE file program to generate hardware. ID file, and then the user sends this file to the software company. The software company issues a trial license file to the user based on this file.

 StringHardware = rsacryptionhelper. encryptstring (inputstring, publickey );

An exception is reported when the user obtains the permission to bind hardware information to another computer.

 If(Configuration. Items. Count = 0 )&&(This. Licensetype = licensetype. Enterprise )){Throw NewLicenseexception ("Hardware fingerprint is missing in license file");}

 

6. License type

 
Public EnumLicensetype {internal, enterprise, professional, personal}

All types of licenses expire and cannot run after the specified expireddate in the license. Therefore, the trial type is not allowed.

I have a database tool software and a trial period of over 800 days. I can use it for more than 2 years. The IT industry is a traditional technology with 10 years of development, C #. net winforms technology is still widely used and advanced. A large number of new technologies and new knowledge are injected into this industry.

In 2 years, you can do a lot of things, read a lot of books, take a lot of steps, and read and write.

 

7. The main point of signed XML technology is to view in plain text, but it can prevent tampering. You can't change it to 2100-5-30. Now you can change it after 100. This enterprise can no longer charge you for it. How can we support programmers.

However, there are two pieces of software that can be done one by tampering with the current time of the system and then injecting it into your process. Recommendation software runasdate. The software is powerful. You can set the current time and start the software. If you try a good software and do not want to pay for it, you can try this method if you cannot find the cracker or key.

 
 

8 expirydate is, but on this day, the user changed the time back to, and can continue the trial for another month. You must also handle this problem. You do not need to deal with MIS/ERP software. One of the main requirements for data is accuracy. Now it is No. 5-2. You should change the time back to No. 4-2 and continue to use the software. The system's journal Time is No. 4-2. This is a serious problem in future account checking. The warehouse receiving ticket No. 5 corresponds to the document No. 4 and No. 2 in the system, which is inconvenient to track.

If you want to control the user's modification time, remember the first time the user uses the system. If you find the user's system time, an error is reported directly and the user exits unexpectedly.

    issueddate  > 2013-04-30t10: 58: 52.5456701 + 08: 00    issueddate  >    expirydate  > 2013-05-30t23: 59: 59.997    expirydate  > 

 

Download from the following webpage:Source codeFor your reference.

Using XML digital signatures for application licensing-codeproject

Http://www.codeproject.com/Articles/4940/Using-XML-Digital-Signatures-for-Application-Licen

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.