 In this session we are practicing RSA example, so let us begin the session learning outcome at the end of this session students will be able to calculate ciphertext using the RSA algorithm. As we have seen in the previous session RSA encryption and decryption algorithm to encrypt a message M of the sender first obtain a public key of the recipient that is E and N then compute ciphertext by formulating M raise to E mod N where M is between 0 and N and to decrypt a ciphertext C of the owner uses their private key PR that is DN and then compute to find out M with the formula series to D mod N. Now, before that it is important to generate a pair of key each user generates a public private key pair by selecting two large primes at a random let us say P and Q then computing their system modulus for M is equal to P multiplied by Q and note phi of N is equal to P minus 1 multiplied by Q minus 1. Now, time to select random E which is encryption key lies between 0 and phi of N and another important thing is GCD of E and phi of N is equal to 1 and now time to calculate decryption key D with the formula E D is equal to 1 mod phi N and D is between 0 and N. So, public encryption key E and N and private decryption key D and N. Now, let us check out the examples the first one with a given contain P is equal to 3 Q is equal to 11 E is a 7 and M is 5. So, E and M is already given E is already given and with P 3 and Q 11. So, sit with a pen and paper. So, first step N P multiplied by Q the second step to find out phi of N now time to determine D such that D E mod phi of N is 1. So, D multiplied by 7 mod 20 is equal to 1 and D is less than 20. Now, trial and error just start from 1 etcetera, etcetera. Now, V to 3. So, 3 into 7, 21 mod 21 LHS is equal to RHS. So, you can fix on 3. So, D 3 E 7. So, cipher text phi rest to 7 phi phi M is phi u mod 33 by performing calculations 14 and original message it is compulsory to find out phi u. So, 14 rest to 3 mod 33 phi hope you all are getting how to perform the calculations the main part here is determine D. Now, just check out the second example what are the content P Q phi u 11. So, 55 phi of N P minus 1 Q minus 1 4 T E is given. So, no time or no selection of E now E is 3. So, D E is equal to 1 mod phi N. So, 3 D is equal to 1 mod 40. Again by performing calculations by doing trial and error by applying theorems we are able to determine D is equal to 27. So, time to compute cipher text 9 rest to 3 9 is our message mod 55. So, by calculating 55 and M is equal to 14 rest to 27 mod 55. So, original plain text 9 hope you solve these two. Now, just another type of example read carefully in a public key system using RSA intercept the cipher text C which is same to a user whose public key is phi u and N is equal to 35. Now, time to do the reverse calculation to find out the plain text M. So, let P be phi u and Q be 7 it is assumption for calculation we have chosen the small numbers actual they are large and random. So, N is equal to P multiplied by Q that is phi u multiplied by 7 35 and phi of N P minus 1 Q minus 1 24. Now, here we are going to select E such that GCD of phi of N and E is equal to 1 and E is between 1 and phi of N. So, E is by doing calculation GCD of 24. So, 1 no 2 no it is not a common 3 it is also the GCD is not equal to 1 means 4 no phi u yes. So, E is phi now time to generate D or compute D. So, this is also equivalent formula D is equal to E raise to E raise to 1 mod means minus 1 mod phi of N which is equivalent to E D 1 mod phi of N or E D mod phi of N is equal to 1 how you want to write it depends on U. Now, we have E phi u phi of N is 24. So, phi u D mod 24 is equal to 1 that is our by calculation and we determine D is equal to phi. So, now private key is ready yes D and N phi u 35 public key is already ready E N. Now, decryption algorithm M is equal to C raise to D mod N. So, 10 raise to phi u mod 35. So, by calculation we get original message phi u and now we will cross check cipher text M raise to E mod N that is phi u raise to phi u mod 35 means 10. So, our calculation is correct. Now, dear student please pause the video and try to answer in the RSA algorithm we select two random large values P and Q which are the following is the property of P and Q. P and Q should be divisible by phi of N, P and Q should be co-prime, P and Q should be prime, P by Q should give no remainder just revise revise revise okay. So, P and Q should be prime that is a basic property while selecting two random P and Q okay. Now, what are the RSA issues as we have seen that RSA is most power means popular public key encryption algorithm. RSA is computationally intense yeah that is basic commonly used key length are 1024 bits the plain text should be smaller than key length the encrypted text is the same as key length and generally used to encrypt secret key means it is used to send a secret key from one to another in a symmetric encryption look out here. So, use of a public key encryption system for distribution of private key. Now, what are the potential attacks possible on a RSA algorithm brute force key search in feasible given size of numbers. So, timing attacks on the running of a decryption can infer operand size based on time taken the third one is mathematical attacks. So, based on a difficulty of computing phi of N by factorizing modulus and chosen cipher text attacks. So, these four types of attacks are possible. So, brute force key search timing attacks mathematical attacks and chosen cipher text attacks. So, now summarize within a couple of minutes what we have seen for RSA and RSA encryption decryption algorithm key generation okay. So, RSA public key encryption uses two keys. So, one to encrypt and other to decrypt the keys are interchangeable we cannot interchange between public and private key. For example, at one time D is public key at another time D is private key this is a not a case with RSA the keys are interchangeable one key is public and other is private. RSA uses exponential in GF of N for large N. N is a product of two large primes public key encryption algorithm has a lots of support from mathematical formulas theorems. RSA keys are E N and D N where E D mod of phi of N is 1 means how E and D are interrelated that is also important. So, given the keys both encryption and decryption are easy, but given one key finding the other key is hard that is important and the message size should be less than the key size use large keys 512 bits and larger. So, these are the important factors or characteristic of a RSA algorithm and as we have discussed that RSA or there are lots of public key encryption algorithm the one important use or application is key distribution of secret key while used for encrypt symmetric encryption algorithm. So, this is a reference thank you.