> Hello
>
> I have question.
>
> I tried generate public key via openssl (RSA,1024) and I always got 162B
> large file.
>
> Now I want to generate public key via JAVA Cryptography library.
> I'm repeatedly generating public. For example I created RSA keys with 1024
> bit length, but sometimes I got 162B large file and another time
> 161B large
> file with public key .
> I read in some document that the large of RSA public key with 1024bit
> modulus must be 162 B.
>
> Can somebody explain me what is wrong.

It's hard to be sure without seeing a short file, but my bet is simply that
the keys that are one byte shorter have a first byte small enough that they
don't need a preceding zero to indicate their sign.

Post an "asn1parse" and the modulus of both a 161-byte key and a 162-byte
key. I bet it will be obvious.

openssl rsa -pubin -inform der -text
and
openssl asn1parse -inform der

My bet is the modulus from a 162 byte file will look like this:

Modulus (1024 bit):
    00:bb:7e:1c:17:fb:8a:3b:2f:20:d4:33:a6:1f:13:
    21:6c:8f:33:08:be:6f:ef:29:08:26:be:13:3e:1c:

While from a 162 byte file, there will not be the leading '00'. In this
case, the leading zero byte is needed to indicate that the number is
positive.

DS


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

Reply via email to