rsa implementation question

Ajay Brar abra9823 at mail.usyd.edu.au
Wed Aug 11 03:17:15 EDT 2004


thanks
i am using RSa for signing documents and hence decrypting and then 
encrypting to verify?
 what i was rather trying to get at was what if the plaintext is too 
large? if the plaintext is greater than (log2 n)/8, would you just throw 
an error or would you break the plaintext in parts.
the reason i am asking this is because i am timing the sign operations 
using the pcrypto package. the time is constant relative to the size of 
the plaintext (as you would expect) but at a certain point there is an 
increase in the time taken to sign. this corresponds to a very large 
plaintext.
that is why i was wondering about the  block thing.



Heiko Wundram wrote:

>Am Mittwoch, 11. August 2004 07:08 schrieb Ajay:
>  
>
>>just like to know how the RSA implementation in the pcrypto package works.
>>Does it operate in blocks, if yes, what is the size of the blocks?
>>    
>>
>
>RSA (Rivest-Shamir-Adleman encryption) never works in "blocks", as there is no 
>notion of blocks in public key cryptography, there's only the notion of doing 
>an operation on plaintext modulo a large prime n.
>
>Now, you could call (log2 n)/8 the block size in bytes of RSA for a certain 
>encryption prime, but I'd never talk of block sizes with RSA, as normally you 
>don't use RSA (or public-key cryptography in general) to encrypt plaintext a 
>block at a time, but rather to encrypt a random string of bytes [len(s) <= 
>(log2 n)/8 for the modulo prime of the algorithm], which is used as the key 
>for a normal symmetric encryption algorithm, to which you feed the blocks.
>
>Thus, the receiver (and also the sender) only has to make one expensive 
>calculation (retrieving the key from the encrypted RSA packet), whereas 
>decrypting the cyphertext (or encrypting it) is done using a symmetric 
>cypher, which has the advantage of being much faster to compute than a 
>public-key cypher.
>
>Anyway, if you're interested in how symmetric and/or public-key cryptography 
>work, read up on:
>
>http://www.cacr.math.uwaterloo.ca/hac/
>
>especially chapters 7 and 8.
>
>Heiko.
>  
>


-- 
Ajay Brar
CS Honours 2004
Smart Internet Technology Research Group

http://www.it.usyd.edu.au/~abrar1




More information about the Python-list mailing list