RSA encryption


 
Thread Tools Search this Thread
Top Forums Programming RSA encryption
# 1  
Old 10-27-2012
RSA encryption

Hi everybody, I know this is a linux forum but I've got a question about encryption. If you want to encrypt (and decrypt) more than one byte at a time do you have to choose sufficiently large numbers when generating the keys for the math to work out? Every example I've come across on the internet shows the process with encrypting one byte. I've written a large number C++ class and I believe its working. Now, when I try the examples on the internet it works for one byte only. When I try encrypting two bytes at a time it breaks down and the decryption process spits out something other than the original message. Anyhow, you guys have any idea what the problem may be?

P.S. If you want to see my code I'll post it but it is extremely long.
# 2  
Old 10-27-2012
If you understand the algorithm and believe you duplicated it correctly, I would apply the same algorithm using an accepted well known and well-tested bignum library.

The most likely candidate for your problem is your bignum class.
# 3  
Old 10-27-2012
I see what you're saying jim, but I'm pretty sure the problem is not my class. When I work out the examples on the internet with a calculator program the same thing happens. After going through the calculations with the calculator program it spits out the same thing as my code. Something's not stirring the cool-aid here. Maybe you can answer this: Do most programs that encrypt files do so one byte at a time?
# 4  
Old 10-27-2012
It depends on the encryption method. Encryption can be classified as either stream or block based.
# 5  
Old 10-27-2012
Hi fpmurphy. Thanks for the input. You wouldn't by chance know what happens when you calculate your keys from really small prime numbers and then try encrypting data blocks larger than the keys would you? Cause the math is not working out for me. When I calculate it by hand with a calculator program the decrypted data is not the same as what was encrytped.

---------- Post updated at 11:15 AM ---------- Previous update was at 10:17 AM ----------

Nevermind guys, I found the answer to my question. The answer can be summed up in this sentence from a professor at Purdue:

"Since our message integer M must be smaller than the modulus n, obviously our
block size cannot equal the modulus size."
# 6  
Old 10-28-2012
You can break the message in smaller blocks and encrypt those. That's typically what happens with block cyphers.

If you want to use an asymmetric key pair like RSA to encrypt a whole message, then, yes, the message must be shorter than the modulus.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Cybersecurity

File encryption tools with MAC address as an encryption key

Hi all, I'm looking for secure file encryption tools that use MAC address as encryption key. FYI, I'm using Red Hat Enterprise Linux OS. For example: when A wants to send file to B A will encrypt the file with B's computer MAC/IP address as an encryption key This file can only be decrypted... (2 Replies)
Discussion started by: sergionicosta
2 Replies

2. Red Hat

How to use rsa key for a different user?

Hi All, I have a scenario where from machine1 I need to establish sftp/ssh to machine2. Internet is full of examples of this how to generate they key-pair etc... but all examples assume that the account is the same on machine1 and machine2. I would like to do the following: 1) user1 on... (3 Replies)
Discussion started by: snailrider
3 Replies

3. UNIX for Dummies Questions & Answers

About PuTTY RSA signature

On the website of Putty http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html http://www.chiark.greenend.org.uk/~sgtatham/putty/keys.html It provides the RSA signatures and public keys of binary files. It says: We create PGP signatures for all the PuTTY files distributed... (6 Replies)
Discussion started by: vistastar
6 Replies

4. UNIX for Dummies Questions & Answers

RSA 1024

How to generate RSA 1024 public key?? Pls help (3 Replies)
Discussion started by: kdtrica
3 Replies

5. UNIX for Advanced & Expert Users

RSA host key addition

Guys How do i add RSA key for a host ? I was able to connect to a host some time back but now its not connectable ,via SSH. Message i get is : abhi@myHost:~/.ssh> ssh eatcid@yourHost @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION... (3 Replies)
Discussion started by: ak835
3 Replies

6. UNIX for Advanced & Expert Users

RSA keys are not working

Hi, We have two open SSh systems(Let us assume that A and B).These systems are having the non expiring passwords. We established a passwordless connection between two systems bu using the rsa key iles. I have created the key generated files by using the command ssh-keygen -t rsa in system A and... (1 Reply)
Discussion started by: srrao.ch
1 Replies

7. Shell Programming and Scripting

RSA keys are not working

Hi, We have two open SSh systems(Let us assume that A and B).These systems are having the non expiring passwords. We established a passwordless connection between two systems bu using the rsa key iles. I have created the key generated files by using the command ssh-keygen -t rsa in system A and... (1 Reply)
Discussion started by: srrao.ch
1 Replies

8. UNIX for Dummies Questions & Answers

File encryption/Key encryption ????

My dilemma, I need to send, deemed confidential, information via e-mail (SMTP). This information is sitting as a file on AIX. Typically I can send this data as a e-mail attachment via what we term a "mail filter" using telnet. I now would like to somehow encrypt the data and send it to a e-mail... (1 Reply)
Discussion started by: hugow
1 Replies

9. Cybersecurity

Rsa

This "quiz" was pretty easy (at least for me) and the prize is a trip to RSA. http://www.messagelabs-quiz.com/Quiz/Index.asp By the way, did anyone go to this last year? (0 Replies)
Discussion started by: defender77
0 Replies
Login or Register to Ask a Question