Skip to main content

ASN.1 editor framework with support for encoding and decoding various codecs.

Project description

Build Coverage Status

asn1editor

Python based ASN.1 editor

This project contains a generic editor to view and edit ASN.1 encoded data. It can load and save data encoded in various ASN.1 formats. It uses asn1tools to parse ASN.1 specifications and read and write encoded data.

The controller part of the editor is written independently of the used GUI framework. A view implementation with wxPython is provided.

Screenshot

Usage

To start the wxPython based editor, install asn1editor via pip:

pip install asn1editor

Then you can run asn1editor from the shell

asn1editor [-h] [-type TYPE] [-data DATA] [asn1spec]

The ASN.1 specification to be loaded can be passed as an (optional) argument. The type inside the ASN.1 specification can be selected using the syntax < Module name >.< Type name >. Finally, a data file can be passed as well that contains data encoded in the ASN.1 specification.

Features

Supported types

The editor supports a large variety of ASN.1 data types:

  • INTEGER
  • REAL
  • ENUMERATED
  • BOOLEAN
  • OCTET STRING, VisibleString, UTF8String, GeneralString, IA5String, OBJECT IDENTIFIER
  • BIT STRING
  • SEQUENCE, SET
  • SEQUENCE OF, SET OF
  • CHOICE
  • DATE, TIME-OF-DAY, DATE-TIME, DURATION, GeneralizedTime, UTCTime

Supported encodings

The following encodings are supported for reading and writing data:

  • JER
  • OER
  • XER
  • DER
  • BER
  • PER
  • UPER

GUI features

  • Load and save encoded data

  • View the data in a tree view or as groups Screenshot

  • See limits of numeric values and texts as tooltips

  • Edit octet strings as ASCII or hex

  • List of recently opened specifications for quick access

  • Optional dark mode

  • Use a .style file to customize the way fields are displayed in asn1editor

    If an ASN.1 file is opened, asn1editor looks for an equally named file with a .style extension in the same directory. If it is found, it is loaded and used to refine the layout of the specification. A style file is JSON formatted and contains the name of the ASN.1 field as a key, and the layout specifier as value. The specifiers "read_only" and "hidden" are supported.

    Example:

    { "firstField": "read_only", "secondField": "hidden"}
    

IMPORTS

IMPORT references are automatically resolved if the ASN1 files containing the imported types reside in the same directory and have the extension ".asn".

Extending asn1editor

If you want to extend asn1editor with custom functionality, you can pass a plugin object to the WxPythonMainWindow object. The plugin object needs to inherit from asn1editor.Plugin.

Example:

import wx
from asn1editor import WxPythonMainWindow, Plugin

class MyPlugin(Plugin):
    # Implementation of abstract functions goes here
    pass

app = wx.App()

frame = WxPythonMainWindow(MyPlugin)

frame.Show()

app.MainLoop()

Plugin interface

In order to use custom data formats or to work with the data, plugins can be used. These plugins need to inherit from the Plugin.Plugin class and can use the PluginInterface.PluginInterface class to interact with the main application. A list of plugins can be passed to the constructor of the main editor class and is then automatically embedded in the application.

An example application is if a custom header is added to an ASN.1 encoded data. Then the plugin can decode the header, choose the appropriate ASN.1 specification, load it, decode the data and display it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asn1editor-0.5.1.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

asn1editor-0.5.1-py3-none-any.whl (51.6 kB view details)

Uploaded Python 3

File details

Details for the file asn1editor-0.5.1.tar.gz.

File metadata

  • Download URL: asn1editor-0.5.1.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

File hashes

Hashes for asn1editor-0.5.1.tar.gz
Algorithm Hash digest
SHA256 854b1494ec583ebcb9c14c197b92793da636c5b1470c1e98396e5cd24058b22e
MD5 800e5fb3c17ab60b08489334c8a634a8
BLAKE2b-256 6426483d46fbc486136df9d9380b9f97dfcc8a974412f3dd6f755189e520320e

See more details on using hashes here.

File details

Details for the file asn1editor-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: asn1editor-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 51.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

File hashes

Hashes for asn1editor-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35a9dd638a4131f04a7c70c8ed153038e7d8184ad211174fbbb6f393a4a2585b
MD5 08b8329c2e3a952574ebc3c01eaaf12a
BLAKE2b-256 6e0f431a6ec52e09626fe25fac4346014703ba7400453eeed2ba5facc8b4889f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page