Pure-MoonBit ASN.1 DER codec and X.509 certificate toolkit.
moon add oilleelssq-wq/MoonBit-PKIimport { "oilleelssq-wq/MoonBit-PKI/asn1" @asn1 }
///|
test "read a DER integer" {
let reader = @asn1.DerReader::from_bytes(b"\x02\x01\x2a")
let value = try! reader.read_single()
inspect(value.to_string(), content="[UNIVERSAL 2 primitive] 1B 2a")
}import { "oilleelssq-wq/MoonBit-PKI/asn1" @asn1 }
///|
fn inspect_sequence(bytes : Bytes) -> Unit raise @asn1.DerError {
let outer = try! @asn1.DerReader::from_bytes(bytes).read_single()
let children = outer.children()
println(children[0].tag().to_string())
}| Package | Contents |
|---|---|
| oilleelssq-wq/MoonBit-PKI/asn1 | DER reader, value tree, primitive decoders, object identifiers |
| Item | Purpose |
|---|---|
| DerReader | Cursor over DER bytes: read_tlv, read_element, read_all, read_single |
| Der | Decoded tree of Primitive/Constructed values |
| Tag, TagClass | Decoded identifier octets |
| decode_integer, decode_boolean, decode_bit_string, ... | Primitive content decoders |
| ObjectIdentifier | Dotted-decimal OIDs |
| DerError | Decode failures |
moon check --target all --deny-warn
moon test --target all
moon fmt
moon infoInstall
Download zipPure-MoonBit ASN.1 DER codec and X.509 certificate toolkit.