Hardware and software setup

Modern encryption algorithms. Data Encryption Methods - web programmer's blog

Basic concepts and definitions

As education information society the technical means of total surveillance of millions of people become available to large states. Therefore, cryptography is becoming one of the main tools that provide confidentiality, trust, authorization, electronic payments, corporate security and other important things.

The problem of protecting information by transforming it is dealt with cryptology , which is divided into two directions: cryptography and cryptanalysis . The goals of these directions are directly opposite.

Cryptography engaged in the search and study of mathematical methods of information transformation. Area of ​​interest cryptanalysis– study of the possibility of decrypting information without knowing the keys.

Modern cryptography includes 4 main sections:

1. Symmetric cryptosystems.

2. Cryptosystems with a public key.

3. Systems electronic signature.

4. Key management.

The main directions of using cryptographic methods are the transfer of confidential information over communication channels, the authentication of transmitted messages, and the storage of information on media in encrypted form.

Cryptography makes it possible to transform information in such a way that its reading (restoration) is possible only if the key is known. As information to be encrypted and decrypted, texts built on a certain alphabet will be considered.

Alphabet is a finite set of signs used to encode information. Examples:

ü alphabet Z33 - contains 32 letters of the Russian alphabet and a space;

ü alphabet Z256 - characters included in standard ASCII and KOI-8 codes;

ü binary alphabet Z2 – two symbols (0 and 1);

ü octal or hexadecimal alphabets.

Text is an ordered set of elements of the alphabet.

Encryption– transformational process of replacing the original (plain) text with cipher text.

Decryption(reverse encryption) is a transformational process of replacing, based on the key, the cipher text with the plain text.

Key– information necessary for the smooth encryption and decryption of texts.

Cryptographic system is a family of T [T 1 , T 2 , ..., T to ] plaintext transformations. Members of this family are indexed or denoted by the symbol To; parameter To is the key. The key space K is the set of possible key values. Usually the key is a sequence of alphabetic characters.

Cryptosystems are divided into symmetrical and asymmetric . V symmetric cryptosystems The same key is used for both encryption and decryption. V asymmetric systems (public key) two keys are used - public and private, which are mathematically related to each other. Information is encrypted using a public key, which is available to everyone, and decrypted using a private key, known only to the recipient of the message.

Terms key distribution and key management refer to information processing processes, the content of which is the compilation of keys and their distribution among users.

Electronic (digital) signature its cryptographic transformation is called appended to the text, which allows, upon receipt of the text by another user, to verify the authorship and authenticity of the message.

Crypto resistance is called a cipher characteristic that determines its resistance to decryption without knowing the key (ie resistance to cryptanalysis). There are several indicators of cryptographic strength:

the number of all possible keys;

average time required for cryptanalysis.

Requirements for cryptosystems

The process of cryptographic closing of data can be carried out both in software and in hardware. The hardware implementation is significantly more expensive, but it has high performance, simplicity, and security. Software implementation more practical, allows a certain flexibility in use.

Common requirements for cryptographic systems:

The encrypted message must be readable only if the key is present.

· the number of operations required to determine the used key from the fragment of the encrypted message and the corresponding plaintext must not be less than the total number of possible keys;

The number of operations required to decrypt information by searching possible keys must have a strict lower bound and go beyond the limits modern computers(taking into account the possibilities of network computing);

knowledge of the encryption algorithm should not affect the reliability of protection;

a slight change in the key should lead to a significant change in the type of the encrypted message;

Structural elements of the encryption algorithm must be unchanged;

additional bits introduced into the message during the encryption process must be completely and securely hidden in the ciphertext;

The length of the ciphertext must be equal to the length of the original text;

· there should be no simple and easily established dependencies between the keys sequentially used in the encryption process;

any key from the set of possible ones should provide reliable protection of information;

The algorithm should allow both software and hardware implementation, while changing the key length should not lead to a qualitative deterioration of the encryption algorithm.

Basic Encryption Algorithms

The encryption-decryption method is called cipher . The key used for decryption may not be the same as the key used for encryption, but in most algorithms the keys are the same.

Algorithms using a key are divided into two classes: symmetrical (with secret key) and asymmetrical (with public key). Symmetric algorithms use the same key for encryption and decryption, or the decryption key is simply computed from the encryption key. Asymmetric algorithms use different keys and the decryption key cannot be calculated from the encryption key.

Symmetric Algorithms are divided into stream ciphers and block ciphers. Streaming allows you to encrypt information bit by bit, while block ones work with a certain set of data bits ( usually the block size is 64 bits) and encrypt this set as a whole.

Typically, the encryption key is a file or data array and is stored on a personal key carrier (for example, a flash drive or smart card); it is mandatory to take measures to ensure that the personal key carrier is not available to anyone other than its owner.

Authenticity is ensured due to the fact that without preliminary decryption it is practically impossible to carry out semantic modification and forgery of a cryptographically closed message. A fake message cannot be properly encrypted without knowing the secret key.

Data integrity is ensured by attaching a special code to the transmitted data ( imitation inserts ) generated by the secret key. Imitation insertion is a kind of checksum, i.e. some reference characteristic of the message, according to which the integrity of the latter is checked. The algorithm for generating an imitation insert must ensure its dependence, according to some complex cryptographic law, on each bit of the message. The message integrity check is performed by the recipient of the message by generating, from the secret key, an inlay imitation corresponding to the received message and comparing it with the received inlay imitation value. If there is a match, it is concluded that the information was not modified on the way from the sender to the recipient.

