X-Git-Url: http://www.git.cypherpunks.ru/?p=pygost.git;a=blobdiff_plain;f=pygost%2Fasn1schemas%2Fcms.py;h=2df3633158de3bc0fd65edbef29d0a45031b1b6b;hp=d2d53275159062cb3b0513544dce29c77f036559;hb=141ec28f940fbba3edb67252bc4e8707502b87ce;hpb=313eaab6514eff3ce3d1e4bee615eb38299c2f89 diff --git a/pygost/asn1schemas/cms.py b/pygost/asn1schemas/cms.py index d2d5327..2df3633 100644 --- a/pygost/asn1schemas/cms.py +++ b/pygost/asn1schemas/cms.py @@ -1,6 +1,6 @@ # coding: utf-8 # PyGOST -- Pure Python GOST cryptographic functions library -# Copyright (C) 2015-2020 Sergey Matveev +# Copyright (C) 2015-2021 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 @@ -307,10 +307,31 @@ class UnprotectedAttributes(SetOf): bounds = (1, float("+inf")) +class CertificateChoices(Choice): + schema = ( + ("certificate", Certificate()), + # ("extendedCertificate", OctetString(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 OriginatorInfo(Sequence): + schema = ( + ("certs", CertificateSet(impl=tag_ctxc(0), optional=True)), + # ("crls", RevocationInfoChoices(impl=tag_ctxc(1), optional=True)), + ) + + class EnvelopedData(Sequence): schema = ( ("version", CMSVersion()), - # ("originatorInfo", OriginatorInfo(impl=tag_ctxc(0), optional=True)), + ("originatorInfo", OriginatorInfo(impl=tag_ctxc(0), optional=True)), ("recipientInfos", RecipientInfos()), ("encryptedContentInfo", EncryptedContentInfo()), ("unprotectedAttrs", UnprotectedAttributes(impl=tag_ctxc(1), optional=True)), @@ -368,20 +389,6 @@ 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()),