X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=pygost%2Fasn1schemas%2Fpfx.py;h=8b9a422018b015ec4238f6c317410f90bbb3492e;hb=69854a17b5ed9e7970acf34af1f478d8b27ef21e;hp=73dcd3c89d268737fd0e96082745dba73494d095;hpb=276e72e7d9ec5088d3d82211aefe119069a53d28;p=pygost.git diff --git a/pygost/asn1schemas/pfx.py b/pygost/asn1schemas/pfx.py index 73dcd3c..8b9a422 100644 --- a/pygost/asn1schemas/pfx.py +++ b/pygost/asn1schemas/pfx.py @@ -1,11 +1,10 @@ # coding: utf-8 # PyGOST -- Pure Python GOST cryptographic functions library -# Copyright (C) 2015-2018 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 -# 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 @@ -31,12 +30,20 @@ from pyderasn import tag_ctxp from pygost.asn1schemas.cms import CMSVersion from pygost.asn1schemas.cms import ContentType from pygost.asn1schemas.cms import Gost2814789Parameters +from pygost.asn1schemas.cms import Gost341215EncryptionParameters from pygost.asn1schemas.oids import id_data from pygost.asn1schemas.oids import id_encryptedData from pygost.asn1schemas.oids import id_Gost28147_89 +from pygost.asn1schemas.oids import id_gostr3412_2015_kuznyechik_ctracpkm +from pygost.asn1schemas.oids import id_gostr3412_2015_kuznyechik_ctracpkm_omac +from pygost.asn1schemas.oids import id_gostr3412_2015_magma_ctracpkm +from pygost.asn1schemas.oids import id_gostr3412_2015_magma_ctracpkm_omac from pygost.asn1schemas.oids import id_pbes2 from pygost.asn1schemas.oids import id_pbkdf2 +from pygost.asn1schemas.oids import id_pkcs9_certTypes_x509Certificate +from pygost.asn1schemas.prvkey import PrivateKeyInfo from pygost.asn1schemas.x509 import AlgorithmIdentifier +from pygost.asn1schemas.x509 import Certificate class PBKDF2Salt(Choice): @@ -85,7 +92,13 @@ class PBES2KDFs(AlgorithmIdentifier): class PBES2Encs(AlgorithmIdentifier): schema = ( ("algorithm", ObjectIdentifier(defines=( - (("parameters",), {id_Gost28147_89: Gost2814789Parameters()}), + (("parameters",), { + id_Gost28147_89: Gost2814789Parameters(), + id_gostr3412_2015_magma_ctracpkm: Gost341215EncryptionParameters(), + id_gostr3412_2015_magma_ctracpkm_omac: Gost341215EncryptionParameters(), + id_gostr3412_2015_kuznyechik_ctracpkm: Gost341215EncryptionParameters(), + id_gostr3412_2015_kuznyechik_ctracpkm_omac: Gost341215EncryptionParameters(), + }), ))), ("parameters", Any(optional=True)), ) @@ -169,9 +182,7 @@ class SafeContents(SequenceOf): schema = SafeBag() -class OctetStringSafeContents(Sequence): - tag_default = OctetString.tag_default - schema = (("safeContents", SafeContents()),) +OctetStringSafeContents = SafeContents(expl=OctetString.tag_default) class AuthSafe(Sequence): @@ -215,3 +226,25 @@ class EncryptedPrivateKeyInfo(Sequence): class PKCS8ShroudedKeyBag(EncryptedPrivateKeyInfo): pass + + +OctetStringX509Certificate = Certificate(expl=OctetString.tag_default) + + +class CertTypes(Any): + pass + + +class CertBag(Sequence): + schema = ( + ("certId", ObjectIdentifier(defines=( + (("certValue",), { + id_pkcs9_certTypes_x509Certificate: OctetStringX509Certificate(), + }), + ))), + ("certValue", CertTypes(expl=tag_ctxc(0))), + ) + + +class KeyBag(PrivateKeyInfo): + pass