ASN.1 DER parser for MoonBit. Supports PKCS#1 and PKCS#8 RSA private key parsing.
let (n, d) = @der.parse_rsa_key(der_bytes)
pub suberror DerError { Invalid(String)}
pub(all) struct EcPrivateKey { curve : String d : Bytes pub_x : Bytes? pub_y : Bytes?} derive(@moonbitlang/core/debug.DebugDebug)
pub(all) struct PublicKeyInfo { algorithm : String key : Bytes} derive(@moonbitlang/core/debug.DebugDebug)
pub(all) enum Tag { Boolean Integer BitString OctetString Null Oid Utf8String PrintableString UtcTime GeneralizedTime Sequence Set} derive(Eq)
impl Show for Tag
fn output(self : Tag, logger : &Logger) -> Unit
pub(all) struct Tlv { tag : Tag value : Bytes}
fn enter_sequence(data : Bytes, pos : Int) -> (Int, Int) raise DerError
fn from_pem(pem : String) -> Bytes
fn parse_ec_key(data : Bytes) -> EcPrivateKey raise DerError
fn parse_public_key(data : Bytes) -> PublicKeyInfo raise DerError
fn parse_rsa_key(data : Bytes) -> (Bytes, Bytes) raise DerError
fn read_integer_bytes(data : Bytes, pos : Int) -> (Bytes, Int) raise DerError
fn read_oid(data : Bytes, pos : Int) -> (String, Int) raise DerError
fn read_tlv(data : Bytes, pos : Int) -> (Tlv, Int) raise DerError
fn skip_tlv(data : Bytes, pos : Int) -> Int raise DerError
fn unwrap_pkcs8(data : Bytes) -> Bytes raise DerError
Install
Powered by MoonBit
© 2026 mooncakes.io