>>> RSA_2048_PREFIX = 
>>> "30820122300D06092A864886F70D01010105000382010F003082010A02820101";
>> There are plenty of “2048-bit RSA keys” where the modulus is actually 
>> 2047-bits long (multiply two 1024-bit primes and you get a 2048-bit or 
>> 2047-bit modulus). There is no extra leading 0x00 byte when DER-encoding a 
>> 2047-bit modulus. Consequently, concatenating a fixed prefix to build a 
>> DER-encoding is likely to cause interop bugs.

> I'm sorry, what?  Could you please provide an example of two 1024-bit primes 
> that multiply to a 2047-bit value?  Last I checked, (1<<N + x)*(1<<N + y) > 
> 1<<(2*N).

p1 = 2^1023 + 1
p2 = 2^1023 + 3
n = p1 * p2 = 2^2046 + 2^1025 + 3

p1 & p2 are 1024-bit numbers (probably not actually prime).
Their product n is a 2047-bit number.

The calculation is (1<<N - x)*(1<<N - y) = (1<<2N - z)

--
James Manger
_______________________________________________
jose mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/jose

Reply via email to