SoftAP Java Example Help

Hi @jdarden

I am sorry that I cannot answer your Java question directly but I can tell you a bit about the key format you have there. It is easy to check the output by putting the binary data into a file and then base64 encoding that and add the beginning and ending headers like this:

-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCQ+QzgXW/TnYiYUOPhcSn3Jpp504R/niUvNUKb
oG3Pft+G+z2gbjBgOjIViiW4cZhZ2zxy2u0mO4WtNr5wt/qLKA4mp5qTw0ru5FUHS2pkNo0A4BkE
mKbpuedKZD4EaQvlJYHak7Gr8d/Ir4LQsH11mUg9EDB8gqyyeACQ2iaqPwIDAQAB
-----END PUBLIC KEY-----

Notice that I have deleted all the zeros after the exponent. If your key was signed, that is where the signature would be.

When I run this through openssl, it looks OK to me:

% openssl rsa -pubin -inform PEM -in foo.tmp -noout -text
Public-Key: (1024 bit)
Modulus:
    00:90:f9:0c:e0:5d:6f:d3:9d:88:98:50:e3:e1:71:
    29:f7:26:9a:79:d3:84:7f:9e:25:2f:35:42:9b:a0:
    6d:cf:7e:df:86:fb:3d:a0:6e:30:60:3a:32:15:8a:
    25:b8:71:98:59:db:3c:72:da:ed:26:3b:85:ad:36:
    be:70:b7:fa:8b:28:0e:26:a7:9a:93:c3:4a:ee:e4:
    55:07:4b:6a:64:36:8d:00:e0:19:04:98:a6:e9:b9:
    e7:4a:64:3e:04:69:0b:e5:25:81:da:93:b1:ab:f1:
    df:c8:af:82:d0:b0:7d:75:99:48:3d:10:30:7c:82:
    ac:b2:78:00:90:da:26:aa:3f
Exponent: 65537 (0x10001)

so the modulus starts at 00 90 f9 0c… and runs like you thought to …26 aa 3f. And the exponent is the common 2^16+1.

1 Like