Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: third_party/gsutil/third_party/pyasn1-modules/tools/crldump.py

Issue 1377933002: [catapult] - Copy Telemetry's gsutilz over to third_party. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Rename to gsutil. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/python
2 #
3 # Read X.509 CRL on stdin, print them pretty and encode back into
4 # original wire format.
5 # CRL can be generated with "openssl openssl ca -gencrl ..." commands.
6 #
7 from pyasn1_modules import rfc2459, pem
8 from pyasn1.codec.der import encoder, decoder
9 import sys
10
11 if len(sys.argv) != 1:
12 print("""Usage:
13 $ cat crl.pem | %s""" % sys.argv[0])
14 sys.exit(-1)
15
16 asn1Spec = rfc2459.CertificateList()
17
18 cnt = 0
19
20 while 1:
21 idx, substrate = pem.readPemBlocksFromFile(sys.stdin, ('-----BEGIN X509 CRL- ----', '-----END X509 CRL-----'))
22 if not substrate:
23 break
24
25
26 key, rest = decoder.decode(substrate, asn1Spec=asn1Spec)
27
28 if rest: substrate = substrate[:-len(rest)]
29
30 print(key.prettyPrint())
31
32 assert encoder.encode(key, defMode=False) == substrate or \
33 encoder.encode(key, defMode=True) == substrate, \
34 'pkcs8 recode fails'
35
36 cnt = cnt + 1
37
38 print('*** %s CRL(s) re/serialized' % cnt)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698