Symmetric encryption is ideal for encrypting information "for yourself", for example, in order to prevent unauthorized access to it in the absence of the owner. I have a high encryption speed, single-key cryptosystems allow solving many important problems of information protection. but offline use symmetric cryptosystems in computer networks gives rise to the problem of distribution of encryption keys between users.

Before starting the exchange of encrypted data, it is necessary to exchange secret keys with all recipients. The transfer of the secret key of a symmetric cryptosystem cannot be carried out via public communication channels, the secret key must be transferred to the sender and recipient via a secure channel (or with the help of a courier). To ensure effective protection of messages circulating in the network, a huge number of frequently changing keys (one key for every pair of users) is necessary. The problem of distributing secret keys with a large number of users is a very time-consuming and complex task. In a network for N users, it is necessary to distribute N (N-1) / 2 secret keys.

Asymmetric ciphers allow the public key to be available to everyone (for example, published in a newspaper). This allows anyone to encrypt a message. However, only the user who owns the decryption key can decrypt this message. The encryption key is called public key , and the decryption key is private key or secret key .

The private and public keys are generated in pairs. The secret key must remain with its owner and be securely protected from unauthorized access (similar to the encryption key in symmetric algorithms). A copy of the public key must be kept by each subscriber of the cryptographic network with whom the owner of the secret key exchanges information.

Public-key cryptographic systems use the so-called irreversible or one-way functions that have the following property: for a given value X relatively easy to calculate f(x), however, if yM = j(x), then there is no easy way to calculate the value X. The set of classes of irreversible functions generates all the variety of public key systems.

The process of transferring encrypted information in an asymmetric cryptosystem is carried out as follows.

Preparatory stage :

· subscriber B generates a pair of keys: secret key k in and public key K in;

public key Kb is sent to subscriber A and other subscribers (or made available, for example, on a shared resource).

Usage ( exchange of information between A and B ):

subscriber A encrypts the message using the public key K to subscriber B and sends the ciphertext to subscriber B;

· subscriber B decrypts the message using his secret key k in; no one else can decipher this message, because does not have the secret key of subscriber B.

Information protection in an asymmetric cryptosystem is based on the secrecy of the key k in the recipient of the message.

Advantages asymmetric cryptographic systems before symmetric cryptosystems:

ü in asymmetric cryptosystems, the complex problem of distributing keys between users is solved, since each user can generate their own key pair, and users' public keys can be freely published and distributed network communications;

ü the quadratic dependence of the number of keys on the number of users disappears; in an asymmetric cryptosystem, the number of keys used is related to the number of subscribers by a linear relationship (in a system of N users, 2N keys are used), and not quadratic, as in symmetric systems;

ü asymmetric cryptosystems allow you to implement protocols for the interaction of parties that do not trust each other, since when using asymmetric cryptosystems private key should be known only to its owner.

Flaws asymmetric cryptosystems:

u on currently there is no mathematical proof of the irreversibility of functions used in asymmetric algorithms;

ü asymmetric encryption is significantly slower than symmetric encryption, since very resource-intensive operations are used during encryption and decryption; for the same reason, it is much more difficult to implement a hardware encoder with an asymmetric algorithm than to implement a hardware-symmetric algorithm;

ü the need to protect public keys from substitution.

Modern encryption-decryption algorithms are quite complex and cannot be performed manually. True cryptographic algorithms are designed for use by computers or special hardware devices. In most applications, cryptography is produced by software and there are many cryptographic packages available.

Symmetric algorithms are faster than asymmetric ones. In practice, both types of algorithms are often used together: a public key algorithm is used to transmit a randomly generated secret key, which is then used to decrypt a message.

Many high-quality cryptographic algorithms are widely available. The best known symmetric algorithms are DES and IDEA; the best asymmetric algorithm is RSA. In Russia, GOST 28147-89 is adopted as the encryption standard.

Table 1 shows the classification of cryptographic closing of information.

Table 1

Types of conversion Transformation methods Varieties of the method Way of implementation
Encryption Replacement (substitution) Simple (single-alphabetic) Program
Polyalphabetic single-circuit ordinary Program
Multi-alphabetic single loop monophonic Program
Program
Permutation Simple Program
Complicated according to the table Program
Complicated on routes Program
Analytic transformation According to the rules of matrix algebra Program
For special dependencies Program
Gambling With finite short scale App.-prog.
With finite long gamma App.-prog.
With an endless range App.-prog.
Combined Replacement + permutation App.-prog.
Replacement + gamming App.-prog.
Permutation+gaming App.-prog.
Gambling+gamming App.-prog.
Coding semantic According to special tables (dictionaries) Program
Symbolic By code alphabet Program
Other types cut-explode semantic App.-prog.
Mechanical Program
Compression-expansion

I. Under encryption this type of cryptographic closure is understood, in which each character of the protected message is subjected to transformation.

All known encryption methods can be divided into five groups: substitution (substitution), permutation, analytical transformation, gamma and combined encryption. Each of these methods can have several varieties.

Varieties of the method replacement (substitution ):

