From e866326cc8f58b781aa2d30d8bf52a65dfce869c Mon Sep 17 00:00:00 2001 From: bugdone Date: Wed, 6 Jul 2016 18:12:18 +0300 Subject: [PATCH] Fix private key export --- dnssec.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dnssec.py b/dnssec.py index 99c7206..7246499 100644 --- a/dnssec.py +++ b/dnssec.py @@ -938,8 +938,11 @@ def to_file(self, domain, directory=None, file=None): keydata[field] = base64.b64encode(f) dmp1 = Crypto.Util.number.long_to_bytes(key.d % (key.p - 1)) keydata['dmp1'] = base64.b64encode(dmp1) - dmq1 = Crypto.Util.number.long_to_bytes(key.d % (key.p - 1)) + dmq1 = Crypto.Util.number.long_to_bytes(key.d % (key.q - 1)) keydata['dmq1'] = base64.b64encode(dmq1) + # key.u == inverse(p, q), but rfc3447 needs inverse(q, p) + u = Crypto.Util.number.long_to_bytes(inverse(key.q, key.p)) + keydata['u'] = base64.b64encode(u) # Write to file if file: