tests: add new test against the e-Szigno public test TSA server which uses sha256
This commit is contained in:
parent
6b7a585552
commit
a7e2a7831b
Binary file not shown.
28
tests/api.py
28
tests/api.py
|
@ -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, '')
|
||||
|
||||
|
|
Reference in New Issue