1) Simple (single-alphabetic) - the characters of the encrypted text are replaced by other characters of the same alphabet. If the amount of ciphertext is large, then the frequency of occurrence of letters in the ciphertext will be closer to the frequency of occurrence of letters in the alphabet (of the language in which the text is written) and decryption will be very simple. This method now rarely used and in cases where the ciphertext is short.

2) Polyalphabetic substitution - the simplest type of transformation, which consists in replacing the characters of the source text with characters from other alphabets according to a more or less complex rule. To ensure high cryptographic strength, the use of large keys is required.

At multi-alphabetic single-circuit ordinary In substitution, several alphabets are used to replace the characters of the source text, and the alphabet is changed sequentially and cyclically, i.e. the first character is replaced by the corresponding character of the first alphabet, the second by the character of the second alphabet, and so on. until all selected alphabets have been used. After that, the use of alphabets is repeated.

feature multi-alphabetic single-loop monophonic substitution is that the number and composition of alphabets are chosen in such a way that the frequencies of occurrence of all characters in the ciphertext are the same. In this situation, the cryptanalysis of the ciphertext with the help of its statistical processing becomes more difficult. Alignment of the frequency of occurrence of characters is achieved due to the fact that for frequently occurring characters of the source text, a larger number of replacement elements are provided than for rarely occurring ones.

Polyalphabetic multiloop substitution consists in the fact that several sets (circuits) of alphabets are used for encryption, which are used cyclically, and each circuit in the general case has its own individual application period. This period is calculated, as a rule, by the number of characters, after the encryption of which the contour of the alphabets changes.

Way permutations - a simple way of cryptographic transformation. It is usually used in combination with other methods. This method consists in the fact that the characters of the encrypted text are rearranged according to certain rules inside the encrypted block of characters. All procedures for encryption and decryption by the permutation method are sufficiently formalized and can be implemented algorithmically.

Encryption by simple permutation is carried out as follows:

a keyword with non-repeating characters is selected;

the cipher text is written in successive lines under the symbols keyword;

· the ciphertext is written out in columns in the sequence in which the letters of the key are arranged in the alphabet (or in the order of the numbers in the natural row, if it is digital).

Example:

plain text: BE CAREFUL

key: 5 8 1 3 7 4 6 2

encryption scheme:

STAY q O (where q is a space)

CAUTION

We group by 2 characters and get the ciphertext:

DOOYREZHBSqNTOUT

The disadvantage of simple permutation encryption is that if the length of the ciphertext is large, the ciphertext may show patterns in the key characters. To eliminate this shortcoming, you can change the key after encrypting a certain number of characters. With a sufficiently frequent change of the key, the strength of the encryption can be significantly increased. This, however, complicates the organization of the process of encryption and decryption.

Complicated table permutation lies in the fact that to write the characters of the encrypted text is used special table, in which some complicating elements are introduced. The table is a matrix, the size of which can be chosen arbitrarily. In it, as in the case of a simple permutation, the characters of the encrypted text are written. The complication lies in the fact that a certain number of table cells are not used. Quantity and location unused elements is an additional encryption key. Encrypted text in blocks of ( m x nS) elements is written to the table ( m x n- table dimensions, S- number of unused elements). Further, the encryption procedure is similar to a simple permutation.

By varying the size of the table, the sequence of key symbols, the number and arrangement of unused elements, it is possible to obtain the required strength of the ciphertext.

Complicated permutation of routes has a high encryption strength, uses a complicated method of permutations along Hamiltonian-type routes. In this case, the vertices of some hypercube are used to write the characters of the ciphertext, and the characters of the ciphertext are calculated along Hamiltonian routes, and several different routes are used.

Encryption method using analytic transformations provides a sufficiently reliable closure of information. To do this, you can apply the methods of matrix algebra, for example, multiplication of a matrix by a vector. If the matrix is ​​used as a key, and instead of the vector component, the characters of the source text are substituted, then the components of the resulting vector will be the characters of the ciphertext. Decryption is carried out using the same rule for multiplying a matrix by a vector, only the matrix is ​​taken as the basis, the inverse of the one with which the closure is performed, and the corresponding number of characters of the closed text is taken as the multiplier vector. The values ​​of the result vector will be the digital equivalents of the plaintext characters.

Gambling- this method consists in imposing on the source text some pseudo-random sequence generated based on the key. The procedure for applying gamma to the source text can be carried out in two ways. V first way the original text and gamma characters are replaced by their digital equivalents, which are then added modulo TO, where K is the number of characters in the alphabet, i.e.

t c = (t p + t g) mod K, where tc, tp,t g - ciphertext, plaintext, and gamma characters, respectively.

In the second method, the characters of the source text and gamma are represented as a binary code, and then the corresponding digits are added modulo 2. Instead of modulo 2 addition, other logical operations can be used during gamma, for example, transformation according to the rule of logical equivalence or logical non-equivalence. Such a replacement is tantamount to introducing another key, which is the choice of a rule for forming the characters of the encrypted message from the characters of the source text and gamma.

The strength of encryption by the gamma method is determined mainly by the properties of the gamma - the duration of the period and uniformity statistical characteristics. The last property ensures that there are no regularities in the appearance of various symbols within a period.

With good statistical properties of the gamma, the encryption strength is determined only by the length of its period. Moreover, if the length of the gamma period exceeds the length of the encrypted text, then such a cipher is theoretically absolutely secure. Any sequence of random symbols can be used as an infinite gamma, for example, a sequence of digits of the number PI. When encrypting with a computer, the gamma sequence is formed using a pseudo sensor random numbers.

