Пример #1
0
from openpgp.sap.crypto import verify_ElGamal
from openpgp.sap.crypto import verify

# package help
from openpgp.code import *
from openpgp.sap.list import list_pkts, list_msgs
from openpgp.sap.util.strnum import int2quadoct
from openpgp.sap.pkt.Signature import create_SignatureSubpacket

# test help
from support import read_test_file, sepjoin, curdir

txt = 'some silly message' # message to sign
k = 17 # simple k value for DSA and ElGamal sigs
# these pickles are all PyCrypto instances
dsakey = pickle.load(file(sepjoin([curdir,'pickles','dsa_key.py']), 'rb'))
rsakey = pickle.load(file(sepjoin([curdir,'pickles','rsa_key.py']), 'rb'))
elgkey = pickle.load(file(sepjoin([curdir,'pickles','elg_key.py']), 'rb'))
# one-pass signatures from GPG..
dsasig_d = read_test_file(['pgpfiles','sig','sig.DSAELG1.onepass.gpg'])
rsasig_d = read_test_file(['pgpfiles','sig','sig.RSA1.onepass.gpg'])
# ..and their corresponding public keys
dsapubkey_d = read_test_file(['pgpfiles','key','DSAELG1.pub.gpg'])
dsaseckey_d = read_test_file(['pgpfiles','key','DSAELG1.sec.gpg'])
rsapubkey_d = read_test_file(['pgpfiles','key','RSA1.pub.gpg'])


class A0PyCryptoSigTest(unittest.TestCase):
    """PyCrypto Signature Tests

    These tests just check that PyCrypto stuff works. This is a little
Пример #2
0
from openpgp.sap.crypto import verify_ElGamal
from openpgp.sap.crypto import verify

# package help
from openpgp.code import *
from openpgp.sap.list import list_pkts, list_msgs
from openpgp.sap.util.strnum import int2quadoct
from openpgp.sap.pkt.Signature import create_SignatureSubpacket

# test help
from support import read_test_file, sepjoin, curdir

txt = 'some silly message'  # message to sign
k = 17  # simple k value for DSA and ElGamal sigs
# these pickles are all PyCrypto instances
dsakey = pickle.load(file(sepjoin([curdir, 'pickles', 'dsa_key.py']), 'rb'))
rsakey = pickle.load(file(sepjoin([curdir, 'pickles', 'rsa_key.py']), 'rb'))
elgkey = pickle.load(file(sepjoin([curdir, 'pickles', 'elg_key.py']), 'rb'))
# one-pass signatures from GPG..
dsasig_d = read_test_file(['pgpfiles', 'sig', 'sig.DSAELG1.onepass.gpg'])
rsasig_d = read_test_file(['pgpfiles', 'sig', 'sig.RSA1.onepass.gpg'])
# ..and their corresponding public keys
dsapubkey_d = read_test_file(['pgpfiles', 'key', 'DSAELG1.pub.gpg'])
dsaseckey_d = read_test_file(['pgpfiles', 'key', 'DSAELG1.sec.gpg'])
rsapubkey_d = read_test_file(['pgpfiles', 'key', 'RSA1.pub.gpg'])


class A0PyCryptoSigTest(unittest.TestCase):
    """PyCrypto Signature Tests

    These tests just check that PyCrypto stuff works. This is a little
import os
import unittest

# test target
from openpgp.sap.crypto import verify

# package help
from openpgp.sap.armory import list_armored
from openpgp.sap.list import list_pkts, list_msgs

# test help
from support import sepjoin, read_test_file

# pgp6.5.3 RSA
p653rsadir = sepjoin(['pgpfiles', 'interop', 'pgp6.5.3', 'RSA1'])
p653rsapub60_d = read_test_file(
    [p653rsadir, 'key.pgp6.5.3.RSA1.6.0ext.pub.asc'])
p653rsasec60_d = read_test_file(
    [p653rsadir, 'key.pgp6.5.3.RSA1.6.0ext.sec.asc'])
p653rsapub_d = read_test_file([p653rsadir, 'key.pgp6.5.3.RSA1.pub.asc'])
p653rsasec_d = read_test_file([p653rsadir, 'key.pgp6.5.3.RSA1.sec.asc'])
p653rsasecnopass_d = read_test_file(
    [p653rsadir, 'key.pgp6.5.3.RSA1.sec.nopass.asc'])


class InteropSigPGP653A01RSA(unittest.TestCase):
    """PGP 6.5.3 RSA Signature Interop

    These tests cover interoperability with files created using
    PGP 6.5.3 RSA keys.
import os
import unittest

# test target
from openpgp.sap.crypto import verify

# package help
from openpgp.sap.armory import list_armored
from openpgp.sap.list import list_pkts, list_msgs

# test help
from support import sepjoin, read_test_file


# pgp6.5.3 RSA
p653rsadir = sepjoin(['pgpfiles','interop','pgp6.5.3','RSA1'])
p653rsapub60_d = read_test_file([p653rsadir,'key.pgp6.5.3.RSA1.6.0ext.pub.asc'])
p653rsasec60_d = read_test_file([p653rsadir,'key.pgp6.5.3.RSA1.6.0ext.sec.asc'])
p653rsapub_d = read_test_file([p653rsadir,'key.pgp6.5.3.RSA1.pub.asc'])
p653rsasec_d = read_test_file([p653rsadir,'key.pgp6.5.3.RSA1.sec.asc'])
p653rsasecnopass_d = read_test_file([p653rsadir,'key.pgp6.5.3.RSA1.sec.nopass.asc'])


class InteropSigPGP653A01RSA(unittest.TestCase):
    """PGP 6.5.3 RSA Signature Interop

    These tests cover interoperability with files created using
    PGP 6.5.3 RSA keys.
    """
    def testInteropP653SigA01RSA(self):
        "(interop) crypto.signature: verify PGP 6.5.3 RSA user ID"