X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=tests%2Ftest_crl.py;fp=tests%2Ftest_crl.py;h=7368d7fc707550bfe57643c87ae39ba2cf88602d;hb=ec180a333b81b220e5325bdba75dcbc44b4311c6;hp=0000000000000000000000000000000000000000;hpb=f078d5d2ff1d95ebaac507ec67331547a0cac2a9;p=pyderasn.git diff --git a/tests/test_crl.py b/tests/test_crl.py new file mode 100644 index 0000000..7368d7f --- /dev/null +++ b/tests/test_crl.py @@ -0,0 +1,62 @@ +# coding: utf-8 +# PyDERASN -- Python ASN.1 DER codec with abstract structures +# Copyright (C) 2017-2020 Sergey Matveev +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation, version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program. If not, see +# . +"""CRL related schemes, just to test the performance with them +""" + +from pyderasn import BitString +from pyderasn import Sequence +from pyderasn import SequenceOf +from pyderasn import tag_ctxc + +from tests.test_crts import AlgorithmIdentifier +from tests.test_crts import CertificateSerialNumber +from tests.test_crts import Extensions +from tests.test_crts import Name +from tests.test_crts import Time +from tests.test_crts import Version + + +class RevokedCertificate(Sequence): + schema = ( + ("userCertificate", CertificateSerialNumber()), + ("revocationDate", Time()), + ("crlEntryExtensions", Extensions(optional=True)), + ) + + +class RevokedCertificates(SequenceOf): + schema = RevokedCertificate() + + +class TBSCertList(Sequence): + schema = ( + ("version", Version(optional=True)), + ("signature", AlgorithmIdentifier()), + ("issuer", Name()), + ("thisUpdate", Time()), + ("nextUpdate", Time(optional=True)), + ("revokedCertificates", RevokedCertificates(optional=True)), + ("crlExtensions", Extensions(expl=tag_ctxc(0), optional=True)), + ) + + +class CertificateList(Sequence): + schema = ( + ("tbsCertList", TBSCertList()), + ("signatureAlgorithm", AlgorithmIdentifier()), + ("signatureValue", BitString()), + )