[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about encoding of RSA public Exponent



Hello,
I looked through the archives and couldn't find the answer to this
question.
There was info about two's complement form for integers but nothing
about
the public exponents.
If this is not the appropriate forum for this question - I apologize -
feel free to
point me to the proper forum.

I've spent some time trying to decode the RSA public key which is part
of
the X.509 certificate.  More specifically, it is the key used to
exchange with a
Cisco router when doing IKE with encrypted nonces.  I want to know
what information a cisco router expects and what I shoud expect when
copying the RSA key from a cisco router

For the RSA public key, there is a modulus and a public exponent.  I
generated
a 1024 bit RSA key.

The modulus is    0241 00C8934A 22BE0C99 ...

02                means it's an integer
41                is the length of the modulus - it's 41 rather than 40
due to the leading 00 to prevent it
                    from being interpreted as a negative value
00C8...       is the modulus


The public exponent is 020301 0001

02              means it's an integer
03              is the length of the public exponent
010001     is the public exponent.

The public exponent is what confuses me - it doesn't seem to be in two's
complement form.
The exponent value is 65537
Hex  is                                        010001
Binary is                                    0000 0001 0000 0000 0000
0001
Two's complement is             1111 1110 1111 1111 1111 1110  + 1
hex is                                             F       E
F        F      F        F

I would have thought this would have to be encoded as
020400FEFFFF

Could you tell me what I'm overlooking in this case?

Oh, one other quick question  - Is  the modulus  encoded as a string of
bytes
or a  multiprecision integer?

Thank you very much,
Jim Comen