# Symmetric and asymmetric encryption: definition, application, examples

Encryption is used to exchange messages and hide content from third parties. It is used where a higher level of protection is required. There are two encryption schemes: symmetric and asymmetric.

## What is encryption

Encryption will be useful when you need to hide some information from unauthorized persons and provide secret data to authorized users.

A feature of this type of data transfer is the use of a key.

There are three security states:

• hiding information from strangers;
• change prevention;
• preserving the integrity of information;
• sender identification.

To read information other than the key, a decoder is required. This is what makes it impossible for attackers to obtain data, because having intercepted the data, but without having a key, it is impossible to read them.

There are two types of encryption: symmetric and asymmetric.

MainThe purpose of encryption is to store information. This allows you to work with some data from unreliable sources, transmit messages through insecure channels. Sending information is as follows:

• sender encrypts data;
• recipient decrypts.

Each transformation is implemented using algorithms that use keys to solve. Symmetric and asymmetric encryption methods are cryptographically strong.

## Crypto strength

Symmetric and asymmetric encryption systems have a characteristic that is responsible for the difficulty of obtaining unauthorized access.

There are 2 main types of cryptographic strength of the encryption system.

1. A perfectly secure system cannot be breached, even with infinitely large computational resources. It is characterized by the fact that for each message a separate key is generated. Its length is equal to or greater than the length of the message.
2. Sufficiently strong systems are used in the civilian cryptographic system. Such an algorithm is difficult to decipher, but with the right resources it becomes possible.

## Comparison of the strength of some encryption systems

The maximum RSA key size is 4096 bits.

It is used for encryption and signing. The cryptographic strength can be described as 2.7×1028 for a 1300 Bit key. The scheme is used in many standards, the principle of RSA encryption is one offirst asymmetric algorithms.

The key size of the ElGamal scheme is RSA - 4096 bits. It is used for both encryption and digital signature. The cryptographic strength of this system does not differ from RSA with the same key size.

The DSA method uses a much smaller key - 1024 bits. It is used exclusively for digital signature.

## Symmetric and asymmetric encryption

These two types of encryption differ in the number of keys and the level of resistance to hacking.

If the same key is used for encoding and decoding, then this encryption is symmetrical. Asymmetric encryption means using one key for each algorithm.

1. A certain code is encrypted with the public key, which represents a certain message. The key is known to both parties, it is transmitted over an insecure channel, and can be intercepted. The most important task of storing information is to protect the key from interception.
2. Closed is used for decryption. Known to only one side. Cannot be intercepted, as it is always with one interlocutor.

The purpose of encryption determines the method of maintaining confidentiality. One of the first was symmetric encryption, asymmetric encryption was invented later to provide greater security.

## Features of symmetric encryption

Symmetrical protection system has the following advantages.

1. High speed and ease of implementation.
2. To ensure the strength of the cipher, a small key length is used.

• difficulty managing keys in a large network;
• key exchange complexity;
• need to find a reliable channel for transferring the key to the parties;
• cannot be used for digital signature, certificates.

To compensate for the shortcomings, a combined scheme is used in which the key used for decryption is transmitted using asymmetric encryption. It is transmitted using symmetric encryption.

## Features of asymmetric encryption

Using a public-private key pair can be used as:

• independent means of protecting information;
• key distribution facility;
• user authentication tools.

Has the following benefits:

• saving the secret key in a safe place, instead of which the open channel is transmitted over the open channel;
• decryption key is known only to one side;
• in a large asymmetric system, use fewer keys than a symmetrical one.

It is difficult to make any changes in such algorithms. Such a system has long keys. If the symmetric key is 128 bits, then the RSA key is 2304 bits. Because of this, the decryption speed suffers - it is 2-3 times slower. Decryption requires large computing resources.

There are many examples of symmetric and asymmetric encryption systems.

## Symmetricalencryption - what does it look like?

An example of symmetric encryption and implementation scheme below.

1. There are two people who plan to exchange confidential information.
2. The first interlocutor generates a key d, encryption algorithms E and decryption D. Then sends this information to the second interlocutor.
3. The message is decrypted with the key d.

The main disadvantage is the inability to establish the authenticity of the text. If the key is intercepted, the attacker will decrypt the secret information.

