Skip to content

Latest commit

 

History

History
80 lines (49 loc) · 1.9 KB

README.adoc

File metadata and controls

80 lines (49 loc) · 1.9 KB

ASN1Kit

ASN.1 Decoder for Swift

API Documentation

Overview

This library can be used for ASN.1 (Abstract Syntax Notation One) encoding/decoding using distinguished encoding rules (DER) according to the ITU-T X.690

For more info, please find the complete X.690-0207.pdf specification.

Getting Started

ASN1Kit requires Swift 5.5.

Setup for integration

SPM

Put this in your Package.swift:

.package(url: "https://github.com/gematik/ASN1Kit.git", from: "1.2.0")

Setup for development

You will need Bundler, XcodeGen and fastlane to conveniently use the established development environment.

  1. Checkout (and build) dependencies and generate the xcodeproject

    $ make setup

Code Samples

Use ASN1Decoder.decode(asn1:) to decode serialized data:

link:Tests/ASN1KitTests/encodable/BitStringASN1EncodingTest.swift[role=include]

Construct an ASN1Object of your choice and serialize it:

link:Tests/ASN1KitTests/encodable/ArrayExtASN1EncodingTest.swift[role=include]

ASN.1-encode Swift primitives and extract the encoded value(s):

link:Tests/ASN1KitTests/encodable/IntExtASN1EncodingTest.swift[role=include]

Extract the tag of the first element of a constructed ASN1Object:

link:Tests/ASN1KitTests/ASN1ConstructedEncodingTest.swift[role=include]

License

Apache License Version 2.0

See LICENSE.