git_multisig/headerextract.py

23 lines
336 B
Python

import sys
#inFile = sys.stdin
beginSig = "-----BEGIN PGP"
endSig = "-----END PGP"
output = ""
keyBegun = False
for line in sys.stdin:
sigIndex = 0
if beginSig in line:
if keyBegun:
exit(1)
keyBegun = True
sigIndex = line.find(beginSig)
if keyBegun:
output += line[sigIndex:]
if endSig in line:
break
print(output)