I know that it generates a public key and then a private key. You encrypt with public and can only decrypt with private key.

How is this algoritm going to work in a C++ program, how am i going to compute the public key and then the private key?

Also, once i have the keys. Do i xor the line to encrypt it or add or minus the key with the character value eg:

xor
===

for(int i = 0; i < LineFromFile.size(); i++)
    {
       encryptedLine = LineFromFile[i] ^ publickey[i];
    }

LineFromFile is a line readed from a .txt file (the data that needs to be encrypted)

Or how do i do this?

Recommended Answers

All 2 Replies

From what I know u should line to the power key modulus n and XOR is not used

RSA takes the private key from user. Now it searches the directory for the user who will get your encrypted file. It takes his/her public key and encrypts. Algorithm uses modular arithmetic. The main challenge is to generate two large prime numbers (probably 100 digits long, for security purpose).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.