Use the new EMSA-PKCS1-v1_5 function in verify() too.
This commit is contained in:
+3
-16
@@ -606,23 +606,10 @@ def verify(message, debuglog=None, dnsfunc=dnstxt):
|
|||||||
d = h.digest()
|
d = h.digest()
|
||||||
if debuglog is not None:
|
if debuglog is not None:
|
||||||
print >>debuglog, "verify digest:", " ".join("%02x" % ord(x) for x in d)
|
print >>debuglog, "verify digest:", " ".join("%02x" % ord(x) for x in d)
|
||||||
|
try:
|
||||||
dinfo = asn1_build(
|
sig2 = EMSA_PKCS1_v1_5_encode(d, modlen, hashid)
|
||||||
(SEQUENCE, [
|
except ParameterError:
|
||||||
(SEQUENCE, [
|
|
||||||
(OBJECT_IDENTIFIER, hashid),
|
|
||||||
(NULL, None),
|
|
||||||
]),
|
|
||||||
(OCTET_STRING, d),
|
|
||||||
])
|
|
||||||
)
|
|
||||||
if debuglog is not None:
|
|
||||||
print >>debuglog, "dinfo:", " ".join("%02x" % ord(x) for x in dinfo)
|
|
||||||
if len(dinfo)+3 > modlen:
|
|
||||||
if debuglog is not None:
|
|
||||||
print >>debuglog, "Hash too large for modulus"
|
|
||||||
return False
|
return False
|
||||||
sig2 = "\x00\x01"+"\xff"*(modlen-len(dinfo)-3)+"\x00"+dinfo
|
|
||||||
if debuglog is not None:
|
if debuglog is not None:
|
||||||
print >>debuglog, "sig2:", " ".join("%02x" % ord(x) for x in sig2)
|
print >>debuglog, "sig2:", " ".join("%02x" % ord(x) for x in sig2)
|
||||||
print >>debuglog, sig['b']
|
print >>debuglog, sig['b']
|
||||||
|
|||||||
Reference in New Issue
Block a user