Code Monkey home page Code Monkey logo

python-asn1's Introduction

GitHub Actions PyPI Package latest release PyPI Wheel Supported versions Supported implementations

Overview

Python-ASN1 is a simple ASN.1 encoder and decoder for Python 2.7 and 3.5+.

Features

  • Support BER (parser) and DER (parser and generator) encoding (except indefinite lengths)
  • 100% python, compatible with version 2.7, 3.5 and higher
  • Can be integrated by just including a file into your project

Dependencies

Python-ASN1 relies on Python-Future for Python 2 and 3 compatibility. To install Python-Future:

pip install future

How to install Python-asn1

Install from PyPi with the following:

pip install asn1

or download the repository from GitHub and install with the following:

python setup.py install

You can also simply include asn1.py into your project.

How to use Python-asn1

Note

You can find more detailed documentation on the Usage page.

Encoding

If you want to encode data and retrieve its DER-encoded representation, use code such as:

import asn1

encoder = asn1.Encoder()
encoder.start()
encoder.write('1.2.3', asn1.Numbers.ObjectIdentifier)
encoded_bytes = encoder.output()

Decoding

If you want to decode ASN.1 from DER or BER encoded bytes, use code such as:

import asn1

decoder = asn1.Decoder()
decoder.start(encoded_bytes)
tag, value = decoder.read()

Documentation

The complete documentation is available on Read The Docs:

python-asn1.readthedocs.io

License

Python-ASN1 is free software that is made available under the MIT license. Consult the file LICENSE that is distributed together with this library for the exact licensing terms.

Copyright

The following people have contributed to Python-ASN1. Collectively they own the copyright of this software.

python-asn1's People

Contributors

0xbf00 avatar ambiso avatar andreasbank avatar andrivet avatar fionafibration avatar geertj avatar jcrowgey avatar pyup-bot avatar takeshixx avatar thomwiggers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.