rsa - determining hash function used in digital signature -
i have digital signature (rsa - pkcs#1). after decrypting rsa public key following 128 bytes
00 01 ff ff ff .. ff 00 30 31 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 04 20 77 51 1b f4 d7 17 d7 ad 8c 2d e5 89 2a ca e0 6d a3 c0 7d 13 4d d7 b8 01 14 87 03 00 69 e4 9b b3
pkcs#1 padding removed, 51 bytes left:
30 31 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 04 20 77 51 1b f4 d7 17 d7 ad 8c 2d e5 89 2a ca e0 6d a3 c0 7d 13 4d d7 b8 01 14 87 03 00 69 e4 9b b3
i 2 things this:
is possible determine hash function used? encoded algorithm id should prepended actual body of digest, possible tell algorithm raw bytes?
where actual digest start (how long head / digest is)?
this appears emsa-pkcs1-v1_5 described in rfc 3447, means after removing header , padding, have der encoding of algorithmidentifier
followed hash value itself.
from rfc:
for 6 hash functions mentioned in appendix b.1, der encoding t of
digestinfo
value equal following:[...]
sha-256:
(0x)30 31 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 04 20 || h.
so in example, hash value sha-256 hash starting 77511bf4d7...
.
Comments
Post a Comment