Combined encryption methods use several at the same time various ways, i.e. sequential encryption of the plaintext using two or more methods. This is enough effective tool improving the strength of encryption.

A typical example of a combined cipher is the US National Cryptographic Data Enclosure Standard (DES).

II. Under coding this type of cryptographic closure is understood when some elements of the protected data (these are not necessarily individual characters) are replaced by pre-selected codes (numeric, alphabetic, alphanumeric combinations, etc.).

This method has two varieties: semantic and character encoding. At semantic coding encoded elements have a well-defined meaning (words, sentences, groups of sentences). At character encoding each character of the protected message is encoded. Symbolic encoding is essentially the same as substitution encryption.

At correct use codes are much harder to break than other classical systems. This is due to three reasons. Firstly, the large length of the code used (for encryption - several hundred bits; code book - hundreds of thousands - a million bits). Secondly, codes remove redundancy - the work of a cryptanalyst is complicated. Thirdly, codes operate on relatively large blocks of plaintext (words and phrases) and therefore hide local information that, in otherwise, could provide valuable "hooks" for a cryptanalyst.

TO shortcomings coding should be attributed to the fact that the key is not used well enough during coding, tk. when encoding a single word and phrase, only a very small part of the code book is used. As a result, the code, when used intensively, lends itself to partial analysis and turns out to be especially sensitive to attack in the presence of known plaintext. For these reasons, codes need to be changed more frequently to ensure greater reliability.

III. other methods cryptographic closures include slicing/spreading and data compression. Slicing/Expanding Data consists in the fact that the array of protected data is divided into such elements, each of which does not allow revealing the content of the protected information, and the elements allocated in this way are placed in different memory zones. The reverse procedure is called data collection. It is quite obvious that the data scatter and reassembly algorithm must be kept secret.

Data compression represents the replacement of frequently occurring identical data strings or sequences of identical characters with some pre-selected characters.

Hash functions

hash function is a one-way function designed to obtain a digest or "fingerprint" of a file, message, or some block of data.

Initially, hashing functions were used as functions for creating a unique image of information sequences of arbitrary length in order to identify and determine their authenticity. The image itself must be a small fixed-length block, typically 30, 60, 64, 128, 256, or 512 bits. Therefore, sorting search operations and others with large arrays or databases are greatly simplified, i.e. take much less time. To ensure the required error probability, it is necessary to provide a number of requirements for the hash function:

· the hash function must be sensitive to all kinds of changes in the text M, such as insertions, emissions, permutations;

the hash function must have the property of irreversibility, that is, the problem of selecting a document M ", which would have the required hash function value, must be computationally unsolvable;

· the probability that the values ​​of the hash functions of two different documents (regardless of their lengths) will match must be negligible.

These requirements can be met a large number of existing mathematical functions. If these functions are used for sorting, searching, etc. However, later, based on the work of Simonson on the theory of authentication, it became clear the expediency of using hashing methods in message authentication schemes in communication channels and telecommunication systems. In this connection, a number of directions have been opened in research in the field of cryptography, which are associated with the development of new and improvement of existing hash functions. The main idea of ​​using hashing functions is to obtain one-way functions based on them, which are the main product for the development of modern cryptographic mechanisms and authentication methods.
Let's look at the basic concepts regarding one-way hash functions.

Most hash functions are built around a one-way function f( ), which produces an output value of length n when given two input values ​​of length n. These inputs are the source block Mi and hash value Hi–1 the previous block of text (Fig. 1):

Hi = f (Mi, Hi–1).

The hash value calculated when the last block of text is entered becomes the hash value of the entire message M.

Fig.1. Diagram of a one-way hash function

As a result, a one-way hash function always produces an output of fixed length n (regardless of the length of the input text). The hashing algorithm is iterative, so hash functions are also called iterative algorithms. The essence of the hashing algorithm lies in its one-sidedness, i.e. the function should work in one direction - compress, mix and disperse, but never restore. Such schemes allow you to track changes in source texts, which is to ensure data integrity, and in algorithms digital signature still ensure the authenticity of the data. However, in their pure form, these functions do not allow confirmation of authenticity.


Encryption is the most widely used cryptographic method for maintaining the confidentiality of information, it protects data from unauthorized access to them. To begin with, consider the main methods of cryptographic information protection. In a word, cryptography- the science of information security using mathematical methods. There is also a science opposite to cryptography and devoted to methods of opening protected information - cryptanalysis. The combination of cryptography and cryptanalysis is called cryptology. Cryptographic methods can be classified in various ways, but most often they are subdivided depending on the number of keys used in the corresponding cryptographic algorithms (see Fig. 1):

  1. Keyless, which does not use any keys.
  2. Single-key - they use some additional key parameter - usually this is a secret key.
  3. Two-key, using two keys in their calculations: secret and public.

Rice. 1. Crypto algorithms

Overview of cryptographic methods

Encryption is the main method of protection; we will consider it in detail further.

