summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2017-01-19 14:30:23 +0100
committerMartin Basti <mbasti@redhat.com>2017-01-31 18:33:27 +0100
commit47e76e16ef2e5d714881f3cce204611a95b4e5c8 (patch)
treed12500d91fe32971900144ce43b1c4a39bd5a41e /ipapython
parentd5ab0637fe89cbcb61491fe08b7376aeaf7ccdb8 (diff)
downloadfreeipa-47e76e16ef2e5d714881f3cce204611a95b4e5c8.tar.gz
freeipa-47e76e16ef2e5d714881f3cce204611a95b4e5c8.tar.xz
freeipa-47e76e16ef2e5d714881f3cce204611a95b4e5c8.zip
py3: fingerprint_hex_sha256: fix encoding/decoding
https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Christian Heimes <cheimes@redhat.com>
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/ssh.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/ipapython/ssh.py b/ipapython/ssh.py
index 57752aedc..2edfa8ab3 100644
--- a/ipapython/ssh.py
+++ b/ipapython/ssh.py
@@ -192,9 +192,8 @@ class SSHPublicKey(object):
def fingerprint_hex_sha256(self):
# OpenSSH trims the trailing '=' of base64 sha256 FP representation
- # Using unicode argument converts the result to unicode object
- fp = base64.b64encode(sha256(self._key).digest()).rstrip(u'=')
- return 'SHA256:{fp}'.format(fp=fp)
+ fp = base64.b64encode(sha256(self._key).digest()).rstrip(b'=')
+ return u'SHA256:{fp}'.format(fp=fp.decode('utf-8'))
def _fingerprint_dns(self, fpfunc, fptype):
if self._keytype == 'ssh-rsa':