blob: 4a439a30df7702876c17b7042fc9de663b4325a0 [file] [log] [blame]
--- a/utils/key2pub.py
+++ b/utils/key2pub.py
@@ -1,9 +1,9 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
try:
from M2Crypto import RSA
-except ImportError, e:
+except ImportError as e:
sys.stderr.write('ERROR: Failed to import the "M2Crypto" module: %s\n' % e.message)
sys.stderr.write('Please install the "M2Crypto" Python module.\n')
sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n')
@@ -17,7 +17,7 @@ def print_bignum(output, name, val):
for v in val:
if not idx:
output.write('\t')
- output.write('0x%.2x, ' % ord(v))
+ output.write('0x%.2x, ' % v)
idx += 1
if idx == 8:
idx = 0
@@ -40,7 +40,7 @@ struct key_params {
static const struct key_params keys[] = {
''')
- for n in xrange(n + 1):
+ for n in range(n + 1):
output.write(' KEYS(e_%d, n_%d),\n' % (n, n))
output.write('};\n')
@@ -49,7 +49,7 @@ files = sys.argv[1:-1]
outfile = sys.argv[-1]
if len(files) == 0:
- print 'Usage: %s input-file... output-file' % (sys.argv[0], )
+ print('Usage: %s input-file... output-file' % (sys.argv[0], ))
sys.exit(2)
output = open(outfile, 'w')