[pycrypto] Crypto question

Legrandin helderijs at gmail.com
Mon Aug 5 13:26:55 PDT 2013


Hi Leon,

It's clear from section 9.1.1 of RFC3444 (EMSA-PSS-ENCODE function),
where the encoded value is called EM.

>From step 12:
len(EM) = len(maskedDB) + len(hash) + len(0xBC)
            = len(maskedDB) + len(hash) + 1

>From step 10:
len(EM) = len(DB) + len(hash) + 1

>From step 8:
len(EM) = len(PS) + len(0x01) + len(salt) + len(hash) + 1
            = len(PS) + len(salt) + len(hash) + 2

And finally from step 7 it must be that:
len(EM) >= len(salt) + len(hash) + 2


> In PKCS_PSS.py @ 254: A value of 2 is added. Why 2?
>
> This came up when I was testing Sign/Verify using RSA1024 and SHA512
> combination.


More information about the pycrypto mailing list