]> Cypherpunks.ru repositories - pyderasn.git/blob - tests/test_crl.py
7368d7fc707550bfe57643c87ae39ba2cf88602d
[pyderasn.git] / tests / test_crl.py
1 # coding: utf-8
2 # PyDERASN -- Python ASN.1 DER codec with abstract structures
3 # Copyright (C) 2017-2020 Sergey Matveev <stargrave@stargrave.org>
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as
7 # published by the Free Software Foundation, version 3 of the License.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this program.  If not, see
16 # <http://www.gnu.org/licenses/>.
17 """CRL related schemes, just to test the performance with them
18 """
19
20 from pyderasn import BitString
21 from pyderasn import Sequence
22 from pyderasn import SequenceOf
23 from pyderasn import tag_ctxc
24
25 from tests.test_crts import AlgorithmIdentifier
26 from tests.test_crts import CertificateSerialNumber
27 from tests.test_crts import Extensions
28 from tests.test_crts import Name
29 from tests.test_crts import Time
30 from tests.test_crts import Version
31
32
33 class RevokedCertificate(Sequence):
34     schema = (
35         ("userCertificate", CertificateSerialNumber()),
36         ("revocationDate", Time()),
37         ("crlEntryExtensions", Extensions(optional=True)),
38     )
39
40
41 class RevokedCertificates(SequenceOf):
42     schema = RevokedCertificate()
43
44
45 class TBSCertList(Sequence):
46     schema = (
47         ("version", Version(optional=True)),
48         ("signature", AlgorithmIdentifier()),
49         ("issuer", Name()),
50         ("thisUpdate", Time()),
51         ("nextUpdate", Time(optional=True)),
52         ("revokedCertificates", RevokedCertificates(optional=True)),
53         ("crlExtensions", Extensions(expl=tag_ctxc(0), optional=True)),
54     )
55
56
57 class CertificateList(Sequence):
58     schema = (
59         ("tbsCertList", TBSCertList()),
60         ("signatureAlgorithm", AlgorithmIdentifier()),
61         ("signatureValue", BitString()),
62     )