]> Cypherpunks.ru repositories - pygost.git/blobdiff - pygost/asn1schemas/x509.py
Make Go's crypto/x509 compatible example certificates
[pygost.git] / pygost / asn1schemas / x509.py
index 7977c31345ef4cc37e6fe0abe27c3d65114fc0cd..29a0a601eb285cc25a07dd6f0c1b171d202e372e 100644 (file)
@@ -23,6 +23,7 @@ from pyderasn import BitString
 from pyderasn import Boolean
 from pyderasn import Choice
 from pyderasn import GeneralizedTime
+from pyderasn import IA5String
 from pyderasn import Integer
 from pyderasn import ObjectIdentifier
 from pyderasn import OctetString
@@ -210,3 +211,27 @@ class CertificateList(Sequence):
         ("signatureAlgorithm", AlgorithmIdentifier()),
         ("signatureValue", BitString()),
     )
+
+
+class GeneralName(Choice):
+    schema = (
+        # ('otherName', AnotherName(impl=tag_ctxc(0))),
+        # ('rfc822Name', IA5String(impl=tag_ctxp(1))),
+        ('dNSName', IA5String(impl=tag_ctxp(2))),
+        # ('x400Address', ORAddress(impl=tag_ctxp(3))),
+        # ('x400Address', OctetString(impl=tag_ctxp(3))),
+        # ('directoryName', Name(expl=tag_ctxc(4))),
+        # ('ediPartyName', EDIPartyName(impl=tag_ctxc(5))),
+        # ('uniformResourceIdentifier', IA5String(impl=tag_ctxp(6))),
+        # ('iPAddress', OctetString(impl=tag_ctxp(7))),
+        # ('registeredID', ObjectIdentifier(impl=tag_ctxp(8))),
+    )
+
+
+class GeneralNames(SequenceOf):
+    schema = GeneralName()
+    bounds = (1, float('+inf'))
+
+
+class SubjectAltName(GeneralNames):
+    pass