
High-level serialization of data classes to DER, plus low-level typed ASN.1 tree model and builder DSL; rich ASN.1 types, OID registry, PEM and crypto structures.
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.
@Serializable Kotlin classes into DER with the kxs module.ObjectIdentifier, Asn1Integer, Asn1Real, Asn1Time, and Asn1String.kotlinx-io integration when your code lives on Source and Sink.oids module for readable diagnostics and developer tooling.| 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 |
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.
Awesome Syntax Notation One comes with extensive documentation that lets you interactively explore the ASN.1 structures used in the examples:
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.
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.
@Serializable Kotlin classes into DER with the kxs module.ObjectIdentifier, Asn1Integer, Asn1Real, Asn1Time, and Asn1String.kotlinx-io integration when your code lives on Source and Sink.oids module for readable diagnostics and developer tooling.| 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 |
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.
Awesome Syntax Notation One comes with extensive documentation that lets you interactively explore the ASN.1 structures used in the examples:
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.