Paste number 311222: gpg what sign

Paste number 311222: gpg what sign
Pasted by: phf
When:3 years, 11 months ago
Share:Tweet this! | http://paste.lisp.org/+6O52
Channel:None
Paste contents:
Raw Source | XML | Display As

from dulwich.objects import Commit
from StringIO import StringIO
c = Commit.from_path('./tmp/a/.git/objects/ee/b821595fcf3d2f4f70fcc52fa57f8f69d056a1')
b = c.as_raw_string()
payload = StringIO()
signature = StringIO()
gpg_sig_header =  "gpgsig"
gpg_sig_header_len = len(gpg_sig_header)
line=0
tail=len(b)
in_sig = 0
saw_sig = 0
while line < tail:
    sig = None
    next = b.find('\n', line, tail)
    next = next + 1 if next != -1 else tail
    if in_sig and b[line] == ' ':
        sig = line + 1
    elif b[line:].startswith(gpg_sig_header) and b[line+gpg_sig_header_len] == ' ':
        sig = line + gpg_sig_header_len + 1
    if sig:
        signature.write(b[sig:next])
        saw_sig = 1
        in_sig = 1
    else:
        if b[line] == '\n':
            next = tail
        payload.write(b[line:next])
        in_sig = 0
    line = next
def write(filename, data):
    with open(filename, 'w') as outp:
        outp.write(data)
write('foo.txt', payload.getvalue())
write('foo.sig', signature.getvalue())

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.