tests: add new test against the e-Szigno public test TSA server which uses sha256

This commit is contained in:
Benjamin Dauvergne 2013-10-08 23:23:59 +02:00
parent 6b7a585552
commit a7e2a7831b
2 changed files with 22 additions and 6 deletions

BIN
data/e_szigno_test_tsa2.crt Normal file

Binary file not shown.

View File

@ -7,15 +7,31 @@ from pyasn1.type import univ
import rfc3161
class Rfc3161(unittest.TestCase):
PUBLIC_TSA_SERVER = 'http://time.certum.pl'
CERTIFICATE = os.path.join(os.path.dirname(__file__),
'../data/certum_certificate.crt')
def test_timestamp(self):
def test_time_certum_pl(self):
PUBLIC_TSA_SERVER = 'http://time.certum.pl'
CERTIFICATE = os.path.join(os.path.dirname(__file__),
'../data/certum_certificate.crt')
data = 'xx'
certificate = file(self.CERTIFICATE).read()
certificate = file(CERTIFICATE).read()
value, substrate = rfc3161.RemoteTimestamper(
self.PUBLIC_TSA_SERVER, certificate=certificate)(data=data)
PUBLIC_TSA_SERVER, certificate=certificate)(data=data)
self.assertIsInstance(rfc3161.get_timestamp(value), datetime.datetime)
self.assertNotEqual(value, None)
self.assertEqual(substrate, '')
def test_teszt_e_szigno_hu(self):
PUBLIC_TSA_SERVER = 'https://teszt.e-szigno.hu:440/tsa'
USERNAME = 'teszt'
PASSWORD = 'teszt'
CERTIFICATE = os.path.join(os.path.dirname(__file__),
'../data/e_szigno_test_tsa2.crt')
data = 'xx'
certificate = file(CERTIFICATE).read()
value, substrate = rfc3161.RemoteTimestamper(
PUBLIC_TSA_SERVER, certificate=certificate, username=USERNAME,
password=PASSWORD, hashname='sha256')(data=data)
self.assertIsInstance(rfc3161.get_timestamp(value), datetime.datetime)
self.assertNotEqual(value, None)
self.assertEqual(substrate, '')