Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
December 17th, 2011, 03:36 PM
 ogward
Registered User

Join Date: Dec 2011
Posts: 3
Time spent in forums: 1 h 10 m 37 sec
Reputation Power: 0
RSA block decryption

Hi there!

I have this message that has been encrypted with RSA, the msg (c) is 2145 characters long and the language is unknown
(but my guesses are that it is either english or maybe english encrypted using an 255 character ASCII.)

After a lot of "guessing" I'm pretty sure I've found out p, q, of course n, d and fi(n).

To my problem.
When I want to decrypt m do I first split c into blocks?
or do I first do the decryption (m=c^d mod n) and then split m into blocks?
I know the block size should have something to do with the length of n which in my case is 22.
How should I think and are there any basic rules that I should follow when "block dividing"?

Any kind of help is appreciated!

#2
December 25th, 2011, 11:48 AM
 christopherx
Registered User

Join Date: Dec 2011
Posts: 11
Time spent in forums: 1 h 32 m 54 sec
Reputation Power: 0
Decryption is the mathematical inverse of encryption, so you do everything opposite, including the order. Was the plaintext encrypted then split into blocks or split into blocks then encrypted?

#3
December 26th, 2011, 09:22 AM
 ogward
Registered User

Join Date: Dec 2011
Posts: 3
Time spent in forums: 1 h 10 m 37 sec
Reputation Power: 0
Quote:
 Originally Posted by christopherx Decryption is the mathematical inverse of encryption, so you do everything opposite, including the order. Was the plaintext encrypted then split into blocks or split into blocks then encrypted?

That I don't know but I can assume the latter.
Because the encrypted text consists of 2145 characters divided into blocks of 22, if I remember correctly.

#4
December 26th, 2011, 05:28 PM
 christopherx
Registered User

Join Date: Dec 2011
Posts: 11
Time spent in forums: 1 h 32 m 54 sec
Reputation Power: 0
Quote:
 Originally Posted by ogward That I don't know but I can assume the latter. Because the encrypted text consists of 2145 characters divided into blocks of 22, if I remember correctly.

Righto. Decrypt, then split into blocks. If that doesn't work, you can always try the other way. More often than not, you'll get a plaintext from a last ditch attempt that you never thought would work in the first place

#5
December 30th, 2011, 04:25 PM
 ogward
Registered User

Join Date: Dec 2011
Posts: 3
Time spent in forums: 1 h 10 m 37 sec
Reputation Power: 0
Thanks.
But for some reason I want to take each block and decrypt it and when all blocks are decrypted put them together.
why? I think(not sure tho) that the text is then encrypted again with some substitution cipher.
if it is I could do frequency analysis.

How does that sound?

#6
December 30th, 2011, 09:32 PM
 christopherx
Registered User

Join Date: Dec 2011
Posts: 11
Time spent in forums: 1 h 32 m 54 sec
Reputation Power: 0
It depends on the complexity of the substitution cipher. Are we talking about a simple substitution cipher (A = C, B = L) or a polyalphabetic cipher? ( Viginere Cipher, running key, etc)

In terms of the block cipher, the point of a block cipher is that the cipher works on a set block of plaintext. So yes, each block is decrypted then concatenated.

Frequency analysis is the best way to attack a linear substitution cipher, but if there's any higher level of diffusion then you will have to employ a few cleverer tactics, but we'll deal with that if we have too

Overall, your approach sounds good to me, just be careful your not making too many assumptions.

 Viewing: Dev Shed Forums > System Administration > Security and Cryptography > RSA block decryption