Encrypt files using the method of modifying file time

Source: Internet
Author: User
Tags time interval

When it comes to file encryption, there are many methods, but there are some deficiencies in traditional file-type encryption methods. For example: The headache of the password technology, complex full text encryption/decryption algorithm, will produce a spam file technology and so on. Here I introduce a new way of encrypting files.

When you select a file in Win 95/98, you can view the properties of the file by clicking the right mouse button. The creation time, modification time, and access time of the file are listed. This information is generally set up by the operating system (that is, by dos/windows, etc.) automatically completed, will not allow users to easily modify. The use of this feature can be a very covert encryption technology.

Encryption principle

Replaces the original file time information with a specific time message.

Decryption principle

Gets the time information for the encrypted file to compare with the specific time information, if the same indicates that the file is legal, and if different, it is an expired or pirated software.

The above simple introduction of the file time attribute modification method, using this method can play a simple software encryption. For example, assuming that a software or game is stored with some archived files, the operating system automatically sets the file's modification time, so that a slightly experienced user can use the Find Files feature in Windows to find the file that was last modified. If the file is a file that records passwords or user information (as is the case in many cases), the consequences can be disastrous. Also, if you set the file creation, modification time, and access time appropriately, for example, keeping the three at a certain time interval can be a good way to encrypt. When running the main software, as long as the dynamic detection of the file time to meet the specific requirements of the software to know whether the expiration or belonging to pirated software, so as to achieve encryption and protection of software purposes, and will not produce garbage files.

The following is an introduction to the specific implementation methods

Using the FindFirst function in Delphi, we can get a file's property record, in which the FindData domain records the detailed file time information. The time information in FindData can not be directly obtained by using the Covfiledate function in this source program to convert the file time format. The time to set up a file is a bit more complicated, using the Datatimepicker component in Delphi to help complete this complex operation. You can use four Datatimepicker components to complete the setup of file creation time and modification time. Note: The access time for the file is replaced by the modified time. When using the following example, add four Datatimepicker components to your form. Kind is set to dtkdate in the first and third datatimepicker components, and kind is set to Dtktime,datemode in the second and fourth Datatimepicker components.

Note: The change of file time range is from September 19, 1792 A.D., the upper limit can reach A.D. 2999 or higher.

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.