Posts

Showing posts from March, 2018

Digital Signature Generation & Verfication in RSA Algorithm

Image
In RSA, we know that there are 2 keys, namely public and private key, public key being available to everyone. There can be cases where the receiver actually receives more than one encrypted message. Now, the task is, how will the receiver know that the sender is legit or n ot ? In order to solve this probl em, the concept of Digital signature is introduced into RSA Algorithm. In thiscenario, if person A wants to send a message to person B, then person A first produces a hash vale for the message, raises it to the power of d mod n and attaches it as a signature to the message. When person B receives the messsage, B raises the signed message to the power of e mod n and compares the resulting hash value with the message's actual hash value. If the two agree, then person B can be sure that the message has not been tampered with. zin the following examples, we will be signing the message itself instead of its hash value. Generation: The above picture displays the co

RSA Encryption & Decryption

Image
In the last blog, I had discussed about about private key generation for RSA Algorithm. This blog is going to be about encryption and decryption part of RSA Algorithm. Encryption: Let us consider a situation where the mesaage to be encrypted is m, the large prime numbers are p &q , n is the product of p &q, e is the exponent and let c be the encrypted Cipher text. The Code in order this message using RSA Algorithm would be : The above mentioned code for a specific example will give us the following output. Decryption: Encryption uses a public key in order to secure the message. But while decrypting it, a private key is used by the intended reeiver. The code for decrypting is : The decrypted message will be in hexadecimal. In order it to a alphabetical string , we use the following python code. $ python -c 'print("50617373776F72642069732064656573".decode("hex"))'

Private Key Generation

Image
RSA algorithm is the abbreviation of Rivest-Shamir-Adleman Algorithm and it deals with public key encryption and decryption of messages. The idea behind this algorithm is that , it is easy to multiply two very large prime numbers but it is a herculian task to factorize this product and trace back its original factors. This led to the idea of having 2 keys, one public and the other one private. The public key is available to everyone and it is used to encypt and send a secure message across the channel. This Cipher text can only be decrypted by using the private key, only available with the intendent receiver. This started as a lab assignment for my cryptology class, but has since interested me to learn more about public key cryptography. The first task in my lab assignment was to generate a private key when the prime numbers and the public key are known. BIGNUM has been used in these assignments in order to escape the constraint of being able to use numbers that are at max. 64 bits