From c77746f7982c41953bfbc06b28dceceda88042e9 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 18 Jan 2021 18:57:58 +0300 Subject: [PATCH] Move x509's OIDs to oid module --- pygost/asn1schemas/oids.py | 6 ++++++ pygost/asn1schemas/x509.py | 16 +++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pygost/asn1schemas/oids.py b/pygost/asn1schemas/oids.py index c40319a..2ec5936 100644 --- a/pygost/asn1schemas/oids.py +++ b/pygost/asn1schemas/oids.py @@ -1,6 +1,12 @@ from pyderasn import ObjectIdentifier +id_at_commonName = ObjectIdentifier("2.5.4.3") +id_at_countryName = ObjectIdentifier("2.5.4.6") +id_at_localityName = ObjectIdentifier("2.5.4.7") +id_at_stateOrProvinceName = ObjectIdentifier("2.5.4.8") +id_at_organizationName = ObjectIdentifier("2.5.4.10") + id_pkcs7 = ObjectIdentifier("1.2.840.113549.1.7") id_data = id_pkcs7 + (1,) id_signedData = id_pkcs7 + (2,) diff --git a/pygost/asn1schemas/x509.py b/pygost/asn1schemas/x509.py index a934a58..7977c31 100644 --- a/pygost/asn1schemas/x509.py +++ b/pygost/asn1schemas/x509.py @@ -35,6 +35,12 @@ from pyderasn import tag_ctxp from pyderasn import TeletexString from pyderasn import UTCTime +from pygost.asn1schemas.oids import id_at_commonName +from pygost.asn1schemas.oids import id_at_countryName +from pygost.asn1schemas.oids import id_at_localityName +from pygost.asn1schemas.oids import id_at_organizationName +from pygost.asn1schemas.oids import id_at_stateOrProvinceName + class Version(Integer): schema = ( @@ -73,11 +79,11 @@ class OrganizationName(Choice): class AttributeTypeAndValue(Sequence): schema = ( ("type", AttributeType(defines=(((".", "value"), { - ObjectIdentifier("2.5.4.6"): PrintableString(), - ObjectIdentifier("2.5.4.8"): PrintableString(), - ObjectIdentifier("2.5.4.7"): PrintableString(), - ObjectIdentifier("2.5.4.10"): OrganizationName(), - ObjectIdentifier("2.5.4.3"): PrintableString(), + id_at_countryName: PrintableString(), + id_at_stateOrProvinceName: PrintableString(), + id_at_localityName: PrintableString(), + id_at_organizationName: OrganizationName(), + id_at_commonName: PrintableString(), }),))), ("value", AttributeValue()), ) -- 2.44.0