* Marek Marcola wrote:
* Philippe Stellwag wrote:
is it possible to change the OpenSSL RSA functions so that I can use
a different - may be a variable - block size. At the moment the block
size on the OpenSSL RSA functions depends on the length of the RSA
key pair and the kind of padding (following PKCS#1 v1.5, which means
11 byte random data):

        key lenght      block size      available space

        2024 bit                256 byte                245 byte
        1024 bit                128 byte                105 byte
        768 bit         96 byte         85

Normally, on symmetric encryption the block size _must_ be the same
as the key lenght.
Not exactly, for example:
 AES128: key: 16bytes, block: 16bytes
 AES192: key: 24bytes, block: 16bytes
 AES256: key: 32bytes, block: 16bytes
 DES3  : key: 24bytes, block: 8bytes
and of course des which has key_len == block_len:
 DES   : key: 8bytes,  block: 8bytes
Okay, thanks for that correction!
 But on asymmetric encryption methods - I think -
the block size not depends on that restriction, or is there another
point, which forces such a fixed block size?
Amount of data which may be encrypted with RSA depends on algorithm.
If you have private key (d,n) and public key (e,n) where n=p*q,
where p and q are prime numbers.
Encryption of plain P:
 C = P^e mod n
Decryption of cipher C:
 P = C^d mod n

As you see, you get always result as number from 0 to n-1 (modulo
operation) and n is RSA key size.
To be more specific, RSA operation is performed inside multiplicative
group.
Okay, that means that plain P (interpreted as an integer figure) must be smaller than n, so that it is between the multiplicative group, like the following example:

        n=3*5
        phi(n)=(3-1)*(5-1)=8
        e=3
        d=(4*8+1)/3=11 (4 is choosen by me => see Euler)

        P=2 (should work)
        C=2^3 mod 15=8
        P=8^11 mod 15=2 (that's it)

P=41 (not between the multiplicative group (because >15) and so not unique => shouldn't work)
        C=41^3 mod 15=11
        P=11^11 mod 15=(believe me (-:)=11 (not the same integer as 41,
                but the same in the multiplicative group: 41 mod 15 = 11 mod 15)

Okay, that's clear!

But can I use e.g. a 1024 bit key pair with a block size of 116 byte, that is not depending on the problem shown above, isn't it?! What is the security reason, why not to do this?

I have a small-sized EEPROM with 116 bytes and I try to use a key pair with > 928 bit length (= 116 byte block size and 105 byte for unencrypted user data).

Thanks a lot for that posting!

Philippe
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to