internals.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:aptrepo 作者: jwodder 项目源码 文件源码
def detach_signature(txt):
    # See RFC 4880, section 7
    # cf. debian.deb822.Deb822.split_gpg_and_payload (which doesn't handle dash
    # escaping and doesn't verify that the input is well-formed)
    m = re.match(r'^\s*-----BEGIN PGP SIGNED MESSAGE-----\n'
                 r'(?:[^\n]+\n)*'
                 r'\n'
                 r'(.*)\n'
                 r'-----BEGIN PGP SIGNATURE-----\n'
                 r'(.*)\n'
                 r'-----END PGP SIGNATURE-----\s*$',
                 re.sub(r'\r\n?', '\n', txt), flags=re.S)
    if m:
        ### TODO: Also return the armor headers?
        return (re.sub('^- ', '', m.group(1), flags=re.M).replace('\n', '\r\n'),
                m.group(2))
    else:
        return (txt, None)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号