diff options
author | Ilya Etingof <etingof@gmail.com> | 2016-03-12 09:25:34 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2016-03-12 09:25:34 +0100 |
commit | 663aee06c5ede905c6e84df3f9f489d2843b6159 (patch) | |
tree | 379a8c2744782061116c3c0742777b2f3a64a286 /tools/pkcs1dump.py | |
parent | 71ba606413ce29728541e426a5068981204b1859 (diff) | |
download | pyasn1-modules-663aee06c5ede905c6e84df3f9f489d2843b6159.tar.gz |
refactored for github and travis
Diffstat (limited to 'tools/pkcs1dump.py')
-rwxr-xr-x[-rw-r--r--] | tools/pkcs1dump.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/pkcs1dump.py b/tools/pkcs1dump.py index 8ab1954..da364f7 100644..100755 --- a/tools/pkcs1dump.py +++ b/tools/pkcs1dump.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # This file is part of pyasn1-modules software. # @@ -20,7 +20,7 @@ $ cat rsakey.pem | %s""" % sys.argv[0]) cnt = 0 -while 1: +while True: idx, substrate = pem.readPemBlocksFromFile(sys.stdin, ('-----BEGIN RSA PRIVATE KEY-----', '-----END RSA PRIVATE KEY-----'), ('-----BEGIN DSA PRIVATE KEY-----', '-----END DSA PRIVATE KEY-----') ) if not substrate: break @@ -34,12 +34,13 @@ while 1: key, rest = decoder.decode(substrate, asn1Spec=asn1Spec) - if rest: substrate = substrate[:-len(rest)] + if rest: + substrate = substrate[:-len(rest)] print(key.prettyPrint()) assert encoder.encode(key) == substrate, 'pkcs8 recode fails' - cnt = cnt + 1 + cnt += 1 print('*** %s key(s) re/serialized' % cnt) |