cryptography-serialization-asn1
ASN.1/DER: binary serialization of ASN.1/DER content via kotlinx.serialization
The module is currently experimental and is subject to API/ABI changes
Example
@Serializable
class SimpleAlgorithmIdentifier(
val algorithm: ObjectIdentifier,
val parameters: Nothing?,
)
val algorithm = SimpleAlgorithmIdentifier(ObjectIdentifier("1.2.840.113549.1.1.11"), null)
// encoding
val bytes = DER.encodeToByteArray(algorithm)
println(bytes.toHexString()) // prints "300d06092a864886f70d01010b0500"
// decoding
val decoded = DER.decodeFromByteArray<SimpleAlgorithmIdentifier>(bytes)
println(decoded.algorithm.value) // prints "1.2.840.113549.1.1.11"
Content copied to clipboard
Using in your projects
dependencies {
implementation("dev.whyoleg.cryptography:cryptography-serialization-asn1:0.4.0")
}
Content copied to clipboard
Packages
Link copied to clipboard
ASN.1/DER: binary serialization of ASN.1/DER content via kotlinx.serialization