[PYTHON-CRYPTO] RSA exponent

Larry Bugbee bugbee at SEANET.COM
Wed Aug 4 07:13:29 CEST 2004


Thanks Dan, that made things work a LOT better.  It seems the 4-byte
prefix applies only to elements extracted from the key objects and not
to other binary strings such as hashes and signatures.

Now for the two-bit rhetorical question.  Why only the key elements?
Shouldn't the key elements follow the same set of rules?

Anyway, my thanks,

Larry


On Aug 3, 2004, at 3:42 PM, Dan Berger wrote:

> It's likely because OpenSSL (and the M2 wrapper) are returning an MPI -
> which has it's length as the first four bytes and remainder being the
> number in big-endian byte order.
>
> On Tue, 2004-08-03 at 21:39 +0200, Larry Bugbee wrote:
>> I could use some help...
>>
>> When I generate a RSA key pair I use 65537 as the exponent.  Later
>> when I go
>> to extract the exponent I get 50397185.  In hex it's actually 00 00
>> 00 03 01
>> 00 01, but if I discard the 4 high order bytes, 01 00 01 evaluates to
>> 65537.
>>  Perhaps you have a suggestion?

[snip]



More information about the python-crypto mailing list