Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

METADATA 8.3KB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. Metadata-Version: 2.1
  2. Name: pyasn1
  3. Version: 0.5.0
  4. Summary: Pure-Python implementation of ASN.1 types and DER/BER/CER codecs (X.208)
  5. Home-page: https://github.com/pyasn1/pyasn1
  6. Author: Ilya Etingof
  7. Author-email: etingof@gmail.com
  8. Maintainer: pyasn1 maintenance organization
  9. Maintainer-email: Christian Heimes <christian@python.org>
  10. License: BSD-2-Clause
  11. Project-URL: Documentation, https://pyasn1.readthedocs.io
  12. Project-URL: Source, https://github.com/pyasn1/pyasn1
  13. Project-URL: Issues, https://github.com/pyasn1/pyasn1/issues
  14. Project-URL: Changelog, https://pyasn1.readthedocs.io/en/latest/changelog.html
  15. Platform: any
  16. Classifier: Development Status :: 5 - Production/Stable
  17. Classifier: Environment :: Console
  18. Classifier: Intended Audience :: Developers
  19. Classifier: Intended Audience :: Education
  20. Classifier: Intended Audience :: Information Technology
  21. Classifier: Intended Audience :: System Administrators
  22. Classifier: Intended Audience :: Telecommunications Industry
  23. Classifier: License :: OSI Approved :: BSD License
  24. Classifier: Natural Language :: English
  25. Classifier: Operating System :: OS Independent
  26. Classifier: Programming Language :: Python :: 2
  27. Classifier: Programming Language :: Python :: 2.7
  28. Classifier: Programming Language :: Python :: 3
  29. Classifier: Programming Language :: Python :: 3.6
  30. Classifier: Programming Language :: Python :: 3.7
  31. Classifier: Programming Language :: Python :: 3.8
  32. Classifier: Programming Language :: Python :: 3.9
  33. Classifier: Programming Language :: Python :: 3.10
  34. Classifier: Programming Language :: Python :: 3.11
  35. Classifier: Programming Language :: Python :: Implementation :: CPython
  36. Classifier: Programming Language :: Python :: Implementation :: PyPy
  37. Classifier: Topic :: Communications
  38. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  39. Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7
  40. Description-Content-Type: text/markdown
  41. License-File: LICENSE.rst
  42. ASN.1 library for Python
  43. ------------------------
  44. [![PyPI](https://img.shields.io/pypi/v/pyasn1.svg?maxAge=2592000)](https://pypi.org/project/pyasn1)
  45. [![Python Versions](https://img.shields.io/pypi/pyversions/pyasn1.svg)](https://pypi.org/project/pyasn1/)
  46. [![Build status](https://github.com/pyasn1/pyasn1/actions/workflows/main.yml/badge.svg)](https://github.com/pyasn1/pyasn1/actions/workflows/main.yml)
  47. [![Coverage Status](https://img.shields.io/codecov/c/github/pyasn1/pyasn1.svg)](https://codecov.io/github/pyasn1/pyasn1)
  48. [![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/pyasn1/pyasn1/master/LICENSE.txt)
  49. This is a free and open source implementation of ASN.1 types and codecs
  50. as a Python package. It has been first written to support particular
  51. protocol (SNMP) but then generalized to be suitable for a wide range
  52. of protocols based on
  53. [ASN.1 specification](https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-X.208-198811-W!!PDF-E&type=items).
  54. **NOTE:** The package is now maintained by *Christian Heimes* and
  55. *Simon Pichugin* in project https://github.com/pyasn1/pyasn1.
  56. Features
  57. --------
  58. * Generic implementation of ASN.1 types (X.208)
  59. * Standards compliant BER/CER/DER codecs
  60. * Can operate on streams of serialized data
  61. * Dumps/loads ASN.1 structures from Python types
  62. * 100% Python, works with Python 2.7 and 3.6+
  63. * MT-safe
  64. * Contributed ASN.1 compiler [Asn1ate](https://github.com/kimgr/asn1ate)
  65. Why using pyasn1
  66. ----------------
  67. ASN.1 solves the data serialisation problem. This solution was
  68. designed long ago by the wise Ancients. Back then, they did not
  69. have the luxury of wasting bits. That is why ASN.1 is designed
  70. to serialise data structures of unbounded complexity into
  71. something compact and efficient when it comes to processing
  72. the data.
  73. That probably explains why many network protocols and file formats
  74. still rely on the 30+ years old technology. Including a number of
  75. high-profile Internet protocols and file formats.
  76. Quite a number of books cover the topic of ASN.1.
  77. [Communication between heterogeneous systems](http://www.oss.com/asn1/dubuisson.html)
  78. by Olivier Dubuisson is one of those high quality books freely
  79. available on the Internet.
  80. The pyasn1 package is designed to help Python programmers tackling
  81. network protocols and file formats at the comfort of their Python
  82. prompt. The tool struggles to capture all aspects of a rather
  83. complicated ASN.1 system and to represent it on the Python terms.
  84. How to use pyasn1
  85. -----------------
  86. With pyasn1 you can build Python objects from ASN.1 data structures.
  87. For example, the following ASN.1 data structure:
  88. ```bash
  89. Record ::= SEQUENCE {
  90. id INTEGER,
  91. room [0] INTEGER OPTIONAL,
  92. house [1] INTEGER DEFAULT 0
  93. }
  94. ```
  95. Could be expressed in pyasn1 like this:
  96. ```python
  97. class Record(Sequence):
  98. componentType = NamedTypes(
  99. NamedType('id', Integer()),
  100. OptionalNamedType(
  101. 'room', Integer().subtype(
  102. implicitTag=Tag(tagClassContext, tagFormatSimple, 0)
  103. )
  104. ),
  105. DefaultedNamedType(
  106. 'house', Integer(0).subtype(
  107. implicitTag=Tag(tagClassContext, tagFormatSimple, 1)
  108. )
  109. )
  110. )
  111. ```
  112. It is in the spirit of ASN.1 to take abstract data description
  113. and turn it into a programming language specific form.
  114. Once you have your ASN.1 data structure expressed in Python, you
  115. can use it along the lines of similar Python type (e.g. ASN.1
  116. `SET` is similar to Python `dict`, `SET OF` to `list`):
  117. ```python
  118. >>> record = Record()
  119. >>> record['id'] = 123
  120. >>> record['room'] = 321
  121. >>> str(record)
  122. Record:
  123. id=123
  124. room=321
  125. >>>
  126. ```
  127. Part of the power of ASN.1 comes from its serialisation features. You
  128. can serialise your data structure and send it over the network.
  129. ```python
  130. >>> from pyasn1.codec.der.encoder import encode
  131. >>> substrate = encode(record)
  132. >>> hexdump(substrate)
  133. 00000: 30 07 02 01 7B 80 02 01 41
  134. ```
  135. Conversely, you can turn serialised ASN.1 content, as received from
  136. network or read from a file, into a Python object which you can
  137. introspect, modify, encode and send back.
  138. ```python
  139. >>> from pyasn1.codec.der.decoder import decode
  140. >>> received_record, rest_of_substrate = decode(substrate, asn1Spec=Record())
  141. >>>
  142. >>> for field in received_record:
  143. >>> print('{} is {}'.format(field, received_record[field]))
  144. id is 123
  145. room is 321
  146. house is 0
  147. >>>
  148. >>> record == received_record
  149. True
  150. >>> received_record.update(room=123)
  151. >>> substrate = encode(received_record)
  152. >>> hexdump(substrate)
  153. 00000: 30 06 02 01 7B 80 01 7B
  154. ```
  155. The pyasn1 classes struggle to emulate their Python prototypes (e.g. int,
  156. list, dict etc.). But ASN.1 types exhibit more complicated behaviour.
  157. To make life easier for a Pythonista, they can turn their pyasn1
  158. classes into Python built-ins:
  159. ```python
  160. >>> from pyasn1.codec.native.encoder import encode
  161. >>> encode(record)
  162. {'id': 123, 'room': 321, 'house': 0}
  163. ```
  164. Or vice-versa -- you can initialize an ASN.1 structure from a tree of
  165. Python objects:
  166. ```python
  167. >>> from pyasn1.codec.native.decoder import decode
  168. >>> record = decode({'id': 123, 'room': 321, 'house': 0}, asn1Spec=Record())
  169. >>> str(record)
  170. Record:
  171. id=123
  172. room=321
  173. >>>
  174. ```
  175. With ASN.1 design, serialisation codecs are decoupled from data objects,
  176. so you could turn every single ASN.1 object into many different
  177. serialised forms. As of this moment, pyasn1 supports BER, DER, CER and
  178. Python built-ins codecs. The extremely compact PER encoding is expected
  179. to be introduced in the upcoming pyasn1 release.
  180. More information on pyasn1 APIs can be found in the
  181. [documentation](https://pyasn1.readthedocs.io/en/latest/pyasn1/contents.html),
  182. compiled ASN.1 modules for different protocols and file formats
  183. could be found in the pyasn1-modules
  184. [repo](https://github.com/pyasn1/pyasn1-modules).
  185. How to get pyasn1
  186. -----------------
  187. The pyasn1 package is distributed under terms and conditions of 2-clause
  188. BSD [license](https://pyasn1.readthedocs.io/en/latest/license.html). Source code is freely
  189. available as a GitHub [repo](https://github.com/pyasn1/pyasn1).
  190. You could `pip install pyasn1` or download it from [PyPI](https://pypi.org/project/pyasn1).
  191. If something does not work as expected,
  192. [open an issue](https://github.com/epyasn1/pyasn1/issues) at GitHub or
  193. post your question [on Stack Overflow](https://stackoverflow.com/questions/ask)
  194. or try browsing pyasn1
  195. [mailing list archives](https://sourceforge.net/p/pyasn1/mailman/pyasn1-users/).
  196. Copyright (c) 2005-2020, [Ilya Etingof](mailto:etingof@gmail.com).
  197. All rights reserved.