Esempio n. 1
0
class GPGTestCase(unittest.TestCase):
    def setUp(self):
        self.gpg = GPG()

    def testCorrectnessOfRFC1991LiteralDataPacket(self):
        "Test correctness of RFC1991 literal data packet generation"
        self.assertEquals(null_date(self.gpg.store(CERT).data), null_date(CERT_RFC1991_LITERAL_DATA_PACKET))
Esempio n. 2
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
    )