X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=pygost%2Fasn1schemas%2Fx509.py;h=831f9abc2f248275c22b5e96578886994098fb19;hb=ccf38ecbf1c166c0817893afd85bcb0976e09789;hp=7e3938591e4e0c70d7e8c5396358333c47c470c5;hpb=21a30721c31912c296e1faced73e2fd0db191be9;p=pygost.git diff --git a/pygost/asn1schemas/x509.py b/pygost/asn1schemas/x509.py index 7e39385..831f9ab 100644 --- a/pygost/asn1schemas/x509.py +++ b/pygost/asn1schemas/x509.py @@ -1,11 +1,10 @@ # coding: utf-8 # PyGOST -- Pure Python GOST cryptographic functions library -# Copyright (C) 2015-2019 Sergey Matveev +# Copyright (C) 2015-2020 Sergey Matveev # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# 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 @@ -113,6 +112,13 @@ class Validity(Sequence): ) +class GostR34102012PublicKeyParameters(Sequence): + schema = ( + ("publicKeyParamSet", ObjectIdentifier()), + ("digestParamSet", ObjectIdentifier(optional=True)), + ) + + class SubjectPublicKeyInfo(Sequence): schema = ( ("algorithm", AlgorithmIdentifier()), @@ -124,6 +130,21 @@ class UniqueIdentifier(BitString): pass +class KeyIdentifier(OctetString): + pass + + +class SubjectKeyIdentifier(KeyIdentifier): + pass + + +class BasicConstraints(Sequence): + schema = ( + ('cA', Boolean(default=False)), + # ('pathLenConstraint', PathLenConstraint(optional=True)), + ) + + class Extension(Sequence): schema = ( ("extnID", ObjectIdentifier()), @@ -158,3 +179,28 @@ class Certificate(Sequence): ("signatureAlgorithm", AlgorithmIdentifier()), ("signatureValue", BitString()), ) + + +class RevokedCertificates(SequenceOf): + # schema = RevokedCertificate() + schema = OctetString() # dummy + + +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()), + )