There are classic methods.

1. Simple and double permutation.
2. Magic square.
3. Single permutation.

The first method is one of the simplest and does not use a key in its schema. The sender and receiver agree on some key, represented as a table size. The transmitted message is written in the columns of the table, but read line by line. Knowing the size of the table, the recipient decrypts the message.

Double permutation is used for greater ste alth. Thus, the previously encrypted text is encrypted. To do this, the tables must differ in the number of rows and columns. They are filled vertically, horizontally, in a snake, in a spiral. This method does not increase encryption, but the cracking process becomes longer.

“Magic square” is a more complex structure, which is a matrix. Natural numbers are inscribed in the cellsso that the sum of the numbers in each column, row, diagonal is the same. Each number corresponds to a message letter. The resulting text is written out to a string, matching numbers and symbols.

## Examples of asymmetric encryption

In this case, the public key is sent over an open channel and theoretically can be intercepted by intruders.

Unlike symmetric encryption keys, asymmetric encryption keys are different. The public key is used to encrypt the message, and the private key is used to decrypt the message. The use of two keys solves the eavesdropping problem that was in the symmetric method. Implemented as follows.

1. The first interlocutor chooses encryption and decryption algorithms, a pair of keys. The public key is sent to the second party.
2. The second interlocutor encrypts the information using the received key. Sends information to the first party who decrypts the message using the private key.

There are such basic methods of asynchronous encryption.

1. RSA.
2. DSA.
3. ElGamal Cipher.

## RSA

RSA is the first cryptographic algorithm used for both encryption and digital signature.

Described like this.

1. Two prime numbers are chosen, for example, 3 and 7.
2. The module n is calculated - the product of two numbers. It turns out 21.
3. Euler function is calculated

``` φ=(p-1)×(q-1)=2×6=12.```
4. ``` Calculate any prime number e less than φ and prime with φ. Available options: 5, 7, 11. ```
``` ```

Pair of numbers e, n (5, 21) - public key. Now the numbers d and n of the private key are calculated. The number d satisfies the condition

``` (d×e) mod φ=1 and equals 17. As a result, the second pair of numbers 17 and 21 is the private key. Encryption is performed as follows: the message is raised to the power of e, the remainder of division by n is taken, and the result must be less than the number n. It turns out 10 - this will be the encoded data. For decoding, e is raised to the power of d, the remainder of the division by n is calculated. (adsbygoogle=window.adsbygoogle||[]).push({}); DSA DSA (unlike RSA) is only used for digital signing, not encryption. The given signature can be verified publicly. There are two algorithms for signature creation and verification. It is the hash message that is encrypted, which represents the text in digital form. Therefore, a complex hash function is chosen to avoid collisions. Building a digital signature consists of the following steps. ```
``` Choose the cryptographic hash function H(x). The bitness of a prime number q must be equal to the value of the hash function H(x). Choosing a prime number p such that p-1 is evenly divisible by q. ```
1. Calculate number

``` g=h (p-1)/q mod p. h must be an arbitrary number between 1 and p-1.```
2. ``` A random number k is chosen from 0 to q. ```
3. Computed

``` r=(gk mod p) mod q.```
4. ``` ```
5. Then

``` s=k-1(H(m) + xr)) mod q.```
6. ``` If r=0 or s=0,choose another number k. ```
``` ElGamal Scheme ElGamal encryption is used for digital signatures. It is an extension of the Diffie-Hellman algorithm. (adsbygoogle=window.adsbygoogle||[]).push({}); When working according to this scheme, it is important to consider the following feature. ElGamal encryption is not a digital signature algorithm according to the scheme of the same name. When encrypted, the text is converted into a cipher that is 2 times longer than the original message. Key generation is as follows. ```
``` A random prime number p. The number g must be a primitive root p. The number x must be greater than 1 and less than p-1. This will be the private key. ```
1. Then the public key y is calculated using the formula

``` g^x mod p.```
2. ``` ```
``` ```

When encrypting the text M, the system key K is selected. It is greater than one and less than p-1. Then the numbers a and b are calculated, which are the ciphertext,

``` a=g^k mod p ``` and

