Skip to content

a-sit-plus/awesn1

awesn1

Awesome Syntax Notation One

A-SIT Plus Official GitHub licence Kotlin Kotlin Java Maven Central

Stop writing ASN.1. Model Kotlin data classes.

DocsAPI DocsMaven Central

awesn1 makes ASN.1 feel less like a punishment and more like a power-up. It is a Kotlin Multiplatform toolbox for DER, rich ASN.1 domain types, low-level wire work, and first-class kotlinx.serialization support.

If you want to model Kotlin types and get real ASN.1 bytes out the other end, awesn1 is the fast path. If you need to drop to raw TLV trees, explicit tags, OIDs, PEM, or byte-level control, it handles that too without blinking.

Why awesn1

  • Turn @Serializable Kotlin classes into DER with the kxs module.
  • Build and inspect raw ASN.1 trees with a typed low-level model and builder DSL.
  • Work with real ASN.1 domain types like ObjectIdentifier, Asn1Integer, Asn1Real, Asn1Time, and Asn1String.
  • Add kotlinx-io integration when your code lives on Source and Sink.
  • Load known OIDs through the optional oids module for readable diagnostics and developer tooling.
  • Full CycloneDX SBOMs on Maven Central alongside published artifacts for all targets.

Pick your module

Module Use it when you need...
core the ASN.1 element model, DER parsing/encoding helpers, PEM support, rich types, and the builder DSL
kxs kotlinx.serialization integration so Kotlin models encode and decode as ASN.1 DER
io low-level ASN.1 parsing and encoding on kotlinx.io.Source and kotlinx.io.Sink
crypto cryptographic data structures, such as certificates, SPKIs, CSRs, etc.
kxs-io DER kotlinx.serialization flows directly on Source/Sink
oids a bundled registry of known object identifiers and human-readable descriptions

Get started

implementation("at.asitplus.awesn1:core:$version")
implementation("at.asitplus.awesn1:kxs:$version")

Start with core if you want the low-level ASN.1 toolbox. Add kxs when you want the headline act: Kotlin models in, DER out.

Model the data. Encode it. Decode it. No handwritten ASN.1 schema gymnastics required.

import at.asitplus.awesn1.serialization.DER
import kotlinx.serialization.Serializable

@Serializable
data class Person(
    val name: String,
    val age: Int,
)

val value = Person(name = "A", age = 5)
val der = DER.encodeToByteArray(value)
check(der.toHexString() == "30060c0141020105")

val decoded = DER.decodeFromByteArray<Person>(der)
check(decoded == value)

That is a DER SEQUENCE containing a UTF-8 string and an integer. awesn1 handles the ASN.1 wire shape so you can stay focused on the Kotlin model.

What Next

Awesome Syntax Notation One comes with extensive documentation that lets you interactively explore the ASN.1 structures used in the examples:

Contributing

External contributions are welcome. See CONTRIBUTING.md for workflow details and the A-SIT Plus Contributor License Agreement requirements.


The Apache License does not apply to the logos, including the A-SIT logo, or the project and module names. These remain the property of A-SIT/A-SIT Plus GmbH and may not be used in derivative works without explicit permission.