Skip to content
All tools
Modern cryptoRuns locallyNo account

ASN.1 and X.509 certificate parser

Decode DER and PEM structures, walk the ASN.1 tree, and read certificate fields, extensions, and embedded public keys.

Open in ctfpal

Keys and certificates are ASN.1 structures encoded in DER, usually wrapped in Base64 with PEM headers. When a challenge hands you a .pem file, parsing it is how you extract the modulus and exponent that the RSA attack actually needs.

The encoding is deliberately self-describing: every element carries a tag saying what it is and a length saying how far it runs, so a parser can walk the whole structure without knowing the schema. That means you can pull an integer out of an unfamiliar key format without first finding a specification for it.

From PEM to parameters

  • Strip the -----BEGIN----- and -----END----- lines and Base64 decode the middle to get DER.
  • Walk the DER tree: a public key is a SEQUENCE containing the algorithm identifier and a BIT STRING holding another SEQUENCE of two INTEGERs - the modulus n and exponent e.
  • A private key adds d, p, q, and the CRT coefficients in the same structure.
  • Feed n and e to the RSA analyzer and check whether the modulus is small, or the exponent unusual.

Related tools