python-keyczar/0001-Fixes-output-value-changes-between-older-and-newer-p.patch
2019-09-16 09:43:07 +00:00

31 lines
1.2 KiB
Diff

From: =?utf-8?q?Pierre-Elliott_B=C3=A9cue?= <becue@crans.org>
Date: Tue, 20 Feb 2018 11:58:06 +0100
Subject: Fixes output value changes between older and newer pyasn versions
---
src/keyczar/util.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/keyczar/util.py b/src/keyczar/util.py
index 9e6f217..006eadb 100644
--- a/src/keyczar/util.py
+++ b/src/keyczar/util.py
@@ -172,8 +172,7 @@ def ParseX509(x509):
if len(seq) != 2: # need two fields in SubjectPublicKeyInfo
raise errors.KeyczarError("Illegal X.509 String.")
[oid, alg_params] = ParseASN1Sequence(seq[0])
- pubkey = decoder.decode(univ.OctetString(BinToBytes(seq[1].
- prettyPrint()[2:-3])))[0]
+ pubkey = decoder.decode(univ.OctetString(BinToBytes(seq[1])))[0]
# Component 1 should be a BIT STRING, get raw bits by discarding extra chars,
# then convert to OCTET STRING which can be ASN.1 decoded
params = {}
@@ -251,6 +250,7 @@ def MakeEmsaMessage(msg, modulus_size):
def BinToBytes(bits):
"""Convert bit string to byte string."""
+ bits = str(bits)
bits = _PadByte(bits)
octets = [bits[8 * i:8 * (i + 1)] for i in range(len(bits) / 8)]
return "".join([chr(int(x, 2)) for x in octets])