X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=pygost%2Fasn1schemas%2Fcms.py;h=23099353217a6b683167212371fe534b12088b5b;hb=a2b4808f6628225be99874bd5f6a0f80a514db82;hp=f5e0a907096bbeee7de7436da35d834965621b61;hpb=21a30721c31912c296e1faced73e2fd0db191be9;p=pygost.git diff --git a/pygost/asn1schemas/cms.py b/pygost/asn1schemas/cms.py index f5e0a90..2309935 100644 --- a/pygost/asn1schemas/cms.py +++ b/pygost/asn1schemas/cms.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 @@ -36,6 +35,7 @@ from pygost.asn1schemas.oids import id_signedData from pygost.asn1schemas.oids import id_tc26_gost3410_2012_256 from pygost.asn1schemas.oids import id_tc26_gost3410_2012_512 from pygost.asn1schemas.x509 import AlgorithmIdentifier +from pygost.asn1schemas.x509 import Certificate from pygost.asn1schemas.x509 import SubjectPublicKeyInfo @@ -270,12 +270,26 @@ class SignerInfos(SetOf): schema = SignerInfo() +class CertificateChoices(Choice): + schema = ( + ('certificate', Certificate()), + # ('extendedCertificate', ExtendedCertificate(impl=tag_ctxp(0))), + # ('v1AttrCert', AttributeCertificateV1(impl=tag_ctxc(1))), # V1 is osbolete + # ('v2AttrCert', AttributeCertificateV2(impl=tag_ctxc(2))), + # ('other', OtherCertificateFormat(impl=tag_ctxc(3))), + ) + + +class CertificateSet(SetOf): + schema = CertificateChoices() + + class SignedData(Sequence): schema = ( ("version", CMSVersion()), ("digestAlgorithms", DigestAlgorithmIdentifiers()), ("encapContentInfo", EncapsulatedContentInfo()), - # ("certificates", CertificateSet(impl=tag_ctxc(0), optional=True)), + ("certificates", CertificateSet(impl=tag_ctxc(0), optional=True)), # ("crls", RevocationInfoChoices(impl=tag_ctxc(1), optional=True)), ("signerInfos", SignerInfos()), )