It is worth saying a few words about other cryptographic methods:

  1. An electronic signature is used to confirm the integrity and authorship of data. Data integrity means that data has not been accidentally or intentionally altered during storage or transmission.
    Electronic signature algorithms use two types of keys:
    • the secret key is used to calculate the electronic signature;
    • the public key is used to verify it.
    When using a cryptographically strong electronic signature algorithm and with proper storage and use of the secret key (that is, if the key cannot be used by anyone other than its owner), no one else is able to calculate the correct electronic signature of any electronic document.
  2. Authentication allows you to verify that the user (or remote computer) is really who he claims to be. The simplest scheme authentication is password - as a secret element it uses a password that is presented by the user when checking it. Such a scheme has been proven to be weak if special administrative and technical measures are not applied to strengthen it. And on the basis of encryption or hashing (see below), you can build really strong user authentication schemes.
  3. There are various methods of cryptographic checksumming:
    • key and keyless hashing;
    • calculation of imitation prefixes;
    • use of message authentication codes.
    In fact, all these methods in various ways from data of arbitrary size, with or without a secret key, calculate a certain checksum of a fixed size that uniquely corresponds to the original data.
    Such cryptographic checksumming is widely used in various information security methods, for example:
    • to confirm the integrity of any data in cases where the use of an electronic signature is impossible (for example, due to high resource intensity) or is redundant;
    • in the electronic signature schemes themselves, it is usually the hash of the data that is "signed", and not the entire data;
    • v various schemes user authentication.
  4. Random and pseudo-random number generators allow you to create sequences of random numbers that are widely used in cryptography, in particular:
    • random numbers are needed to generate secret keys, which, ideally, should be completely random;
    • random numbers are used in many electronic signature algorithms;
    • Random numbers are used in many authentication schemes.
    It is not always possible to obtain absolutely random numbers - this requires the availability of high-quality hardware generators. However, based on symmetric encryption algorithms, high-quality pseudo-random number generators can be built.
Encryption

Encryption information is the transformation of open information into encrypted information (which is most often called ciphertext or cryptogram), and vice versa. The first part of this process is called encryption, second - decryption.

Encryption can be represented as the following formula:

С = E k1 (M),

where:
M(message) - open information,
WITH(cipher text) - the ciphertext obtained as a result of encryption,
E(encryption) - an encryption function that performs cryptographic transformations on M,
k1(key) - function parameter E, called key encryption.

In the GOST 28147-89 standard (the standard defines the domestic symmetric encryption algorithm), the concept key defined as follows: "A specific secret state of some parameters of a cryptographic transformation algorithm, which ensures the choice of one transformation from the set of transformations possible for a given algorithm."

The key may belong to a specific user or group of users and be unique for them. Information encrypted using a particular key can only be decrypted using the same key or a key associated with it by a certain ratio.

Decryption can be presented in a similar way:

M" = D k2 (C),

where:
M"- the message received as a result of decryption,
D(decryption) - decryption function; just like the encryption function, it performs cryptographic transformations on the ciphertext,
k2- decryption key.

