Browse Source

library/ssh_cert.py: make it works with python3

Mainly string vs bytes-string issues.

Compatibility with Python 2.x now broken.
python3
Zolfa 4 years ago
parent
commit
c760358160
Signed by: zolfa GPG Key ID: E1A43B038C4D6616
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      library/ssh_cert.py

+ 4
- 4
library/ssh_cert.py View File

@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
from datetime import datetime
import string
@ -45,7 +45,7 @@ def not_valid(cert_timestamps):
def cert_type(lines):
for l in lines:
if l.startswith('Type'):
return string.split(l, maxsplit=2)[1:]
return l.split(maxsplit=2)[1:]
def valid_from(lines):
@ -79,7 +79,7 @@ def main():
'-f', result['ca']['path'],
])
ca_lines = string.split(ca_output, maxsplit=2)
ca_lines = ca_output.decode().split(maxsplit=2)
result['ca']['fingerprint'] = ca_lines[1]
result['ca']['comment'] = ca_lines[2]
@ -88,7 +88,7 @@ def main():
'-L',
'-f', result['certificate']['path'],
])
cert_lines = [line.strip() for line in cert_output.split('\n')]
cert_lines = [line.strip() for line in cert_output.decode().split('\n')]
result['certificate']['signin_ca'] = signin_ca(cert_lines)
result['certificate']['valid'] = {


Loading…
Cancel
Save