#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
from hypothesis import given
from hypothesis import settings
from hypothesis.strategies import integers
from hypothesis import given
from hypothesis import settings
from hypothesis.strategies import integers
ci.encode_cer(fd.write)
self.verify(cert_path, cms_path)
fd = open(cms_path, "rb")
ci.encode_cer(fd.write)
self.verify(cert_path, cms_path)
fd = open(cms_path, "rb")
ctx = {"bered": True}
for decode_path, obj, _ in ContentInfo().decode_evgen(raw, ctx=ctx):
if decode_path == ("content",):
ctx = {"bered": True}
for decode_path, obj, _ in ContentInfo().decode_evgen(raw, ctx=ctx):
if decode_path == ("content",):
buf = BytesIO()
agg_octet_string(evgens, ("encapContentInfo", "eContent"), raw, buf.write)
self.assertSequenceEqual(buf.getvalue(), data)
buf = BytesIO()
agg_octet_string(evgens, ("encapContentInfo", "eContent"), raw, buf.write)
self.assertSequenceEqual(buf.getvalue(), data)
def create_huge_file(self):
rnd = urandom(1<<20)
data_path = self.tmpfile()
start = time()
with open(data_path, "wb") as fd:
def create_huge_file(self):
rnd = urandom(1<<20)
data_path = self.tmpfile()
start = time()
with open(data_path, "wb") as fd:
# dgst.update(rnd)
fd.write(rnd)
print("data file written", time() - start)
return file_mmaped(open(data_path, "rb"))
# dgst.update(rnd)
fd.write(rnd)
print("data file written", time() - start)
return file_mmaped(open(data_path, "rb"))
"""
data_raw = self.create_huge_file()
key_path, cert_path, cert, skid = self.keypair()
"""
data_raw = self.create_huge_file()
key_path, cert_path, cert, skid = self.keypair()
ci.encode_cer(fd.write)
print("CMS written", time() - start)
self.verify(cert_path, cms_path)
ci.encode_cer(fd.write)
print("CMS written", time() - start)
self.verify(cert_path, cms_path)
@skipIf("PYDERASN_TEST_CMS_HUGE" not in environ, "PYDERASN_TEST_CMS_HUGE is not set")
def test_huge_der_2pass(self):
"""Same test as above, but 2pass DER encoder and just signature verification
@skipIf("PYDERASN_TEST_CMS_HUGE" not in environ, "PYDERASN_TEST_CMS_HUGE is not set")
def test_huge_der_2pass(self):
"""Same test as above, but 2pass DER encoder and just signature verification