/ / RSA encryption. Description and implementation of the RSA algorithm

RSA encryption. Description and implementation of the RSA algorithm

RSA encryption is one of the firstpractical cryptosystems with a public key, which is widely used for secure data transmission. Its main difference from similar services is that the encryption key is open and differs from the decryption key, which is kept secret. In RSA technology, this asymmetry is based on the practical complexity of factoring reproduction of two large prime numbers (the factoring problem).

RSA encryption

History of creation

The name RSA consists of the initial letters of the surnamesRivest, Shamir and Adleman, scientists who first publicly described similar encryption algorithms in 1977. Clifford Cox, an English mathematician who worked for the British secret services, first developed an equivalent system in 1973, but it was not declassified until 1997.

The RSA user creates and then publishespublic key, based on two large prime numbers along with an auxiliary value. Simple numbers should be kept secret. Anyone can use a public key to encrypt a message, but if it is large enough, then only someone with the knowledge of prime numbers can decode the message. Disclosure of RSA encryption is known as the main problem: today there remains an open discussion about how reliable this mechanism is.

encryption algorithms

RSA is a relatively slow algorithm,for which reason it is not widely used to directly encrypt user data. Most often, this method is used to send encrypted shared keys for a symmetric encryption key, which in turn can perform bulk encryption and decryption operations at a much higher speed.

When did the cryptosystem appear in the modern form?

The idea of ​​an asymmetric cryptosystem keyattributed to Diffie and Hellman, who published the concept in 1976, presenting digital signatures and trying to apply the theory of numbers. Their formulation uses a common secret key, created from the exponentiation of a number modulo a prime number. Nevertheless, they left open the problem of implementing this function, since the principles of factoring were not well understood at that time.

Rivest, Adi Shamir and Adleman in MassachusettsThe Institute of Technology undertook several attempts during the year to create a unidirectional function that is difficult to decode. Rivest and Shamir (as computer scientists) offered many potential functions, while Adleman (as a mathematician) searched for "weaknesses" of the algorithm. They used many approaches and eventually in April 1977 developed the system finally known today as RSA.

encryption of information

EDS and public key

Electronic digital signature, or EDS,is an integral part of electronic type documents. It is formed with a certain cryptographic change in the data. With the help of this attribute it is possible to check the integrity of the document, its confidentiality, and also to determine who owns it. In fact, this is an alternative to the ordinary standard signature.

This cryptosystem (RSA-encryption) offerspublic key than differs from symmetric. The principle of its functioning is that two different keys are used - closed (encrypted), and also open. The first is used to generate EDS and subsequently get the opportunity to decipher the text. The second - for proper encryption and verification of EDS.

The use of the signature makes it possible to better understand RSA encryption, an example of which can be cited as an ordinary secret document closed from prying eyes.

What is the essence of the algorithm?

The RSA algorithm consists of four steps: generation of keys, their distribution, encryption and decryption. As already mentioned, RSA encryption includes a public key and a private key. Open can be known to everyone and used to encrypt messages. The essence of it is that messages encrypted with a public key can be decrypted only in a certain period of time using a private key.

rsa encryption example

For security reasons, whole numbers must beare randomly chosen and are the same in value, but they differ in length by a few digits to make factoring more difficult. The same numbers can be effectively found using a test for their simplicity, so encryption of information must necessarily become more complicated.

The public key consists of a module and a public exponent. The closed one consists of a module and a private indicator, which must be kept secret.

Encrypting RSA files and weak points

However, there are a number of mechanisms for hackingsimple RSA. When encrypting with low scores and small values ​​of numbers, the cipher can be easily opened if you select the root of ciphertext over integers.

rsa encryption c

Because RSA encryption is(ie it does not have a random component), an attacker can successfully run the selected open text of an attack against the cryptosystem by encrypting probable open texts under a public key and checking to see if they are equal to ciphertext. A cryptosystem is said to be semantically secure in the event that an attacker can not distinguish two encodings from each other, even if he knows the corresponding texts in an expanded form. As described above, RSA without the addition of other services is not semantically secure.

Additional algorithms for encryption and protection

To avoid the above problems, withThe practical implementation of RSA typically embeds some form of structured, randomized fill before encryption. This ensures that the content does not fall within the range of unsafe plaintexts and that this message can not be uncovered by random selection.

rsa file encryption

RSA cryptosystem security and encryptioninformation are based on two mathematical problems: the problem of factoring large numbers and the actual problems of RSA. Full disclosure of ciphertext and EDS in RSA is considered unacceptable on the assumption that both of these problems can not be resolved in the aggregate.

However, due to the possibility of restorationsimple multipliers, an attacker can calculate a secret key from a public key, and then decrypt the text using a standard procedure. Despite the fact that today no existing method for factoring large numbers on a classic computer has been found, it has not been proven that it does not exist.

Automation

A tool, called Yafu, can beused to optimize this process. Automation in YAFU is a modern function combining algorithms of factorization in intellectual and adaptive methodology, which minimizes time to find factors of arbitrary input numbers. Most implementations of the algorithm are multi-threaded, which allows Yafu to fully utilize multi-or multi-core processors (including SNFS, SIQS and ECM). First of all, it's a command-line tool. The time spent searching for an encryption factor using Yafu on a conventional computer can be reduced to 103.1746 seconds. The tool performs processing of binary files with a capacity of 320 bits or more. This is a very complex software that requires a certain amount of technical skills to install and configure. Thus, RSA encryption C may be vulnerable.

rsa encryption on the fingers

Attempts of breaking in modern times

In 2009, Benjamin Moody with the help of bitThe RSA-512 key worked on decrypting the cryptotetext for 73 days using only well-known software (GGNFS) and the average desktop computer (dual-core Athlon64 at 1900 MHz). As shown by this experience, it took slightly less than 5 gigabytes of disk and about 2.5 gigabytes of RAM for the process of "sifting".

As of 2010, the largest factorized RSA number was 768 bits long (232 decimal digits, or RSA-768). His disclosure lasted two years on several hundred computers at a time.

In practice, however, RSA keys have a long length -as a rule, from 1024 to 4096 bits. Some experts believe that 1024-bit keys can become unreliable in the near future or even can already be cracked by a well-funded attacker. However, few will argue that 4096-bit keys can also be disclosed in the foreseeable future.

Prospects

Therefore, as a rule, it is assumed that RSAis safe if the numbers are large enough. If the main number is 300 bits or shorter, the ciphertext and digital signature can be decomposed for several hours on a personal computer using software already available in the public domain. Keys with a length of 512 bits, as it was proven, could be opened in 1999 using several hundred computers. Nowadays, this is possible within a few weeks with the use of public hardware. Thus, it is possible that RSA encryption on the fingers will easily be revealed in the future, and the system will become hopelessly obsolete.

Officially in 2003, the security of 1024-bit keys was questioned. Currently, it is recommended to have a length of at least 2048 bits.

Read more: