]> Cypherpunks.ru repositories - pygost.git/blobdiff - pygost/asn1schemas/x509.py
Move x509's OIDs to oid module
[pygost.git] / pygost / asn1schemas / x509.py
index 831f9abc2f248275c22b5e96578886994098fb19..7977c31345ef4cc37e6fe0abe27c3d65114fc0cd 100644 (file)
@@ -1,6 +1,6 @@
 # coding: utf-8
 # PyGOST -- Pure Python GOST cryptographic functions library
-# Copyright (C) 2015-2020 Sergey Matveev <stargrave@stargrave.org>
+# Copyright (C) 2015-2021 Sergey Matveev <stargrave@stargrave.org>
 #
 # 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
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """:rfc:`5280` related structures (**NOT COMPLETE**)
 
-They are taken from `PyDERASN <http://pyderasn.cypherpunks.ru/`__ tests.
+They are taken from `PyDERASN <http://www.pyderasn.cypherpunks.ru/`__ tests.
 """
 
 from pyderasn import Any
@@ -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()),
     )
@@ -140,8 +146,8 @@ class SubjectKeyIdentifier(KeyIdentifier):
 
 class BasicConstraints(Sequence):
     schema = (
-        ('cA', Boolean(default=False)),
-        # ('pathLenConstraint', PathLenConstraint(optional=True)),
+        ("cA", Boolean(default=False)),
+        # ("pathLenConstraint", PathLenConstraint(optional=True)),
     )