Hello,

I have a short question regarding the output/format of DSA keys.

I observed, that the output of those keys contains leading zeros for priv,
pub, P and Q but not for G (see example below).
The leading zero-byte seems wrong to me: I expected a 20 byte private key
but the private key output is 21 bytes long.
Same for the public key: It's output is 129 bytes where it should be 128
bytes, shouldn't it?
Furthermore, whenever working with the openssl code directly, I don't get
those leading zeros.

Is this correct or is my implementation bugged?

Best regards,
Henrik Ziegeldorf

-----------------

Example output:

$ openssl dsa -in dsa_key -text
read DSA
key

Private-Key: (1024
bit)

priv:

    00:94:af:b8:01:d2:cd:02:35:60:9e:c8:08:02:62:
    0b:7c:28:1b:e6:fb
pub:
    00:94:5b:09:da:38:3c:e2:6c:2b:60:08:de:63:2b:
    48:d0:ca:e5:4d:5a:bb:9e:cd:90:3f:d7:a3:43:a0:
    83:1e:60:5e:c1:80:12:c0:60:4e:38:6c:ad:ae:13:
    d3:2c:4c:14:56:c6:5a:4d:d5:a0:54:85:8d:43:5f:
    c5:cf:73:e9:86:46:1e:3b:42:93:f8:dc:b2:7a:a1:
    e2:e1:80:f3:30:86:19:d0:18:54:b5:7f:58:ee:02:
    d3:40:95:dc:7e:d2:9d:0a:02:ff:14:f7:87:2c:b4:
    bc:5b:73:35:82:e8:cb:19:5c:7a:b6:f7:1f:95:7b:
    15:4a:53:8e:40:e0:a8:a0:fc
P:
    00:bc:82:9c:83:81:27:a6:83:f3:d3:4e:3d:9f:29:
    09:57:fe:47:26:10:94:9c:63:5a:3f:49:d9:64:42:
    61:b1:36:4f:4a:84:30:18:3e:fe:e0:1b:3b:fe:66:
    a6:65:03:db:9f:e3:0c:c3:13:5c:ac:02:46:b3:ee:
    69:43:2b:eb:cb:b6:7c:ad:f8:b1:cc:3c:d0:01:9b:
    b5:d0:b2:94:32:1a:e3:da:68:69:81:a3:2a:62:0d:
    8b:fc:d9:b6:e0:f9:69:91:6e:e3:d2:79:ca:a8:d8:
    b4:2f:d0:ed:9d:54:da:c0:61:d0:08:dd:11:42:1e:
    70:f8:7f:d1:f2:90:57:5a:33
Q:
    00:d0:0e:c3:38:ba:97:e9:f9:f2:c4:30:f0:f0:a6:
    54:97:96:bd:cf:a3
G:
    33:9a:ac:d6:06:dd:7a:8a:42:c5:93:f8:76:92:5d:
    6b:17:9a:a7:08:7e:8d:26:3f:7e:41:74:b2:6c:85:
    ff:ce:07:03:bd:df:f4:1a:65:1c:36:d7:0a:1b:91:
    29:63:d1:67:e4:6f:ec:4e:97:b3:b1:4a:67:84:93:
    ab:24:e0:83:06:2d:dc:78:46:92:b7:d2:1c:88:19:
    95:fa:ca:ef:46:da:b5:c9:df:52:a4:1d:97:dd:b5:
    33:8d:64:22:a4:68:a4:b8:96:b7:81:9d:94:a2:3c:
    aa:f4:d7:e7:71:06:23:73:03:50:a6:b2:73:92:62:
    a6:c1:3d:03:d8:7c:c7:b5

Reply via email to