Challenge Assignment
Take a PEM certificate, base64-decode the body to get raw DER bytes.
Manually parse the first 10 bytes by hand:
- What is the outer tag? (Should be
0x30 — SEQUENCE)
- How many bytes is the length field?
- What is the total length of the certificate content?
- What is the tag of the first inner element? (Should be another
0x30 — TBSCertificate)
- Verify your manual parse against
openssl asn1parse -inform DER
Write a Rust function parse_tlv(bytes: &[u8]) -> (u8, usize, &[u8]) that returns
(tag, content_length, content_bytes) for the first TLV in a byte slice.