1 2.. _type.namedtype: 3 4Fields of constructed types 5--------------------------- 6 7The :ref:`Sequence <univ.Sequence>`, :ref:`Set <univ.Set>` and 8:ref:`Choice <univ.Choice>` ASN.1 types embed other ASN.1 types 9as named fields. 10 11Each field can be expressed via the :ref:`NamedType <namedtype.NamedType>` 12object while the individual fields are brought together by the 13:ref:`NamedTypes <namedtype.NamedTypes>` object. 14 15Ultimately, the fields get attached to the ASN.1 type's *.componentType* 16attributes. 17 18.. code-block:: python 19 20 class RSAPublicKey(Sequence): 21 """ 22 ASN.1 specification: 23 24 RSAPublicKey ::= SEQUENCE { 25 modulus INTEGER, -- n 26 publicExponent INTEGER -- e 27 } 28 """ 29 componentType = NamedTypes( 30 NamedType('modulus', Integer()), 31 NamedType('publicExponent', Integer()) 32 ) 33 34.. toctree:: 35 :maxdepth: 2 36 37 /pyasn1/type/namedtype/namedtype 38 /pyasn1/type/namedtype/optionalnamedtype 39 /pyasn1/type/namedtype/defaultednamedtype 40 /pyasn1/type/namedtype/namedtypes 41