To obtain the correct plaintext as a result of decryption (that is, the one that was previously encrypted: M "= M), the following conditions must be simultaneously met:

  1. The decryption function must match the encryption function.
  2. The decryption key must match the encryption key.

In the absence of the correct key k2 get original message M" = M with the right function D impossible. The word "impossible" in this case usually means the impossibility of calculating for real time with existing computing resources.

Encryption algorithms can be divided into two categories (see Figure 1):

  1. Symmetric encryption algorithms.
  2. Asymmetric encryption algorithms.

In algorithms symmetric encryption decryption usually uses the same key as for encryption, or a key related to it by some simple relationship. The latter is much less common, especially in modern encryption algorithms. Such a key (common for encryption and decryption) is usually called simply encryption key.

V asymmetric encryption encryption key k1 easily calculated from the key k2 in such a way that the reverse calculation is not possible. For example, the key relationship might be:

k1 = a k2 mod p,

where a and p are the parameters of the encryption algorithm, which have a sufficiently large dimension.

This key ratio is also used in electronic signature algorithms.

The main characteristic of the encryption algorithm is cryptographic strength, which determines its resistance to disclosure by cryptanalysis methods. Usually this characteristic is determined by the time interval necessary for the disclosure of the cipher.

Symmetric encryption is less convenient due to the fact that when transmitting encrypted information, someone needs the recipient to receive a key in advance to decrypt the information. Asymmetric encryption does not have this problem (since the public key can be freely transferred over the network), however, it has its own problems, in particular, the problem of replacing the public key and slow speed encryption. Most often, asymmetric encryption is used in conjunction with symmetric encryption - to transfer the symmetric encryption key, which encrypts the bulk of the data. However, key storage and transmission schemes are a topic for a separate article. Here I will allow myself to assert that symmetric encryption is used much more often than asymmetric encryption, so the rest of the article will be devoted only to symmetric encryption.

There are two types of symmetric encryption:

  • Block encryption- the information is divided into blocks of a fixed length (for example, 64 or 128 bits), after which these blocks are encrypted one by one. Moreover, in various encryption algorithms or even in different modes blocks of the same algorithm can be encrypted independently of each other or "with concatenation" - when the result of encryption of the current data block depends on the value of the previous block or on the result of encryption of the previous block.
  • Stream Encryption- it is necessary, first of all, in cases where information cannot be divided into blocks - say, a certain data stream, each character of which must be encrypted and sent somewhere, without waiting for the rest of the data sufficient to form a block. Therefore, stream encryption algorithms encrypt data bit by bit or character by character. Although it is worth saying that some classifications do not separate block and stream encryption, considering that stream encryption is the encryption of blocks of unit length.

Consider how block symmetric encryption algorithms look from the inside. The structure of encryption algorithms

Overwhelming majority modern algorithms encryptions work in a very similar way: a certain transformation is performed on the encrypted text with the participation of the encryption key, which is repeated a certain number of times (rounds). At the same time, according to the type of repeated transformation, encryption algorithms are usually divided into several categories. There are also various classifications here, I will give one of them. So, according to their structure, encryption algorithms are classified as follows:

  1. Algorithms based on the Feistel network.

    The Feistel network involves splitting the processed data block into several subblocks (most often into two), one of which is processed by some function f() and superimposed on one or more other sub-blocks. On fig. 2 shows the most common structure of algorithms based on the Feistel network.

    Rice. 2. The structure of algorithms based on the Feistel network.

    Additional function argument f(), indicated in Fig. 2 as Ki, is called round key. The round key is the result of processing the encryption key by the key expansion procedure, the task of which is to obtain the required number of keys Ki from the initial encryption key of a relatively small size (at present, a size of 128 bits is considered sufficient for a symmetric encryption key). In the simplest cases, the key expansion procedure simply splits the key into several fragments, which are used in turn in encryption rounds; much more often, the key expansion procedure is rather complicated, and the keys Ki depend on the values ​​of most bits of the original encryption key.

    The superimposition of the processed subblock on the raw one is most often performed using the logical operation "exclusive or" - XOR (as shown in Fig. 2). Quite often, instead of XOR, modulo addition is used here 2n, where n- subblock size in bits. After the overlap, the subblocks are swapped, that is, in the next round of the algorithm, another subblock of data is processed.

    This structure of encryption algorithms got its name from Horst Feistel, one of the developers of the Lucifer encryption algorithm and the DES (Data Encryption Standard) algorithm developed on its basis, the former (but still widely used) US encryption standard. Both of these algorithms have a structure similar to that shown in Fig. 2. Among other algorithms based on the Feistel network, one can cite as an example domestic standard GOST 28147-89 encryption, as well as other well-known algorithms: RC5, Blowfish, TEA, CAST-128, etc.

    Most modern encryption algorithms are based on the Feistel network - due to the many advantages of such a structure, among which the following are worth noting:

    • Algorithms based on the Feistel network can be designed in such a way that the same algorithm code can be used for encryption and decryption - the difference between these operations can only consist in the order in which the keys Ki are applied; this property of the algorithm is most useful when it is implemented in hardware or on platforms with limited resources; GOST 28147-89 can be cited as an example of such an algorithm.
  2. Algorithms based on the Feistel network are the most studied - a huge amount of cryptanalytic research has been devoted to such algorithms, which is an undoubted advantage both in the development of the algorithm and in its analysis.

    There is also a more complex structure of the Feistel network, an example of which is shown in Fig. 3.

    Rice. 3. The structure of the Feistel network.

    Such a structure is called generalized or extended Feistel network and is used much less frequently. traditional network Feistel. An example of such a Feistel network is the RC6 algorithm.

  3. Algorithms based permutation networks (SP network- Substitution-permutation network).

    Unlike the Feistel network, SP networks process the entire encrypted block in one round. Data processing is reduced mainly to replacements (when, for example, a fragment of the input value is replaced by another fragment in accordance with the replacement table, which may depend on the value of the key Ki) and permutations depending on the key Ki(a simplified diagram is shown in Fig. 4).

    Rice. 4. Permutation-permutation network.

    However, such operations are also characteristic of other types of encryption algorithms, therefore, in my opinion, the name "permutation-permutation network" is rather arbitrary.

    SP networks are much less common than Feistel networks; Serpent or SAFER+ algorithms can be cited as an example of SP networks.

  4. Structured Algorithms "square"(Square).

    The "square" structure is characterized by the representation of the encrypted data block in the form of a two-dimensional byte array. Cryptographic transformations can be performed on individual bytes of an array, as well as on its rows or columns.

    The structure of the algorithm takes its name from the Square algorithm, which was developed in 1996 by Vincent Rijmen and Joan Daemen, the future authors of the Rijndael algorithm, which became the new US encryption standard AES after winning an open competition. The Rijndael algorithm also has a Square-like structure; other examples are the Shark algorithms (an earlier development by Ridgeman and Damen) and Crypton. The disadvantage of algorithms with the "square" structure is their lack of knowledge, which did not prevent the Rijndael algorithm from becoming the new US standard.

    Rice. 5. Rijndael algorithm.

    On fig. Figure 5 shows an example of an operation on a data block performed by the Rijndael algorithm.

  5. Algorithms with a non-standard structure, that is, those algorithms that cannot be attributed to any of the listed types. It is clear that ingenuity can be limitless, so to classify everything possible options encryption algorithms is difficult. As an example of an algorithm with a non-standard structure, we can cite the FROG algorithm, unique in its structure, in each round of which there are enough complicated rules two bytes of encrypted data are modified (see Fig. 6).

    Rice. 6. Modification of two bytes of encrypted data.

    Strict boundaries between the structures described above are not defined, therefore, quite often there are algorithms that are classified by various experts as different types structures. For example, the CAST-256 algorithm belongs to the SP network by its author, and is called the extended Feistel network by many experts. Another example is the HPC algorithm, called by its author the Feistel network, but referred by experts to algorithms with a non-standard structure.

Data encryption is extremely important to protect privacy. In this article, I will talk about the different types and methods of encryption that are used to secure data today.

Did you know?
Back in Roman times, Julius Caesar used encryption to make letters and messages unreadable to the enemy. It played an important role as a military tactic, especially during wars.

As the possibilities of the Internet continue to grow, more and more of our businesses are being recruited online. Among these, the most important are, internet banking, online payment, emails, exchange of private and official messages, etc., which provide for the exchange of confidential data and information. If this data falls into the wrong hands, it can harm not only the individual user, but the entire online system business.

To prevent this from happening, some online security measures have been put in place to protect the transmission of personal data. Chief among these are the processes of encrypting and decrypting data, which is known as cryptography. There are three main encryption methods used in most systems today: hashing, symmetric, and asymmetric encryption. In the following lines, I will talk about each of these types of encryption in more detail.

Encryption types

Symmetric encryption

In symmetric encryption, normal readable data, known as plain text, is encoded (encrypted) such that it becomes unreadable. This data scrambling is done using a key. Once the data is encrypted, it can be securely transferred to the receiver. At the recipient, the encrypted data is decoded using the same key that was used for encoding.

Thus it is clear that the key is the most important part of symmetric encryption. It should be hidden from outsiders, since anyone who has access to it will be able to decrypt private data. This is why this type of encryption is also known as a "secret key".

V modern systems ah, the key is usually a string of data that comes from a strong password, or from a completely random source. It is fed into symmetric encryption software, which uses it to secure the input. Data scrambling is achieved using a symmetric encryption algorithm such as Data Encryption Standard (DES), Advanced Encryption Standard (AES), or International Data Encryption Algorithm (IDEA).

Restrictions

The weakest link in this type of encryption is the security of the key, both in terms of storage and transmission of the authenticated user. If a hacker is able to get his hands on this key, he can easily decrypt the encrypted data, destroying the whole point of the encryption.

Another drawback is due to the fact that software, which processes data cannot work with encrypted data. Therefore, to be able to use this software, the data must first be decoded. If the software itself is compromised, then an attacker can easily get the data.

Asymmetric encryption

An asymmetric encryption key works similarly to a symmetric key in that it uses a key to encrypt the messages being sent. However, instead of using the same key, it uses a completely different one to decrypt this message.

The key used for encryption is available to any and all network users. As such it is known as the "public" key. On the other hand, the key used for decryption is kept secret and is meant to be used privately by the user himself. Hence, it is known as the "private" key. Asymmetric encryption is also known as public key encryption.

Since, with this method, the secret key needed to decrypt the message does not have to be transmitted every time, and it is usually known only to the user (receiver), the likelihood that a hacker will be able to decrypt the message is much lower.

Diffie-Hellman and RSA are examples of algorithms that use public key encryption.

Restrictions

Many hackers use "man in the middle" as a form of attack to bypass this type of encryption. In asymmetric encryption, you are given a public key that is used to securely communicate with another person or service. However, hackers use deception networks to trick you into communicating with them while making you believe you are on a secure line.

To better understand this type of hacking, consider the two interacting parties Sasha and Natasha, and the hacker Sergei with the intention of intercepting their conversation. First, Sasha sends a message over the network meant for Natasha, asking for her public key. Sergei intercepts this message and obtains the public key associated with her and uses it to encrypt and send a fake message to Natasha containing his public key instead of Sasha's.

Natasha, thinking this message came from Sasha, now encrypts it with Sergey's public key and sends it back. This message was again intercepted by Sergey, decrypted, modified (if desired), encrypted again using the public key that Sasha had originally sent, and sent back to Sasha.

Thus, when Sasha receives this message, he has been led to believe that it came from Natasha and continues to be unaware of the foul play.

Hashing

The hashing technique uses an algorithm known as a hash function to generate a special string from the given data, known as a hash. This hash has the following properties:

  • the same data always produces the same hash.
  • it is not possible to generate raw data from a hash alone.
  • It is not practical to try different combinations of inputs to try and generate the same hash.

Thus, the main difference between hashing and the other two forms of data encryption is that once the data is encrypted (hashed), it cannot be retrieved in its original form (decrypted). This fact ensures that even if a hacker gets their hands on the hash, it will be useless to him, as he will not be able to decrypt the contents of the message.

Message Digest 5 (MD5) and Secure Hashing Algorithm (SHA) are two widely used hashing algorithms.

Restrictions

As previously mentioned, it is nearly impossible to decrypt data from a given hash. However, this is only true if strong hashing is implemented. In the case of a weak implementation of the hashing technique, using enough resources and brute force attacks, a persistent hacker can find data that matches the hash.

Combination of encryption methods

As discussed above, each of these three encryption methods suffers from some disadvantages. However, when a combination of these methods is used, they form a strong and highly efficient encryption system.

Most often, private and public key techniques are combined and used together. The secret key method allows fast decryption, while the public key method offers a safer and more convenient way to transmit the secret key. This combination of methods is known as the "digital envelope". Encryption program Email PGP is based on the "digital envelope" technique.

Hashing finds use as a means of checking the strength of a password. If the system keeps password hash, instead of the password itself, it will be more secure, since even if this hash falls into the hands of a hacker, he will not be able to understand (read) it. During verification, the system will check the hash of the incoming password, and see if the result matches what is stored. Thus, the actual password will only be visible in the brief moments when it needs to be changed or verified, greatly reducing the chance of it falling into the wrong hands.

Hashing is also used to authenticate data with a secret key. The hash is generated using the data and this key. Therefore, only the data and the hash are visible, and the key itself is not transmitted. This way, if changes are made to either the data or the hash, they will be easily detected.

In conclusion, these techniques can be used to efficiently encode data into an unreadable format that can ensure that it remains secure. Most modern systems typically use a combination of these encryption methods along with a strong implementation of algorithms to improve security. In addition to security, these systems also provide many additional benefits, such as verifying the user's identity and ensuring that the data received cannot be tampered with.

Information lifetime

§ When intercepting an encrypted message for some types of encryption algorithms, it is possible to calculate the frequency of occurrence of certain characters and compare them with the probabilities of occurrence of certain characters or their combinations (bigrams, trigrams, etc.). This, in turn, can lead to unambiguous decryption (disclosure) of individual sections of the encrypted message.

§ The presence of probable words. These are words or expressions that can be expected to appear in the intercepted message (for example, for English text - "and", "the", "are", etc.).

§ There are methods to make encrypted messages practically unusable for statistical analysis and analysis through probable words. These include the following.

§ Diffusion. The influence of one character of an open message extends to many characters of an encrypted message. This method, although it leads to an increase in the number of errors during decryption, however, it can be used to hide the statistical structure of the open message.

§ Entanglement. Development of the scattering principle. In it, the influence of one character of the key extends to many characters of the encrypted

messages.

§ Mixing. It is based on the use of special transformations of the original message, as a result of which the probable sequences seem to scatter over the entire space of possible open messages. The development of this method was the use of composite encryption algorithms, consisting of a sequence of simple permutation and substitution operations.

Examples of the above methods are the encryption standards DES and GOST 28147-89.

There are two main types of encryption algorithms:

§ symmetric encryption algorithms;

§ asymmetric encryption algorithms.

Symmetric encryption.

Symmetric encryption algorithms are based on the fact that the same (common) key is used to encrypt a message and decrypt it (Fig. 1).

One of the main advantages of symmetric methods is the speed of encryption and decryption, and main disadvantage– the need to transfer the secret value of the key to the recipient.



The problem inevitably arises: how to transfer the key and at the same time not allow attackers to intercept it.

Benefits of cryptography with symmetric keys:

· High performance.

· High durability. Other things being equal, the strength of a cryptographic algorithm is determined by the length of the key. With a key length of 256 bits, it is necessary to perform 10 77 searches to determine it.

Disadvantages of cryptography with symmetric keys.

§ Key distribution problem. Since the same key is used for encryption and decryption, very reliable mechanisms are required for their distribution (transmission).

§ Scalability. Since both the sender and the recipient use the same key, the number of keys needed increases exponentially depending on the number of participants in the communication. To exchange messages between 10 users, you need to have 45 keys, and for 1000 users - already 499,500.

§ Limited use. Secret key cryptography is used to encrypt data and restrict access to it, it cannot be used to ensure information properties such as authenticity and

non-repudiation.

Asymmetric encryption

Asymmetric encryption algorithms (cryptography with public keys) require the use of two keys. The first key is open. It is distributed completely freely, without any precautions. Second, closed the key is kept secret.

Any message encrypted using one of these keys can only be decrypted using its paired key. Typically, the sender of a message uses the recipient's public key, and the recipient uses their private private key.

In an asymmetric scheme for the transmission of encrypted messages, both keys are derived from a single parent master key. When two keys are formed on the basis of one, they are dependent in a mathematical sense, however, due to computational complexity neither of them can be calculated from the other. After both keys are generated (both public and private, private), the master key is destroyed, and thus any attempt to restore the values ​​of keys derived from it in the future is stopped.

The asymmetric scheme is ideally combined with the use of public messaging networks (for example, the Internet). Any network subscriber can absolutely freely send the public key to his negotiation partner, and the latter, in the role of the sender of the message, will use this key when encrypting the message being sent (Fig. 2). This message can be decrypted with its private key only by the recipient of the message who previously sent the corresponding public key. An attacker who intercepts such a key will be able to use it only for the sole purpose of transmitting some encrypted messages to the rightful owner of the key.

The disadvantage of the asymmetric scheme is the large time spent on encryption and decryption, which does not allow their use for the rapid exchange of lengthy messages in the dialogue mode. The implementation of asymmetric encryption methods requires a lot of CPU time. Therefore, in its pure form, public-key cryptography is not usually used in world practice.



Rice. 2. Asymmetric encryption scheme

It is impossible to compare which is better, symmetric or asymmetric encryption algorithms. It is noted that symmetric cryptographic algorithms have a smaller key length and work faster.

Secret key cryptography and public key cryptography are designed to solve absolutely different problems. Symmetric algorithms are well suited for data encryption, asymmetric algorithms are implemented in most network cryptographic protocols.

The most widely used methods combine the advantages of both schemes. The principle of operation of combined schemes is that a symmetric (session) key is generated for the next messaging session. This key is then encrypted and sent using an asymmetric scheme. After the end of the current negotiation session, the symmetric key is destroyed.

Liked the article? Share with friends!
Was this article helpful?
Yes
Not
Thanks for your feedback!
Something went wrong and your vote was not counted.
Thank you. Your message has been sent
Did you find an error in the text?
Select it, click Ctrl+Enter and we'll fix it!