Exemplo n.º 1
0
def make_document(data):
    """
    Make OpenPGP document containing one-pass signature packet,
    literal packet and binary signature packet

    See details in RFC4880
    """
    g = GPG(gnupghome=settings.GNUPG_HOME)
    header = "%s%s" % (chr(144), chr(13)) #0x90 0x0D
    signature_packet = extract_signature_packet(extract_signature(data))
    body = strip_signature(data).rstrip()
    literal_packet = g.store(body).data
    one_pass_signature_packet = make_one_pass_signature_packet(signature_packet)
    return "%s%s%s%s" % (
        header,
        one_pass_signature_packet,
        literal_packet,
        signature_packet
    )
Exemplo n.º 2
0
 def get_signature(self):
     try:
         signature = extract_signature(self.data[1])
     except TemplateError:
         return None
     return signature