``` b=y^k M mod p. ```
``` ```
``` function video_open(_video){var body_width=document.documentElement.clientWidth;var body_height=document.documentElement.clientHeight;var div_video=document.createElement('div');div_video.id='video-youtube-open';div_video.setAttribute('style','width:'+body_width+'px;height:'+body_height+'px');div_video.innerHTML='<div class="close" onclick="video_close()">&#10761;</div><div class="video-youtube-open-iframe"><iframe src="https://www.youtube.com/embed/'+_video+'?autoplay=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></div>';document.body.append(div_video);} function video_close(){document.getElementById('video-youtube-open').remove();} (adsbygoogle=window.adsbygoogle||[]).push({}); Popular topic ```
``` ```
``` ```
``` ```
``` ```
``` ```
``` ```
``` ```
``` Editor's choice (adsbygoogle=window.adsbygoogle||[]).push({}); The PHP mail function: description, application features E-mail is an integral part of any modern project or business. Nowadays, speed and responsiveness are of great value, especially when it comes to customer feedback. This is a decisive factor that users consider when making purchases Shareware - what is it List of programs, description of programming principles Shareware has battled the stigma of misunderstanding for decades. While enterprise software giants can no longer ignore the marketing potential of a trial, small startups still struggle with new software challenges and costs What is var in Pascal Variable var is a name that the user assigns to computer memory cells and uses to store values in a computer program. It defines the type of information stored, describes the format of the value of the occupied memory and methods for manipulating the content Java library: creating, processing, working with files Experienced Java developer has extensive knowledge of APIs including JDK, libraries for everyday projects including Log4j, JSON parsing, Jackson. The problem is that not all Java library designers think about their users, how the API will be used in practice, and how the code will look and be tested Compression algorithms: description, basic techniques, characteristics Currently, processor processing power is increasing faster than storage capacity and network bandwidth. Therefore, in order to compensate for the increase in the amount of data, they compress them. The compressor uses an optimization algorithm of the appropriate type. For subsequent recovery, a decompressor with the opposite direction of the process is required (adsbygoogle=window.adsbygoogle||[]).push({}); Best reviews How to put a password on the browser "Chrome", Mozilla Firefox, "Opera", "Yandex" 2023 How to connect Viber to a computer: activation without a smartphone and through a proxy 2023 New Russian operating system for PC. Russian operating systems 2023 FreeBSD - what is it? Advantages of FreeBSD over Linux Windows 2023 Steam Validation Rejected Fix 2023 (adsbygoogle=window.adsbygoogle||[]).push({}); Trends The sound on the laptop disappeared: what to do, how to fix it? How to find the Dragon Stone in Skyrim? How to become an esportsman: 10 steps to success The best modifications to "Stalker" Physical engine. Game programming (adsbygoogle=window.adsbygoogle||[]).push({}); ```
``` ```
``` ```
``` ```
``` ```
``` ```
``` (adsbygoogle=window.adsbygoogle||[]).push({}); Editor's choice How to view the statistics of the page "VKontakte": detailed instructionsBrowser blocked by the Ministry of Internal Affairs: true or fraud?Music gluing software: the best choice for every deviceCorel Photo Paint: the pros and cons of the popular photo editorCorelDraw program for working with vector graphicsHow to Create GIFs: The Ultimate Guide Interesting articles Try yourself as a football coach on your mobile in one of the best football managers on AndroidBest World War II strategiesDetailed instructions on how to build a Gantt chart in ExcelHow to build a histogram in Excel and WordRounding numbers in web programmingThe folder is not deleted - possible causes and solutions Best reviews for the month Popular categories Computer gamesData recoveryDatabasesFile typesInformation technologyNotebooksNetworksOperating systemsProgrammingSecuritySoftwarePages © Copyright technologyweeks.com, 2023 March | About site | Contacts | Privacy policy. var fired=false; window.addEventListener("scroll",()=>{ if(fired===false){fired=true;setTimeout(()=>{(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};m[i].l=1*new Date();for(var j=0;j<document.scripts.length;j++){if (document.scripts[j].src===r){return;}}k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})(window,document,"script","https://mc.yandex.ru/metrika/tag.js","ym");ym(57321331,"init",{clickmap:true,trackLinks:true,accurateTrackBounce:true});},1000)} }); ```